fix: remove redundant cp that caused 'same file' error when makepkg i… #17
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
| # ============================================================================== | |
| # .github/workflows/ci.yml — cpp-gen | |
| # ============================================================================== | |
| # Continuous integration pipeline. Runs on every push to main/master | |
| # and on pull requests, ensuring the project compiles and passes tests. | |
| # ============================================================================== | |
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| # Ignores tag pushes (covered by the release.yml workflow) | |
| tags-ignore: | |
| - "**" | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| # Cancels previous runs of the same PR/branch to save minutes | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ── Build & Test ───────────────────────────────────────────────────────────── | |
| build: | |
| name: Build & Test (Go ${{ matrix.go-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| go-version: | |
| - "1.22" | |
| - "1.23" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go ${{ matrix.go-version }} | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| cache: true | |
| - name: Verify dependencies | |
| run: | | |
| go mod verify | |
| go mod tidy | |
| git diff --exit-code go.mod go.sum | |
| - name: go vet | |
| run: go vet ./... | |
| - name: Build | |
| run: | | |
| go build -trimpath -ldflags "-s -w \ | |
| -X cpp-gen/cmd.AppVersion=ci \ | |
| -X cpp-gen/cmd.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) \ | |
| -X cpp-gen/cmd.GitCommit=${GITHUB_SHA::7}" \ | |
| -o /dev/null . | |
| - name: Test | |
| run: go test -v -race -coverprofile=coverage.out ./... | |
| - name: Upload coverage | |
| if: matrix.go-version == '1.22' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: coverage.out | |
| retention-days: 7 | |
| # ── Cross-compilation check ─────────────────────────────────────────────────── | |
| # Ensures the binary compiles for all targets that goreleaser will generate. | |
| cross-build: | |
| name: Cross-compile (${{ matrix.goos }}/${{ matrix.goarch }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - goos: linux | |
| goarch: amd64 | |
| - goos: linux | |
| goarch: "386" | |
| - goos: darwin | |
| goarch: amd64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| cache: true | |
| - name: Cross-compile ${{ matrix.goos }}/${{ matrix.goarch }} | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: "0" | |
| run: | | |
| go build -trimpath -ldflags "-s -w \ | |
| -X cpp-gen/cmd.AppVersion=ci \ | |
| -X cpp-gen/cmd.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) \ | |
| -X cpp-gen/cmd.GitCommit=${GITHUB_SHA::7}" \ | |
| -o /dev/null . | |
| # ── Lint ────────────────────────────────────────────────────────────────────── | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| cache: true | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v6 | |
| with: | |
| version: latest | |
| args: --timeout=5m |