test(air): fix flaky TestSyncEmails_DoesNotHoldRuntimeLockAcrossFetch… #281
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 | |
| with: | |
| go-version: '1.26' | |
| check-latest: true | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Check formatting | |
| run: test -z "$(gofmt -l .)" || (gofmt -l . && exit 1) | |
| - name: Run go vet | |
| run: go vet ./... | |
| - name: Run tests | |
| run: go test ./... -short -race | |
| - name: Check vulnerabilities | |
| run: go install golang.org/x/vuln/cmd/govulncheck@latest && govulncheck ./... | |
| - name: Build | |
| run: go build ./cmd/nylas | |
| docker: | |
| needs: [test, lint] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Log in to GHCR | |
| if: github.event_name == 'push' | |
| uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| if: github.event_name == 'push' | |
| uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 | |
| with: | |
| context: . | |
| load: true | |
| tags: nylas-cli:test | |
| build-args: | | |
| VERSION=ci | |
| COMMIT=${{ github.sha }} | |
| - name: Smoke test Docker image | |
| run: | | |
| docker run --rm nylas-cli:test --version | grep -q "ci" | |
| docker run --rm nylas-cli:test commands --json >/tmp/nylas-commands.json | |
| jq empty /tmp/nylas-commands.json | |
| - name: Build and push multi-arch image to GHCR | |
| if: github.event_name == 'push' | |
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6 | |
| env: | |
| SHA: ${{ github.sha }} | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ghcr.io/nylas/cli:main | |
| ghcr.io/nylas/cli:sha-${{ github.sha }} | |
| build-args: | | |
| VERSION=ci | |
| COMMIT=${{ github.sha }} | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 | |
| with: | |
| go-version: '1.26' | |
| check-latest: true | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@9fae48acfc02a90574d7c304a1758ef9895495fa # v7 | |
| with: | |
| version: v2.11.1 | |
| args: --timeout=5m |