Skip to content

Merge pull request #386 from TypeCellOS/staging #3

Merge pull request #386 from TypeCellOS/staging

Merge pull request #386 from TypeCellOS/staging #3

Workflow file for this run

name: build
on: ["push", "pull_request"]
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: supabase/setup-cli@v1
with:
version: latest
- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
# from https://github.com/supabase/supabase-action-example/
- run: supabase start -x studio,imgproxy,storage,edge-runtime,vector,realtime,storage-api
working-directory: packages/server
env:
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}
- run: supabase db lint
working-directory: packages/server
env:
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}
- run: supabase test db
working-directory: packages/server
env:
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}
- name: Verify generated supabase types are checked in
working-directory: packages/server
run: |
supabase gen types typescript --local --schema public > ../shared/src/schema.ts
if ! git diff --ignore-space-at-eol --exit-code --quiet ../shared/src/schema.ts; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
env:
TYPECELL_GITHUB_OAUTH_SECRET: ${{ secrets.TYPECELL_GITHUB_OAUTH_SECRET }}
TYPECELL_GOOGLE_OAUTH_SECRET: ${{ secrets.TYPECELL_GOOGLE_OAUTH_SECRET }}
# doesn't seem to cause significant speed up, probably because it still needs to install deps
- name: cache playwright
id: playwright-cache
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: pw3-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
# doesn't seem to cause significant speed up, maybe not right conf?
# - name: cache lerna
# uses: actions/cache@v2
# with:
# path: |
# node_modules
# packages/**/node_modules
# key: lerna-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
# - name: Set correct access for docker containers (server/test/data)
# run: chmod -R a+rw test-util/server/data
# - name: Build the docker-compose stack
# run: docker-compose -f test-util/server/docker-compose.yml up -d
# - name: Check running containers
# run: docker ps -a
# - name: Check docker logs
# run: docker logs synapse
- name: NPM CI
run: npm ci
# - name: Bootstrap packages
# run: npm run bootstrap
# - name: Wait for Matrix
# run: npx wait-on http://localhost:8888/_matrix/static/
- name: Build packages
run: npm run build
env:
CI: true
- name: Build packages (vite react)
run: npm run build:react
env:
CI: true
MODE: development
- name: Lint
run: npm run lint
env:
CI: true
- name: Start HocusPocus server
run: RUNNER_TRACKING_ID="" && npm run start:server &
env:
CI: true
- name: Run Tests
run: npm run test
env:
CI: true
- name: Install Playwright
run: npx playwright install --with-deps
# if: steps.playwright-cache.outputs.cache-hit != 'true'
# env:
# PLAYWRIGHT_BROWSERS_PATH: 0 # https://github.com/microsoft/playwright/blob/main/docs/src/ci.md#caching-browsers
# Actually build and run react code and run playwright tests against that
- name: Build and run preview
# Wait on config file needed for vite dev server: https://github.com/jeffbski/wait-on/issues/78
run: npm run start:preview & npx wait-on http://localhost:4173 -c ./packages/editor/wait-on.conf.json
env:
CI: true
MODE: development
- name: Run Playwright tests (against preview)
run: npm run playwright:preview
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report-editor
path: packages/editor/playwright-report/
retention-days: 30
# Upload webpack-stats.json to use on relative-ci.yaml workflow
- name: Upload webpack stats artifact
uses: relative-ci/agent-upload-artifact-action@v1
with:
webpackStatsFile: ./packages/editor/dist/webpack-stats.json
# - name: Upload to coveralls
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}