Skip to content

Commit

Permalink
Add GitHub Actions workflow for building, testing, and scanning Go an…
Browse files Browse the repository at this point in the history
…d Vue projects
  • Loading branch information
kek-Sec committed Dec 29, 2024
1 parent 1df8eed commit 54ad342
Showing 1 changed file with 121 additions and 0 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/build-test.yml
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

0 comments on commit 54ad342

Please # to comment.