CI #2
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: | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| verify: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - windows-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| persist-credentials: false | |
| - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0 | |
| with: | |
| version: 11.4.0 | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 24 | |
| - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: false | |
| - name: Install frontend dependencies | |
| run: pnpm --dir web install --frozen-lockfile | |
| - name: Check frontend | |
| run: | | |
| pnpm --dir web check | |
| pnpm --dir web lint | |
| pnpm --dir web test | |
| - name: Check formatting and release scripts | |
| if: runner.os == 'Linux' | |
| run: | | |
| pnpm --dir web format:check | |
| web/node_modules/.bin/tsc -p tsconfig.json | |
| web/node_modules/.bin/oxfmt --config web/.oxfmtrc.json --check scripts/generate-third-party-licenses.mjs scripts/package-npm.mjs npm/gitna | |
| - name: Test npm launcher | |
| run: | | |
| node --test npm/gitna/test/platform.test.mjs | |
| node scripts/package-npm.mjs 0.0.0 dist-npm | |
| node -e "if (!require('node:fs').existsSync('dist-npm/gitna-0.0.0.tgz')) process.exit(1)" | |
| - name: Build embedded frontend | |
| run: pnpm --dir web build | |
| - name: Verify license inventory | |
| shell: bash | |
| run: | | |
| node scripts/generate-third-party-licenses.mjs | |
| git diff --exit-code -- THIRD_PARTY_LICENSES.txt | |
| - name: Test and build Go application | |
| run: | | |
| go vet ./... | |
| go test ./... | |
| go build -trimpath ./cmd/gitna | |
| - name: Smoke test Windows release packaging | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| ./scripts/package.ps1 0.0.0 dist-package | |
| if (!(Test-Path dist-package/gitna_0.0.0_windows_x64.zip)) { | |
| throw "Windows release packaging smoke test failed" | |
| } | |
| - name: Run Go race tests | |
| if: runner.os == 'Linux' | |
| run: go test -race ./... | |
| browser: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - windows-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| persist-credentials: false | |
| - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0 | |
| with: | |
| version: 11.4.0 | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 24 | |
| - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: false | |
| - name: Install dependencies | |
| run: pnpm --dir web install --frozen-lockfile | |
| - name: Install Chromium dependencies | |
| if: runner.os == 'Linux' | |
| run: pnpm --dir web exec playwright install --with-deps chromium | |
| - name: Install Chromium | |
| if: runner.os == 'Windows' | |
| run: pnpm --dir web exec playwright install chromium | |
| - name: Run browser tests | |
| run: pnpm --dir web test:e2e |