|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - develop |
| 8 | + - release-* |
| 9 | + pull_request: {} |
| 10 | + workflow_dispatch: {} |
| 11 | + |
| 12 | +env: |
| 13 | + GO_VERSION: 1.18 |
| 14 | + |
| 15 | + DOCKER_USR: ${{ secrets.DOCKER_USR }} |
| 16 | + |
| 17 | +jobs: |
| 18 | + |
| 19 | + verify: |
| 20 | + runs-on: ubuntu-22.04 |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v3 |
| 24 | + - name: Verify Code |
| 25 | + run: make verify |
| 26 | + |
| 27 | + golangci-lint: |
| 28 | + runs-on: ubuntu-22.04 |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v3 |
| 32 | + with: |
| 33 | + submodules: true |
| 34 | + - name: Setup Go |
| 35 | + uses: actions/setup-go@v4 |
| 36 | + with: |
| 37 | + go-version: ${{ env.GO_VERSION }} |
| 38 | + - name: Lint golang code |
| 39 | + uses: golangci/golangci-lint-action@v3 |
| 40 | + with: |
| 41 | + version: v1.47.3 |
| 42 | + args: -v |
| 43 | + skip-cache: true |
| 44 | + |
| 45 | + markdownlint-misspell-shellcheck: |
| 46 | + runs-on: ubuntu-22.04 |
| 47 | + # this image is build from Dockerfile |
| 48 | + # https://github.com/pouchcontainer/pouchlinter/blob/master/Dockerfile |
| 49 | + container: pouchcontainer/pouchlinter:v0.1.2 |
| 50 | + steps: |
| 51 | + - name: Checkout |
| 52 | + uses: actions/checkout@v3 |
| 53 | + - name: Run misspell |
| 54 | + run: find ./* -name "*" | xargs misspell -error |
| 55 | + - name: Lint markdown files |
| 56 | + run: find ./ -name "*.md" | grep -v enhancements | grep -v .github | xargs mdl -r ~MD010,~MD013,~MD022,~MD024,~MD029,~MD031,~MD032,~MD033,~MD034,~MD036 |
| 57 | + |
| 58 | + unit-tests: |
| 59 | + runs-on: ubuntu-22.04 |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v3 |
| 62 | + with: |
| 63 | + submodules: true |
| 64 | + - name: Fetch History |
| 65 | + run: git fetch --prune --unshallow |
| 66 | + - name: Setup Go |
| 67 | + uses: actions/setup-go@v4 |
| 68 | + with: |
| 69 | + go-version: ${{ env.GO_VERSION }} |
| 70 | + - name: Cache Go Dependencies |
| 71 | + uses: actions/cache@v3 |
| 72 | + with: |
| 73 | + path: ~/go/pkg/mod |
| 74 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 75 | + restore-keys: ${{ runner.os }}-go- |
| 76 | + - name: Run Unit Tests |
| 77 | + run: make test |
| 78 | + - name: Publish Unit Test Coverage |
| 79 | + if: github.repository == 'opencurve/curveadm' |
| 80 | + uses: codecov/codecov-action@v3 |
| 81 | + with: |
| 82 | + name: codecov-umbrella |
| 83 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 84 | + flags: unittests |
| 85 | + files: ./cover.out |
| 86 | + fail_ci_if_error: true |
| 87 | + verbose: true |
| 88 | + e2e-tests: |
| 89 | + runs-on: ubuntu-22.04 |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v3 |
| 92 | + with: |
| 93 | + fetch-depth: 0 |
| 94 | + - uses: actions/setup-go@v4 |
| 95 | + with: |
| 96 | + go-version: ${{ env.GO_VERSION }} |
| 97 | + - uses: actions/cache@v3 |
| 98 | + with: |
| 99 | + path: ~/go/pkg/mod |
| 100 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 101 | + restore-keys: ${{ runner.os }}-go- |
| 102 | + |
| 103 | + - name: Run e2e Tests |
| 104 | + run: make e2e-tests |
0 commit comments