mirror of
https://github.com/ivuorinen/ghaw-auditor.git
synced 2026-01-26 03:14:09 +00:00
90 lines
1.9 KiB
YAML
90 lines
1.9 KiB
YAML
---
|
|
name: Complex Workflow
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
pull_requests: write
|
|
|
|
env:
|
|
NODE_ENV: production
|
|
API_URL: https://api.example.com
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: ./src
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
permissions:
|
|
contents: read
|
|
environment:
|
|
name: production
|
|
url: https://example.com
|
|
env:
|
|
BUILD_ENV: production
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Build
|
|
run: npm run build
|
|
env:
|
|
API_KEY: ${{ secrets.API_KEY }}
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: github.event_name == 'pull_request'
|
|
container:
|
|
image: node:20-alpine
|
|
credentials:
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PASS }}
|
|
env:
|
|
NODE_ENV: test
|
|
ports:
|
|
- 8080
|
|
volumes:
|
|
- /tmp:/tmp
|
|
options: --cpus 2
|
|
services:
|
|
postgres:
|
|
image: postgres:15
|
|
credentials:
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PASS }}
|
|
env:
|
|
POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
|
ports:
|
|
- 5432
|
|
options: --health-cmd pg_isready
|
|
strategy:
|
|
matrix:
|
|
node-version: [18, 20]
|
|
os: [ubuntu-latest, windows-latest]
|
|
fail-fast: false
|
|
max-parallel: 2
|
|
continue-on-error: true
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- name: Test
|
|
run: npm test
|
|
env:
|
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|