0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/.github/workflows/integration-test.yml

106 lines
2.5 KiB
YAML
Raw Normal View History

name: Integration Test
on:
push:
2022-07-01 07:33:08 -05:00
branches:
- master
- "push-action/**"
2022-06-27 03:38:39 -05:00
pull_request:
concurrency:
2023-01-18 22:22:17 -05:00
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node and pnpm
2022-10-15 11:49:16 -05:00
uses: silverhand-io/actions-node-pnpm-run-steps@v2
- name: Build
2022-10-17 06:37:59 -05:00
run: pnpm -r build
- name: Package
2022-11-11 07:17:50 -05:00
run: ./.scripts/package.sh
- uses: actions/upload-artifact@v3
with:
name: integration-test-${{ github.sha }}
path: /tmp/logto.tar.gz
retention-days: 3
run-logto:
needs: package
strategy:
matrix:
test_target: [api, ui]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: tests
- name: Copy lockfile
run: |
cp tests/pnpm-lock.yaml ./
cp tests/package.json ./
- name: Setup Node and pnpm
2022-10-15 11:49:16 -05:00
uses: silverhand-io/actions-node-pnpm-run-steps@v2
with:
run-install: false
# Setup integration test
- name: Install dependencies
run: |
2022-10-15 11:49:16 -05:00
cd tests
pnpm i
pnpm prepack
# Install Chromium
cd packages/integration-tests/node_modules/puppeteer
pnpm postinstall
# Setup environment
- name: Setup Postgres
uses: ikalnytskyi/action-setup-postgres@v4
- uses: actions/download-artifact@v3
with:
name: integration-test-${{ github.sha }}
- name: Extract
2022-10-15 11:49:16 -05:00
working-directory: tests
run: |
npm run cli init -- -p ../logto --db postgres://postgres:postgres@localhost:5432/postgres --du ../logto.tar.gz
2022-10-15 11:49:16 -05:00
- name: Check and add mock connectors
2022-10-15 11:49:16 -05:00
working-directory: tests
run: |
npm run cli connector list -- -p ../logto | grep OFFICIAL
npm run cli connector add @logto/connector-mock-sms @logto/connector-mock-email @logto/connector-mock-standard-email @logto/connector-mock-social -- -p ../logto
2022-10-08 04:12:19 -05:00
- name: Run Logto
working-directory: logto/
run: npm start &
env:
INTEGRATION_TEST: true
- name: Sleep for 5 seconds
run: sleep 5
# Test
- name: Run tests
run: |
2022-10-15 11:49:16 -05:00
cd tests/packages/integration-tests
pnpm build
pnpm test:${{ matrix.test_target }}
env:
INTEGRATION_TESTS_LOGTO_URL: http://localhost:3001