2022-05-10 02:29:53 -05:00
|
|
|
name: Integration Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [master]
|
2022-05-17 03:59:57 -05:00
|
|
|
pull_request:
|
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-05-19 21:49:53 -05:00
|
|
|
uses: logto-io/actions-node-pnpm-run-steps@v1.2.2
|
2022-05-10 02:29:53 -05:00
|
|
|
|
|
|
|
- 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:
|
|
|
|
os: [ubuntu-latest, ubuntu-18.04, macos-11, macos-12]
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
steps:
|
2022-05-17 03:59:57 -05:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
path: tmp/
|
|
|
|
|
2022-05-10 02:29:53 -05:00
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
|
2022-05-17 03:59:57 -05:00
|
|
|
# Setup integration test package
|
|
|
|
- name: Extract integration test package
|
|
|
|
run: |
|
|
|
|
mv tmp/packages/integration-tests /tmp
|
|
|
|
rm -rf tmp
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
cd /tmp/integration-tests
|
|
|
|
npm i
|
|
|
|
|
|
|
|
# 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: Rebuild Argon2
|
|
|
|
run: npx node-pre-gyp rebuild -C .
|
|
|
|
working-directory: logto/packages/core/node_modules/argon2
|
|
|
|
|
|
|
|
- name: Run Logto
|
|
|
|
run: node . --from-root --all-yes &
|
|
|
|
working-directory: logto/packages/core
|
|
|
|
env:
|
|
|
|
NODE_ENV: production
|
|
|
|
DB_URL_DEFAULT: postgres://postgres:postgres@localhost:5432
|
|
|
|
|
|
|
|
- name: Sleep for 5 seconds
|
|
|
|
run: sleep 5
|
|
|
|
|
2022-05-17 03:59:57 -05:00
|
|
|
# Test
|
|
|
|
- name: Run tests
|
|
|
|
run: |
|
|
|
|
cd /tmp/integration-tests
|
|
|
|
npm start
|
|
|
|
env:
|
|
|
|
LOGTO_URL: http://localhost:3001
|