|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | +env: |
| 10 | + # Go version we currently use to build containerd across all CI. |
| 11 | + # Note: don't forget to update `Binaries` step, as it contains the matrix of all supported Go versions. |
| 12 | + GO_VERSION: "1.21.0" |
| 13 | + |
| 14 | +permissions: # added using https://github.com/step-security/secure-workflows |
| 15 | + contents: read |
| 16 | + |
| 17 | +jobs: |
| 18 | + |
| 19 | + # |
| 20 | + # golangci-lint |
| 21 | + # |
| 22 | + linters: |
| 23 | + permissions: |
| 24 | + contents: read # for actions/checkout to fetch code |
| 25 | + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests |
| 26 | + name: Linters |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + timeout-minutes: 10 |
| 29 | + |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + os: [ubuntu-22.04, macos-12, windows-2022] |
| 33 | + |
| 34 | + steps: |
| 35 | + - uses: actions/setup-go@v4 |
| 36 | + with: |
| 37 | + go-version: ${{ env.GO_VERSION }} |
| 38 | + cache: false # see actions/setup-go#368 |
| 39 | + |
| 40 | + - uses: actions/checkout@v3 |
| 41 | + - uses: golangci/golangci-lint-action@v3 |
| 42 | + with: |
| 43 | + version: v1.52.2 |
| 44 | + skip-cache: true |
| 45 | + args: --timeout=5m |
| 46 | + |
| 47 | + # |
| 48 | + # Project checks |
| 49 | + # |
| 50 | + project: |
| 51 | + name: Project Checks |
| 52 | + if: github.repository == 'containerd/errdefs' |
| 53 | + runs-on: ubuntu-22.04 |
| 54 | + timeout-minutes: 5 |
| 55 | + |
| 56 | + steps: |
| 57 | + - uses: actions/setup-go@v4 |
| 58 | + with: |
| 59 | + go-version: ${{ env.GO_VERSION }} |
| 60 | + cache: false # see actions/setup-go#368 |
| 61 | + |
| 62 | + - uses: actions/checkout@v3 |
| 63 | + with: |
| 64 | + path: src/github.com/containerd/errdefs |
| 65 | + fetch-depth: 25 |
| 66 | + |
| 67 | + - uses: containerd/project-checks@v1.1.0 |
| 68 | + with: |
| 69 | + working-directory: src/github.com/containerd/errdefs |
| 70 | + repo-access-token: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + |
| 72 | + tests: |
| 73 | + name: Tests |
| 74 | + runs-on: ${{ matrix.os }} |
| 75 | + timeout-minutes: 5 |
| 76 | + |
| 77 | + strategy: |
| 78 | + matrix: |
| 79 | + os: [ubuntu-22.04, macos-12, windows-2022] |
| 80 | + |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v2 |
| 83 | + with: |
| 84 | + path: src/github.com/containerd/errdefs |
| 85 | + |
| 86 | + - uses: actions/setup-go@v2 |
| 87 | + with: |
| 88 | + go-version: ${{ env.GO_VERSION }} |
| 89 | + |
| 90 | + - name: Set env |
| 91 | + shell: bash |
| 92 | + run: | |
| 93 | + echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV |
| 94 | + echo "${{ github.workspace }}/bin" >> $GITHUB_PATH |
| 95 | +
|
| 96 | + - run: | |
| 97 | + go test -v -race |
| 98 | + working-directory: src/github.com/containerd/errdefs |
0 commit comments