|
| 1 | +# When a third-party action is added (i.e., `uses`), please also add it to `download-licenses` in Makefile. |
| 2 | +name: CI |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths-ignore: |
| 8 | + - '*.md' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + gen-code-no-diff: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v3 |
| 22 | + - uses: actions/setup-go@v3 |
| 23 | + with: |
| 24 | + go-version-file: go.mod |
| 25 | + cache: true |
| 26 | + - run: make gen-code |
| 27 | + - run: git diff --exit-code |
| 28 | + unit-tests: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v3 |
| 32 | + - uses: actions/setup-go@v3 |
| 33 | + with: |
| 34 | + # Since this repository is not meant to be used as a library, |
| 35 | + # we don't need to test the latest 2 major releases like Go does: https://go.dev/doc/devel/release#policy. |
| 36 | + go-version-file: go.mod |
| 37 | + cache: true |
| 38 | + - run: make test-unit |
| 39 | + # It's recommended to run golangci-lint in a job separate from other jobs (go test, etc) because different jobs run in parallel. |
| 40 | + go-linter: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + # TODO: Remove this when we make the repos public. |
| 43 | + env: |
| 44 | + GOPRIVATE: github.com/runfinch/common-tests |
| 45 | + ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }} |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v3 |
| 48 | + - uses: actions/setup-go@v3 |
| 49 | + with: |
| 50 | + go-version-file: go.mod |
| 51 | + cache: true |
| 52 | + # TODO: Remove this when we make the repos public. |
| 53 | + - run: git config --global url.https://[email protected]/.insteadOf https://github.com/ |
| 54 | + - name: golangci-lint |
| 55 | + uses: golangci/golangci-lint-action@v3 |
| 56 | + with: |
| 57 | + # Pin the version in case all the builds start to fail at the same time. |
| 58 | + # There may not be an automatic way (e.g., dependabot) to update a specific parameter of a Github Action, |
| 59 | + # so we will just update it manually whenever it makes sense (e.g., a feature that we want is added). |
| 60 | + version: v1.50.0 |
| 61 | + args: --fix=false |
| 62 | + go-mod-tidy-check: |
| 63 | + runs-on: ubuntu-latest |
| 64 | + # TODO: Remove this when we make the repos public. |
| 65 | + env: |
| 66 | + GOPRIVATE: github.com/runfinch/common-tests |
| 67 | + ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }} |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v3 |
| 70 | + - uses: actions/setup-go@v3 |
| 71 | + with: |
| 72 | + go-version-file: go.mod |
| 73 | + cache: true |
| 74 | + # TODO: Remove this when we make the repos public. |
| 75 | + - run: git config --global url.https://[email protected]/.insteadOf https://github.com/ |
| 76 | + # TODO: Use `go mod tidy --check` after https://github.com/golang/go/issues/27005 is fixed. |
| 77 | + - run: go mod tidy |
| 78 | + - run: git diff --exit-code |
| 79 | + check-licenses: |
| 80 | + runs-on: ubuntu-latest |
| 81 | + # TODO: Remove this when we make the repos public. |
| 82 | + env: |
| 83 | + GOPRIVATE: github.com/runfinch/common-tests |
| 84 | + ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }} |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v3 |
| 87 | + - uses: actions/setup-go@v3 |
| 88 | + with: |
| 89 | + go-version-file: go.mod |
| 90 | + cache: true |
| 91 | + # TODO: Remove this when we make the repos public. |
| 92 | + - run: git config --global url.https://[email protected]/.insteadOf https://github.com/ |
| 93 | + - run: make check-licenses |
| 94 | + e2e-tests: |
| 95 | + strategy: |
| 96 | + fail-fast: false |
| 97 | + matrix: |
| 98 | + os: [[self-hosted, macos, amd64, 11.7], [self-hosted, macos, amd64, 12.6], [self-hosted, macos, arm64, 11.7], [self-hosted, macos, arm64, 12.6]] |
| 99 | + runs-on: ${{ matrix.os }} |
| 100 | + # TODO: Remove this when we make the repos public |
| 101 | + env: |
| 102 | + ACCESS_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }} |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v3 |
| 105 | + - name: Clean up previous files |
| 106 | + run: | |
| 107 | + sudo rm -rf /opt/finch |
| 108 | + sudo rm -rf ~/.finch |
| 109 | + - run: brew install go lz4 automake autoconf libtool |
| 110 | + - name: Build project |
| 111 | + run: | |
| 112 | + export PATH="/opt/homebrew/opt/libtool/libexec/gnubin:$PATH" |
| 113 | + which libtool |
| 114 | + make |
| 115 | + # TODO: Remove this when we make the repos public |
| 116 | + - name: Configure repo access |
| 117 | + run: git config --global url.https://[email protected]/.insteadOf https://github.com/ |
| 118 | + - run: make test-e2e |
0 commit comments