cleaner #2
Workflow file for this run
This file contains hidden or 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
| name: CI | |
| on: | |
| push: | |
| # branches: [ main ] | |
| pull_request: | |
| jobs: | |
| build: | |
| name: Build and Test | |
| 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 |