-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions workflow for building, testing, and scanning Go an…
…d Vue projects
- Loading branch information
Showing
1 changed file
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: 🛠️ Build, Test & Scan | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-go: | ||
name: 🐹 Build Go Project | ||
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.22' | ||
|
||
- name: 📦 Install Go Dependencies | ||
run: go mod tidy | ||
|
||
- name: 🛠️ Build Go Project | ||
run: go build -o server ./cmd/server/main.go | ||
|
||
build-vue: | ||
name: 🌐 Build Vue Project | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 📥 Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: 🌐 Set Up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
|
||
- name: 📦 Install Vue Dependencies | ||
run: | | ||
cd ui | ||
npm install | ||
- name: 🖥️ Build Vue Project | ||
run: | | ||
cd ui | ||
npm run build | ||
test-go: | ||
name: ✅ Run Go Tests | ||
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.22' | ||
|
||
- name: 📦 Install Go Dependencies | ||
run: go mod tidy | ||
|
||
- name: ✅ Run Go Tests with Coverage | ||
run: go test ./... -v -coverprofile=coverage.out | ||
|
||
- name: 📊 Upload Code Coverage Report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: go-code-coverage | ||
path: coverage.out | ||
|
||
- name: 📝 Publish Coverage to Coveralls | ||
uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
path-to-profile: coverage.out | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
scan-vulnerabilities: | ||
name: 🔍 Scan for Vulnerabilities | ||
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.22' | ||
|
||
- name: 📦 Install Go Dependencies | ||
run: go mod tidy | ||
|
||
- name: 🔍 Run Golang Security Scanner | ||
uses: securego/gosec@v2.21.4 | ||
with: | ||
args: '-no-fail -fmt sarif -out results.sarif ./...' | ||
|
||
- name: 📝 Upload SARIF Results | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: results.sarif | ||
|
||
- name: 🌐 Set Up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
|
||
- name: 📦 Install Vue Dependencies | ||
run: | | ||
cd ui | ||
npm install | ||
- name: 🔍 Run NPM Audit | ||
run: | | ||
cd ui | ||
npm audit --audit-level=high || true |