2022-05-10 02:29:53 -05:00
|
|
|
name: Integration Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-07-01 07:33:08 -05:00
|
|
|
branches:
|
|
|
|
- master
|
2022-07-01 12:30:01 -05:00
|
|
|
- 'push-action/**'
|
2022-06-27 03:38:39 -05:00
|
|
|
pull_request:
|
2022-06-17 10:58:29 -05:00
|
|
|
|
2022-07-26 03:12:34 -05:00
|
|
|
concurrency:
|
2022-07-01 08:33:25 -05:00
|
|
|
group: integration-test-${{ github.head_ref || github.run_id }}
|
2022-06-17 10:58:29 -05:00
|
|
|
cancel-in-progress: true
|
2022-05-10 02:29:53 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
package:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Setup Node and pnpm
|
2022-07-19 09:02:08 -05:00
|
|
|
uses: silverhand-io/actions-node-pnpm-run-steps@v1.2.3
|
2022-05-10 02:29:53 -05:00
|
|
|
|
2022-08-08 22:23:05 -05:00
|
|
|
- name: Add the mock connectors for integration tests only
|
2022-08-02 05:10:01 -05:00
|
|
|
run: |
|
2022-08-08 22:23:05 -05:00
|
|
|
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
|
2022-05-10 02:29:53 -05:00
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: integration-test-${{ github.sha }}
|
|
|
|
path: /tmp/logto.tar.gz
|
|
|
|
retention-days: 3
|
2022-07-26 03:12:34 -05:00
|
|
|
|
2022-05-10 02:29:53 -05:00
|
|
|
run-logto:
|
|
|
|
needs: package
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-06-22 05:55:58 -05:00
|
|
|
os: [ubuntu-latest, macos-12]
|
2022-07-26 03:12:34 -05:00
|
|
|
|
2022-05-10 02:29:53 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
steps:
|
2022-05-17 03:59:57 -05:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
2022-07-19 09:02:08 -05:00
|
|
|
path: tests
|
2022-05-17 03:59:57 -05:00
|
|
|
|
2022-07-19 09:02:08 -05:00
|
|
|
- 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
|
2022-05-10 02:29:53 -05:00
|
|
|
with:
|
2022-07-19 09:02:08 -05:00
|
|
|
run-install: false
|
2022-05-10 02:29:53 -05:00
|
|
|
|
2022-07-19 09:02:08 -05:00
|
|
|
# Setup integration test
|
2022-05-17 03:59:57 -05:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2022-07-19 09:02:08 -05:00
|
|
|
mv tests /tmp/tests
|
|
|
|
cd /tmp/tests
|
|
|
|
pnpm i
|
2022-07-20 01:21:13 -05:00
|
|
|
pnpm prepack
|
2022-05-17 03:59:57 -05:00
|
|
|
|
|
|
|
# Setup environment
|
2022-05-10 02:29:53 -05:00
|
|
|
- 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
|
2022-05-17 03:59:57 -05:00
|
|
|
|
2022-05-10 02:29:53 -05:00
|
|
|
- name: Run Logto
|
|
|
|
run: node . --from-root --all-yes &
|
|
|
|
working-directory: logto/packages/core
|
|
|
|
env:
|
2022-07-20 01:21:13 -05:00
|
|
|
INTEGRATION_TEST: true
|
2022-05-10 02:29:53 -05:00
|
|
|
NODE_ENV: production
|
|
|
|
DB_URL_DEFAULT: postgres://postgres:postgres@localhost:5432
|
2022-08-01 02:09:51 -05:00
|
|
|
ADDITIONAL_CONNECTOR_PACKAGES: '@logto/connector-mock-sms,@logto/connector-mock-email,@logto/connector-mock-social'
|
2022-05-10 02:29:53 -05:00
|
|
|
|
|
|
|
- name: Sleep for 5 seconds
|
|
|
|
run: sleep 5
|
|
|
|
|
2022-05-17 03:59:57 -05:00
|
|
|
# Test
|
|
|
|
- name: Run tests
|
|
|
|
run: |
|
2022-07-19 09:02:08 -05:00
|
|
|
cd /tmp/tests/packages/integration-tests
|
|
|
|
pnpm start
|
2022-05-17 03:59:57 -05:00
|
|
|
env:
|
2022-08-12 05:07:16 -05:00
|
|
|
INTEGRATION_TESTS_LOGTO_URL: http://localhost:3001
|