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

ci: fix workflow

This commit is contained in:
Gao Sun 2023-03-06 00:48:50 +08:00
parent ac065ac60c
commit 94209ada00
No known key found for this signature in database
GPG key ID: 13EBE123E4773688
3 changed files with 41 additions and 16 deletions

View file

@ -13,6 +13,11 @@ concurrency:
jobs: jobs:
package: package:
# See https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
strategy:
matrix:
env: [oss, cloud]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -25,22 +30,32 @@ jobs:
run: pnpm -r build run: pnpm -r build
- name: Package - name: Package
if: matrix.env != 'cloud'
run: ./.scripts/package.sh run: ./.scripts/package.sh
- name: Package
if: matrix.env == 'cloud'
run: ./.scripts/package.sh
env:
IS_CLOUD: 1
CONSOLE_PUBLIC_URL: /
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: integration-test-${{ github.sha }} name: integration-test-${{ github.sha }}-${{ matrix.env }}
path: /tmp/logto.tar.gz path: /tmp/logto.tar.gz
retention-days: 3 retention-days: 3
run-logto: run-logto:
needs: package
strategy: strategy:
matrix: matrix:
test_target: [api, ui, ui-cloud] target: [api, ui, ui-cloud]
needs: package
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
INTEGRATION_TEST: true
IS_CLOUD: ${{ contains(matrix.target, 'cloud') && '1' || '0' }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -73,7 +88,7 @@ jobs:
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: with:
name: integration-test-${{ github.sha }} name: integration-test-${{ github.sha }}-${{ contains(matrix.target, 'cloud') && 'cloud' || 'oss' }}
- name: Extract - name: Extract
working-directory: tests working-directory: tests
@ -82,7 +97,7 @@ jobs:
-p ../logto \ -p ../logto \
--db postgres://postgres:postgres@localhost:5432/postgres \ --db postgres://postgres:postgres@localhost:5432/postgres \
--du ../logto.tar.gz \ --du ../logto.tar.gz \
${{ contains(matrix.test_target, 'cloud') && '--cloud' || '' }} ${{ contains(matrix.target, 'cloud') && '--cloud' || '' }}
- name: Check and add mock connectors - name: Check and add mock connectors
working-directory: tests working-directory: tests
@ -93,15 +108,11 @@ jobs:
- name: Run Logto - name: Run Logto
working-directory: logto/ working-directory: logto/
run: nohup npm start > nohup.out 2> nohup.err < /dev/null & run: nohup npm start > nohup.out 2> nohup.err < /dev/null &
env:
INTEGRATION_TEST: true
- name: Run Logto Cloud - name: Run Logto Cloud
working-directory: logto/ working-directory: logto/
if: contains(matrix.test_target, 'cloud') if: contains(matrix.target, 'cloud')
run: nohup npm start:cloud > nohup-cloud.out 2> nohup-cloud.err < /dev/null & run: nohup npm run start:cloud > nohup-cloud.out 2> nohup-cloud.err < /dev/null &
env:
INTEGRATION_TEST: true
- name: Sleep for 5 seconds - name: Sleep for 5 seconds
run: sleep 5 run: sleep 5
@ -112,7 +123,7 @@ jobs:
run: | run: |
cd tests/packages/integration-tests cd tests/packages/integration-tests
pnpm build pnpm build
pnpm test:${{ matrix.test_target }} pnpm run test:${{ matrix.target }}
- name: Show logs - name: Show logs
working-directory: logto/ working-directory: logto/
@ -121,3 +132,13 @@ jobs:
- name: Show error logs - name: Show error logs
working-directory: logto/ working-directory: logto/
run: cat nohup.err run: cat nohup.err
- name: Show cloud logs
working-directory: logto/
if: contains(matrix.target, 'cloud')
run: cat nohup-cloud.out
- name: Show cloud error logs
working-directory: logto/
if: contains(matrix.target, 'cloud')
run: cat nohup-cloud.err

View file

@ -10,8 +10,12 @@ echo Install production dependencies
NODE_ENV=production pnpm i NODE_ENV=production pnpm i
echo Prune files echo Prune files
if [[ "${IS_CLOUD}" != @(1|true|y|yes|yep|yeah) ]]; then
# Remove cloud in OSS distributions # Remove cloud in OSS distributions
rm -rf packages/cloud rm -rf packages/cloud
fi
# Some node packages use `src` as their dist folder, so ignore them from the rm list in the end # Some node packages use `src` as their dist folder, so ignore them from the rm list in the end
find \ find \
.git .changeset .changeset-staged .devcontainer .github .husky .parcel-cache .scripts .vscode pnpm-*.yaml *.js \ .git .changeset .changeset-staged .devcontainer .github .husky .parcel-cache .scripts .vscode pnpm-*.yaml *.js \

View file

@ -16,6 +16,6 @@ describe('smoke testing for cloud', () => {
await navigation; await navigation;
await expect(page.waitForSelector('#app')).resolves.not.toBeNull(); await expect(page.waitForSelector('#app')).resolves.not.toBeNull();
expect(page.url()).toBe(new URL('sign-in', adminTenantUrl).href); expect(page.url()).toBe(adminTenantUrl);
}); });
}); });