wireguard-ui/.github/workflows/ci.yml

99 lines
2.2 KiB
YAML

name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
permissions: {}
jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: npm
cache-dependency-path: package-lock.json
- name: Install frontend dependencies
run: npm ci
- name: Lint frontend
run: npm run lint
- name: Build frontend
run: npm run build
- name: Lint Go
uses: golangci/golangci-lint-action@v9
- name: Build Go
run: CGO_ENABLED=0 go build -o /dev/null .
- name: Run Go tests with coverage
run: |
go test $(go list ./... | grep -v 'wireguard-ui$' | grep -v node_modules) \
-coverprofile=coverage.out -covermode=atomic -timeout 180s
- name: Run frontend tests with coverage
run: npx vitest run --coverage
- name: Upload Go coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
file: coverage.out
format: golang
flag-name: go
parallel: true
- name: Upload frontend coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
file: coverage/lcov.info
format: lcov
flag-name: frontend
parallel: true
docker:
runs-on: ubuntu-latest
needs: build-and-test
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build Docker image (no push)
uses: docker/build-push-action@v7
with:
push: false
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
coveralls-finish:
needs: build-and-test
if: always()
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Finalize Coveralls
uses: coverallsapp/github-action@v2
with:
parallel-finished: true