Skip to content

Merge pull request #11 from duy-nguyen-van/feature/sdk #33

Merge pull request #11 from duy-nguyen-van/feature/sdk

Merge pull request #11 from duy-nguyen-van/feature/sdk #33

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
backend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('backend/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Tidy
run: go mod tidy
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.11.0
working-directory: backend
- name: Build
run: go build ./...
- name: Test
run: go test -v -race -coverprofile=coverage.out ./...
- name: Publish coverage summary
if: always() && hashFiles('backend/coverage.out') != ''
working-directory: backend
run: bash ../.github/scripts/coverage-summary.sh coverage.out
- name: Upload coverage reports to Codecov
if: always() && hashFiles('backend/coverage.out') != ''
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: backend/coverage.out
fail_ci_if_error: false
frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 26
cache: npm
cache-dependency-path: |
frontend/package-lock.json
sdk/typescript/package-lock.json
- name: Build local TypeScript SDK
working-directory: sdk/typescript
run: |
npm ci
npm run build
- name: Install and lint
run: |
npm ci
npm run lint
- name: Build
run: npm run build
security:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Trivy vulnerability scanner (filesystem)
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: fs
scan-ref: .
format: table
exit-code: "1"
ignore-unfixed: true
vuln-type: os,library
severity: CRITICAL,HIGH
scanners: vuln,secret,misconfig
- name: Build Docker image
run: DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile -t gateforge-iam:${{ github.sha }} .
- name: Run Trivy vulnerability scanner (container image)
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: image
image-ref: gateforge-iam:${{ github.sha }}
format: table
exit-code: "1"
ignore-unfixed: true
vuln-type: os,library
severity: CRITICAL,HIGH
skip-setup-trivy: true
build-prod:
runs-on: ubuntu-latest
needs: [backend, frontend, security]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 26
cache: npm
cache-dependency-path: |
frontend/package-lock.json
sdk/typescript/package-lock.json
- name: Build local TypeScript SDK
working-directory: sdk/typescript
run: |
npm ci
npm run build
- name: Build production binary
run: make build-prod
- name: Verify binary
run: test -f bin/gateforge-iam-server