feat(libs): create libs/project module with Backend abstraction #363
Workflow file for this run
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: Health Check | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| go-version: ['1.24.x'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| cache-dependency-path: | | |
| cli/go.sum | |
| libs/schemas/go.sum | |
| - name: Download CLI dependencies | |
| working-directory: ./cli | |
| run: go mod download | |
| - name: Download libs/schemas dependencies | |
| working-directory: ./libs/schemas | |
| run: go mod download | |
| - name: Run CLI tests | |
| working-directory: ./cli | |
| run: go test -race ./... | |
| - name: Run libs/schemas tests | |
| working-directory: ./libs/schemas | |
| run: go test -race ./... | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.x' | |
| cache-dependency-path: | | |
| cli/go.sum | |
| libs/schemas/go.sum | |
| - name: Run golangci-lint (CLI) | |
| uses: golangci/golangci-lint-action@v8 | |
| with: | |
| version: latest | |
| working-directory: ./cli | |
| args: --config=.golangci.yml | |
| - name: Run golangci-lint (libs/schemas) | |
| uses: golangci/golangci-lint-action@v8 | |
| with: | |
| version: latest | |
| working-directory: ./libs/schemas | |
| args: --config=${{ github.workspace }}/.golangci.yml | |
| cue-validation: | |
| name: CUE Schema Validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.x' | |
| cache-dependency-path: libs/schemas/go.sum | |
| - name: Install CUE | |
| uses: cue-lang/[email protected] | |
| - name: Validate CUE schemas | |
| working-directory: ./libs/schemas | |
| run: cue vet ./... | |
| - name: Check generated types are up-to-date | |
| working-directory: ./libs/schemas | |
| run: | | |
| # Generate types | |
| go generate ./... | |
| # Check if there are any changes | |
| if ! git diff --exit-code cue_types_gen.go project/cue_types_gen.go; then | |
| echo "Generated Go types are out of date!" | |
| echo "Run 'cd libs/schemas && go generate ./...' and commit the changes." | |
| exit 1 | |
| fi | |
| echo "Generated types are up-to-date" | |
| build: | |
| name: Build | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| include: | |
| - os: ubuntu-latest | |
| goos: linux | |
| - os: macos-latest | |
| goos: darwin | |
| - os: windows-latest | |
| goos: windows | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.x' | |
| cache-dependency-path: cli/go.sum | |
| - name: Build binary | |
| working-directory: ./cli | |
| env: | |
| CGO_ENABLED: 0 | |
| run: go build -v -trimpath -o ../sow${{ matrix.goos == 'windows' && '.exe' || '' }} . | |
| - name: Test binary | |
| run: ./sow${{ matrix.goos == 'windows' && '.exe' || '' }} --version |