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

129 lines
3.1 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: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v3
2023-03-06 00:45:14 -05:00
- name: Build and package
run: |
pnpm -r build
./.scripts/package.sh
- uses: actions/upload-artifact@v3
with:
name: integration-test-${{ github.sha }}
path: /tmp/logto.tar.gz
retention-days: 3
run-logto:
strategy:
2023-03-27 23:00:28 -05:00
fail-fast: false
matrix:
target: [api, experience, console]
2023-03-05 11:48:50 -05:00
needs: package
runs-on: ubuntu-latest
2023-03-05 11:48:50 -05:00
env:
INTEGRATION_TEST: true
DB_URL: postgres://postgres:postgres@localhost:5432/postgres
steps:
- uses: actions/checkout@v4
with:
path: tests
- name: Copy lockfile
run: |
cp tests/pnpm-lock.yaml ./
cp tests/package.json ./
- name: Setup Node and pnpm
uses: silverhand-io/actions-node-pnpm-run-steps@v3
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
2023-04-07 04:41:22 -05:00
- name: Setup Redis
uses: supercharge/redis-github-action@6dc7a5eeaf9a8f860b6464e05195a15f8b9f3bbb # 1.7.0
2023-04-07 04:41:22 -05:00
with:
redis-version: 6
- 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: |
2023-03-05 09:07:02 -05:00
npm run cli init -- \
-p ../logto \
--du ../logto.tar.gz
- 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 link -- --mock -p ../logto
2022-10-08 04:12:19 -05:00
- name: Setup mock Cloudflare Hostname Provider config
working-directory: tests
run: npm run cli db system set cloudflareHostnameProvider '{"zoneId":"mock-zone-id","apiToken":""}'
env:
DB_URL: postgres://postgres:postgres@localhost:5432/postgres
- name: Run Logto
working-directory: logto/
2023-02-09 05:31:14 -05:00
run: nohup npm start > nohup.out 2> nohup.err < /dev/null &
2023-04-07 04:41:22 -05:00
env:
REDIS_URL: 1
- 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
2023-03-05 11:48:50 -05:00
pnpm run test:${{ matrix.target }}
2023-02-09 05:31:14 -05:00
- name: Show logs
if: always()
2023-02-09 05:31:14 -05:00
working-directory: logto/
run: cat nohup.out
- name: Show error logs
if: always()
2023-02-09 05:31:14 -05:00
working-directory: logto/
run: cat nohup.err