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

112 lines
2.8 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:
2022-07-01 08:33:25 -05:00
group: integration-test-${{ 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
uses: silverhand-io/actions-node-pnpm-run-steps@v1.2.3
- name: Add the mock connectors for integration tests only
run: |
unset CI
unset GITHUB_ACTIONS
lerna add @logto/connector-mock-sms --scope=@logto/core
lerna add @logto/connector-mock-email --scope=@logto/core
lerna add @logto/connector-mock-social --scope=@logto/core
- name: Package
run: ./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:
2022-06-22 05:55:58 -05:00
os: [ubuntu-latest, macos-12]
runs-on: ${{ matrix.os }}
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
uses: silverhand-io/actions-node-pnpm-run-steps@v1.2.3
with:
run-install: false
# Setup integration test
- name: Install dependencies
run: |
mv tests /tmp/tests
cd /tmp/tests
pnpm i
pnpm prepack
# Setup environment
- name: Start Postgres (Linux)
if: runner.os == 'Linux'
run: |
sudo service postgresql start
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
- name: Start Postgres (macOS)
if: runner.os == 'macOS'
run: |
pg_ctl -D /usr/local/var/postgres start
psql postgres -c "CREATE USER postgres WITH SUPERUSER PASSWORD 'postgres';"
- uses: actions/download-artifact@v3
with:
name: integration-test-${{ github.sha }}
- name: Extract
run: tar -xzf logto.tar.gz
- name: Run Logto
run: node . --from-root --all-yes &
working-directory: logto/packages/core
env:
INTEGRATION_TEST: true
NODE_ENV: production
DB_URL_DEFAULT: postgres://postgres:postgres@localhost:5432
ADDITIONAL_CONNECTOR_PACKAGES: '@logto/connector-mock-sms,@logto/connector-mock-email,@logto/connector-mock-social'
- name: Sleep for 5 seconds
run: sleep 5
# Test
- name: Run tests
run: |
cd /tmp/tests/packages/integration-tests
pnpm start
env:
INTEGRATION_TESTS_LOGTO_URL: http://localhost:3001