Skip to content

Instantly share code, notes, and snippets.

@phr3nzy
Created November 23, 2022 20:31
Show Gist options
  • Select an option

  • Save phr3nzy/7eaa81d922167f3fa65acad7a7535145 to your computer and use it in GitHub Desktop.

Select an option

Save phr3nzy/7eaa81d922167f3fa65acad7a7535145 to your computer and use it in GitHub Desktop.

Revisions

  1. phr3nzy created this gist Nov 23, 2022.
    54 changes: 54 additions & 0 deletions ci.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    name: 'CI'
    on:
    push:
    branches:
    - main
    - staging
    jobs:
    test:
    runs-on: ubuntu-latest
    strategy:
    matrix:
    node-version: [14.x, 16.x, 18.x]
    fail-fast: true
    env:
    GHCR_PAT: ${{ secrets.GHCR_PAT }}
    steps:
    - uses: actions/checkout@v3
    - uses: docker/setup-buildx-action@v1
    - name: Docker Login
    run: echo $GHCR_PAT | docker login ghcr.io -u phr3nzy --password-stdin
    env:
    GHCR_PAT: ${{ secrets.GHCR_PAT }}
    - name: Start containers
    run: docker-compose -f "docker-compose.yml" up -d --build
    - name: Use Node.js ${{ matrix.node-version }}
    uses: actions/[email protected]
    with:
    node-version: ${{ matrix.node-version }}
    cache: 'yarn'
    - name: Install dependencies
    run: yarn install --frozen-lockfile
    - name: Lint
    run: yarn lint
    - name: Build
    run: yarn build:esbuild
    - name: Wait for Keycloak and Vault
    run: chmod -x ./wait-for-kc.sh && chmod -x ./wait-for-vault.sh && sh ./wait-for-kc.sh && sh ./wait-for-vault.sh
    - name: Run tests
    run: yarn test:ci
    env:
    SERVICE_NAME: api-testing
    NODE_ENV: testing
    APP_ENV: testing
    LOG_LEVEL: debug
    DISABLE_LOGGING: false
    HOST: 0.0.0.0
    PORT: 3000
    DATABASE_URL: postgres://postgres:password123@localhost:5432/api
    CACHE_URL: redis://localhost:6379/
    VAULT_ADDR: http://localhost:8200
    VAULT_TOKEN: super_secret_vault_token
    - name: Stop containers
    if: always()
    run: docker-compose -f "docker-compose.yml" down