mirror of
https://github.com/rishikanthc/Scriberr.git
synced 2026-06-27 22:36:07 +00:00
83 lines
2.0 KiB
YAML
83 lines
2.0 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
|
|
|
|
jobs:
|
|
build:
|
|
name: basics
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: web/frontend/package-lock.json
|
|
|
|
# frontend build and test steps
|
|
- name: Install Frontend Dependencies
|
|
working-directory: web/frontend
|
|
run: npm ci
|
|
|
|
- name: Build Frontend
|
|
working-directory: web/frontend
|
|
run: npm run build
|
|
|
|
- name: Run Frontend Lint
|
|
working-directory: web/frontend
|
|
run: npm run lint
|
|
|
|
# Backend
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24.1'
|
|
cache: true
|
|
|
|
- name: Copy Frontend Assets
|
|
run: |
|
|
mkdir -p internal/web
|
|
cp -r web/frontend/dist internal/web/
|
|
|
|
- name: Build Go Project
|
|
run: go build -v ./...
|
|
|
|
- name: Run Go Tests
|
|
run: go test -v ./...
|
|
|
|
# Project site
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'npm'
|
|
cache-dependency-path: web/project-site/package-lock.json
|
|
|
|
- name: Install swag
|
|
run: go install github.com/swaggo/swag/cmd/swag@latest
|
|
|
|
- name: Generate API documentation
|
|
run: swag init -g server/main.go -o web/project-site/public/api --outputTypes json --dir cmd,internal
|
|
|
|
- name: Install dependencies
|
|
working-directory: web/project-site
|
|
run: npm ci
|
|
|
|
- name: Build project site
|
|
working-directory: web/project-site
|
|
run: npm run build
|
|
|
|
- name: Run project site lint
|
|
working-directory: web/project-site
|
|
run: npm run lint
|
|
|
|
# Fail if any changes were written to any source files or generated untracked files
|
|
- run: git add -A && git diff --cached --exit-code
|