Skip to content

feat: Use t3's ENV setup w/ Zod #697

feat: Use t3's ENV setup w/ Zod

feat: Use t3's ENV setup w/ Zod #697

Workflow file for this run

name: Run Tests
on:
push:
branches:
- canary
- main
pull_request:
jobs:
create-app:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest']
node-version: [16.x, 18.x]
outputs:
appName: ${{ steps.create-app.outputs.appName }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install packages
run: yarn && yarn lerna bootstrap
- name: Run unit tests
run: yarn test
- name: Create bison app
id: create-app
# Sets outputs.appPath to the created directory and outputs.appName
run: node ./packages/create-bison-app/scripts/createApp bison-ci-app --acceptDefaults
- name: Upload bison app
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: ${{ steps.create-app.outputs.appName }}
path: |
${{ steps.create-app.outputs.appPath }}/
!${{ steps.create-app.outputs.appPath }}/node_modules
retention-days: 1
test:
needs: create-app
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- name: Download bison app
uses: actions/download-artifact@v3
with:
name: ${{ needs.create-app.outputs.appName }}
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install bison app packages
run: yarn install --immutable
- name: Set up test database
env:
DATABASE_URL: postgresql://postgres:postgres@localhost/${{ needs.create-app.outputs.appName }}_test
NODE_ENV: test
run: yarn db:migrate
- name: Build production bison app
run: yarn build
env:
DATABASE_URL: postgresql://postgres:postgres@localhost/${{ needs.create-app.outputs.appName }}_test
NODE_ENV: test
- name: Lint bison app
run: yarn lint
- name: Run bison app unit tests
env:
DATABASE_URL: postgresql://postgres:postgres@localhost/${{ needs.create-app.outputs.appName }}_test
NODE_ENV: test
run: yarn test:ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
env:
DATABASE_URL: postgresql://postgres:postgres@localhost/${{ needs.create-app.outputs.appName }}_test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ENV: test
run: yarn test:e2e
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30