ci(github): improve workflow structure and add build job

This commit is contained in:
Valentin Maerten
2025-12-07 16:12:57 +01:00
parent 8cc70d5922
commit 2cb7eaa3cc

View File

@@ -13,8 +13,27 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
build:
name: 🔨 Build (${{ matrix.go-version }})
strategy:
fail-fast: false
matrix:
go-version: [1.24.x, 1.25.x]
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@v6
- name: ⬇️ Setup Go
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- name: 🔨 Build
run: go build -v ./cmd/task
test: test:
name: Test (${{ matrix.go-version }}, ${{ matrix.platform }}) name: 🧪 Test (${{ matrix.go-version }}, ${{ matrix.platform }})
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -22,67 +41,69 @@ jobs:
platform: [ubuntu-latest, macos-latest, windows-latest] platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
steps: steps:
- uses: actions/setup-go@v6 - name: 📥 Checkout
uses: actions/checkout@v6
- name: ⬇️ Setup Go
uses: actions/setup-go@v6
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v6 - name: ⬇️ Setup Task
uses: go-task/setup-task@v1
- name: Download Go modules - name: 🧪 Test
run: go mod download run: task test
env:
GOPROXY: https://proxy.golang.org
- name: Build
run: go build -o ./bin/task -v ./cmd/task
- name: Test
run: ./bin/task test --output=group --output-group-begin='::group::{{.TASK}}' --output-group-end='::endgroup::'
lint: lint:
name: Lint (${{ matrix.go-version }}) name: 🔍 Lint (${{ matrix.go-version }})
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
go-version: [1.24.x, 1.25.x] go-version: [1.24.x, 1.25.x]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/setup-go@v6 - name: 📥 Checkout
uses: actions/checkout@v6
- name: ⬇️ Setup Go
uses: actions/setup-go@v6
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v6 - name: 🔍 Lint
- name: golangci-lint
uses: golangci/golangci-lint-action@v9 uses: golangci/golangci-lint-action@v9
with: with:
version: v2.7.1 version: v2.7.1
lint-jsonschema: lint-jsonschema:
name: Lint JSON Schema name: 📋 Lint JSON Schema
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/setup-python@v6 - name: 📥 Checkout
uses: actions/checkout@v6
- name: ⬇️ Setup Python
uses: actions/setup-python@v6
with: with:
python-version: 3.14 python-version: 3.14
- uses: actions/checkout@v6 - name: ⬇️ Install check-jsonschema
- name: install check-jsonschema
run: python -m pip install 'check-jsonschema==0.27.3' run: python -m pip install 'check-jsonschema==0.27.3'
- name: check-jsonschema (metaschema) - name: 📋 Validate JSON Schema
run: check-jsonschema --check-metaschema website/src/public/schema.json run: check-jsonschema --check-metaschema website/src/public/schema.json
ci-status: ci-status:
name: CI name: CI
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [test, lint, lint-jsonschema] needs: [build, test, lint, lint-jsonschema]
if: always() if: always()
steps: steps:
- name: Check CI status - name: Check CI status
run: | run: |
if [[ "${{ needs.test.result }}" != "success" ]] || \ if [[ "${{ needs.build.result }}" != "success" ]] || \
[[ "${{ needs.test.result }}" != "success" ]] || \
[[ "${{ needs.lint.result }}" != "success" ]] || \ [[ "${{ needs.lint.result }}" != "success" ]] || \
[[ "${{ needs.lint-jsonschema.result }}" != "success" ]]; then [[ "${{ needs.lint-jsonschema.result }}" != "success" ]]; then
echo "CI failed" echo "CI failed"