ci: split Go jobs, add concurrency and workflow dispatch #4
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: ["**"] | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| contracts: | |
| name: Contracts Validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Validate OpenAPI contract | |
| run: npx --yes @apidevtools/swagger-cli validate packages/contracts/api.yaml | |
| go_api: | |
| name: Go API Test + Build | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: apps/api | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: apps/api/go.mod | |
| cache-dependency-path: apps/api/go.sum | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Test API | |
| run: go test ./... | |
| - name: Build API | |
| run: | | |
| mkdir -p bin | |
| go build -trimpath \ | |
| -ldflags "-X main.version=${GITHUB_SHA} -X main.commit=${GITHUB_SHA} -X main.builtAt=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ | |
| -o bin/accessd ./cmd/server | |
| go_connector: | |
| name: Go Connector Test + Build | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: apps/connector | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: apps/connector/go.mod | |
| cache-dependency-path: apps/connector/go.sum | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Test Connector | |
| run: go test ./... | |
| - name: Build Connector | |
| run: | | |
| mkdir -p bin | |
| go build -trimpath -o bin/accessd-connector ./cmd/connector | |
| ui: | |
| name: UI Install + Build | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: apps/ui | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: apps/ui/package-lock.json | |
| - name: Install UI dependencies | |
| run: npm ci | |
| - name: Build UI | |
| run: npm run build |