ci: add GitHub Actions workflows, multi-arch release pipeline, CODEOWNERS, and PR template
swadhinbiswas committed 2 months ago
c674e22
1 parent d274138
commit c674e22
5 files changed
+194 -0
Showing 5 changed files+194-0
▼.github/CODEOWNERS
+3-0
| @@ -0,0 +1,3 @@ | ||
1 | +# Global code ownership | |
2 | +# Every file in the repository requires review and approval from @swadhinbiswas | |
3 | +* @swadhinbiswas | |
0 | 4 | |
▼.github/pull_request_template.md
+20-0
| @@ -0,0 +1,20 @@ | ||
1 | +## Description | |
2 | +<!-- Provide a brief summary of the changes introduced in this PR --> | |
3 | + | |
4 | +## Type of Change | |
5 | +- [ ] Bug fix (non-breaking change which fixes an issue) | |
6 | +- [ ] New feature (non-breaking change which adds functionality) | |
7 | +- [ ] New detector (adds support for a new package manager or toolchain) | |
8 | +- [ ] Documentation update | |
9 | +- [ ] Performance improvement | |
10 | + | |
11 | +## Checklist | |
12 | +- [ ] My code follows the project style guidelines (`make fmt`). | |
13 | +- [ ] I have performed a self-review of my code (`make lint`). | |
14 | +- [ ] All existing and new unit tests pass cleanly (`make test`). | |
15 | +- [ ] I have added tests that prove my fix is effective or that my feature works. | |
16 | +- [ ] My changes generate no new warnings. | |
17 | + | |
18 | +## Review & Merge Requirements | |
19 | +- [ ] Continuous Integration (CI) test matrix passing across all Go versions. | |
20 | +- [ ] Code owner approval from repository maintainer (@swadhinbiswas). | |
0 | 21 | |
▼.github/workflows/ci.yml
+112-0
| @@ -0,0 +1,112 @@ | ||
1 | +name: CI | |
2 | + | |
3 | +on: | |
4 | + push: | |
5 | + branches: [ main ] | |
6 | + pull_request: | |
7 | + branches: [ main ] | |
8 | + | |
9 | +concurrency: | |
10 | + group: ${{ github.workflow }}-${{ github.ref }} | |
11 | + cancel-in-progress: true | |
12 | + | |
13 | +jobs: | |
14 | + lint: | |
15 | + name: Lint & Format Check | |
16 | + runs-on: ubuntu-latest | |
17 | + steps: | |
18 | + - name: Checkout Code | |
19 | + uses: actions/checkout@v4 | |
20 | + | |
21 | + - name: Set up Go | |
22 | + uses: actions/setup-go@v5 | |
23 | + with: | |
24 | + go-version: '1.24' | |
25 | + cache: true | |
26 | + | |
27 | + - name: Verify Formatting | |
28 | + run: | | |
29 | + UNFORMATTED=$(gofmt -l .) | |
30 | + if [ -n "$UNFORMATTED" ]; then | |
31 | + echo "The following files are not formatted properly:" | |
32 | + echo "$UNFORMATTED" | |
33 | + exit 1 | |
34 | + fi | |
35 | + | |
36 | + - name: Go Vet | |
37 | + run: go vet ./... | |
38 | + | |
39 | + test: | |
40 | + name: Test & Coverage (${{ matrix.go-version }}) | |
41 | + runs-on: ubuntu-latest | |
42 | + needs: lint | |
43 | + strategy: | |
44 | + fail-fast: false | |
45 | + matrix: | |
46 | + go-version: [ '1.22', '1.23', '1.24' ] | |
47 | + steps: | |
48 | + - name: Checkout Code | |
49 | + uses: actions/checkout@v4 | |
50 | + | |
51 | + - name: Set up Go | |
52 | + uses: actions/setup-go@v5 | |
53 | + with: | |
54 | + go-version: ${{ matrix.go-version }} | |
55 | + cache: true | |
56 | + | |
57 | + - name: Run Unit Tests with Race Detector | |
58 | + run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... | |
59 | + | |
60 | + - name: Upload Coverage Artifact | |
61 | + if: matrix.go-version == '1.24' | |
62 | + uses: actions/upload-artifact@v4 | |
63 | + with: | |
64 | + name: code-coverage | |
65 | + path: coverage.txt | |
66 | + | |
67 | + build-cross: | |
68 | + name: Multi-Arch Build Verification | |
69 | + runs-on: ubuntu-latest | |
70 | + needs: test | |
71 | + strategy: | |
72 | + matrix: | |
73 | + goarch: [ 'amd64', 'arm64', 'arm' ] | |
74 | + steps: | |
75 | + - name: Checkout Code | |
76 | + uses: actions/checkout@v4 | |
77 | + | |
78 | + - name: Set up Go | |
79 | + uses: actions/setup-go@v5 | |
80 | + with: | |
81 | + go-version: '1.24' | |
82 | + cache: true | |
83 | + | |
84 | + - name: Build Binary (linux/${{ matrix.goarch }}) | |
85 | + env: | |
86 | + GOOS: linux | |
87 | + GOARCH: ${{ matrix.goarch }} | |
88 | + CGO_ENABLED: 0 | |
89 | + run: | | |
90 | + go build -ldflags="-s -w" -o veet-linux-${{ matrix.goarch }} . | |
91 | + ls -la veet-linux-${{ matrix.goarch }} | |
92 | + | |
93 | + installer-check: | |
94 | + name: Installer Script Integrity | |
95 | + runs-on: ubuntu-latest | |
96 | + needs: lint | |
97 | + steps: | |
98 | + - name: Checkout Code | |
99 | + uses: actions/checkout@v4 | |
100 | + | |
101 | + - name: Set up Go | |
102 | + uses: actions/setup-go@v5 | |
103 | + with: | |
104 | + go-version: '1.24' | |
105 | + cache: true | |
106 | + | |
107 | + - name: Test Local Installation Script | |
108 | + run: | | |
109 | + chmod +x install.sh | |
110 | + ./install.sh | |
111 | + ~/.local/bin/veet --help | |
112 | + ~/.local/bin/veet scan | |
0 | 113 | |
▼.github/workflows/release.yml
+58-0
| @@ -0,0 +1,58 @@ | ||
1 | +name: Release | |
2 | + | |
3 | +on: | |
4 | + push: | |
5 | + tags: | |
6 | + - 'v*' | |
7 | + | |
8 | +permissions: | |
9 | + contents: write | |
10 | + | |
11 | +jobs: | |
12 | + build-release: | |
13 | + name: Build & Publish Release Binaries | |
14 | + runs-on: ubuntu-latest | |
15 | + steps: | |
16 | + - name: Checkout Code | |
17 | + uses: actions/checkout@v4 | |
18 | + with: | |
19 | + fetch-depth: 0 | |
20 | + | |
21 | + - name: Set up Go | |
22 | + uses: actions/setup-go@v5 | |
23 | + with: | |
24 | + go-version: '1.24' | |
25 | + cache: true | |
26 | + | |
27 | + - name: Run Tests | |
28 | + run: go test -v ./... | |
29 | + | |
30 | + - name: Compile Multi-Architecture Binaries | |
31 | + run: | | |
32 | + mkdir -p dist | |
33 | + TAG_NAME="${{ github.ref_name }}" | |
34 | + | |
35 | + # Linux amd64 (x86_64) | |
36 | + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${TAG_NAME}" -o dist/veet-linux-amd64 . | |
37 | + tar -czf dist/veet-${TAG_NAME}-linux-amd64.tar.gz -C dist veet-linux-amd64 | |
38 | + | |
39 | + # Linux arm64 (aarch64) | |
40 | + GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${TAG_NAME}" -o dist/veet-linux-arm64 . | |
41 | + tar -czf dist/veet-${TAG_NAME}-linux-arm64.tar.gz -C dist veet-linux-arm64 | |
42 | + | |
43 | + # Linux armv7 | |
44 | + GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${TAG_NAME}" -o dist/veet-linux-armv7 . | |
45 | + tar -czf dist/veet-${TAG_NAME}-linux-armv7.tar.gz -C dist veet-linux-armv7 | |
46 | + | |
47 | + # Checksums | |
48 | + cd dist | |
49 | + sha256sum *.tar.gz > checksums.txt | |
50 | + cat checksums.txt | |
51 | + | |
52 | + - name: Create GitHub Release | |
53 | + uses: softprops/action-gh-release@v2 | |
54 | + with: | |
55 | + files: | | |
56 | + dist/*.tar.gz | |
57 | + dist/checksums.txt | |
58 | + generate_release_notes: true | |
0 | 59 | |
▼README.md
+1-0
| @@ -4,6 +4,7 @@ | ||
4 | 4 | |
5 | 5 | <br/> |
6 | 6 | |
7 | +[](https://github.com/swadhinbiswas/veet/actions/workflows/ci.yml) | |
7 | 8 | [](https://go.dev) |
8 | 9 | [](LICENSE) |
9 | 10 | [](#) |
10 | 11 | |