2023-10-22 22:02:33 -05:00
|
|
|
# This integration test ci job is used to test the DB alterations compatibility with the current codebase.
|
|
|
|
|
|
|
|
name: Alteration compatibility integration test
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check-alteration-changes:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
has-alteration-changes: ${{ steps.changes-detection.outputs.has-alteration-changes }}
|
|
|
|
|
|
|
|
steps:
|
2023-12-16 01:48:01 -05:00
|
|
|
- uses: actions/checkout@v4
|
2023-10-22 22:02:33 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
# compare the current codebase with HEAD and check if there are any changes under the alterations folder
|
2024-01-08 05:31:46 -05:00
|
|
|
# if the event is a pull request, we need to compare the merge base with HEAD, otherwise we compare the current commit with the previous commit
|
2023-10-22 22:02:33 -05:00
|
|
|
- name: Check for alteration changes
|
|
|
|
id: changes-detection
|
|
|
|
run: |
|
2024-01-08 05:31:46 -05:00
|
|
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
|
|
|
BASE=$(git merge-base origin/${{github.base_ref}} HEAD)
|
|
|
|
else
|
|
|
|
BASE=${{ github.event.before }}
|
|
|
|
fi
|
|
|
|
|
|
|
|
CHANGE_FILES=$(git diff --name-only $BASE | grep 'packages/schemas/alterations/' || true)
|
|
|
|
|
2023-10-22 22:02:33 -05:00
|
|
|
if [ -n "$CHANGE_FILES" ]; then
|
|
|
|
echo "$CHANGE_FILES"
|
|
|
|
echo "::set-output name=has-alteration-changes::true"
|
|
|
|
echo "Alteration changes detected"
|
|
|
|
else
|
|
|
|
echo "::set-output name=has-alteration-changes::false"
|
|
|
|
echo "No alteration changes detected"
|
|
|
|
fi
|
|
|
|
|
|
|
|
package:
|
|
|
|
needs: check-alteration-changes
|
|
|
|
runs-on: buildjet-4vcpu-ubuntu-2204
|
|
|
|
if: ${{needs.check-alteration-changes.outputs.has-alteration-changes == 'true'}}
|
|
|
|
env:
|
|
|
|
INTEGRATION_TEST: true
|
|
|
|
steps:
|
2024-03-20 01:03:48 -05:00
|
|
|
- uses: logto-io/actions-package-logto-artifact@v2
|
2023-10-22 22:02:33 -05:00
|
|
|
with:
|
|
|
|
artifact-name: alteration-integration-test-${{ github.sha }}
|
|
|
|
branch: ${{github.base_ref}}
|
|
|
|
|
|
|
|
run-logto:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
target: [api, experience, console]
|
|
|
|
needs: package
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
INTEGRATION_TEST: true
|
|
|
|
DB_URL: postgres://postgres:postgres@localhost:5432/postgres
|
|
|
|
|
|
|
|
steps:
|
2024-03-20 01:03:48 -05:00
|
|
|
- uses: logto-io/actions-run-logto-integration-tests@v2
|
2023-10-22 22:02:33 -05:00
|
|
|
with:
|
|
|
|
branch: ${{github.base_ref}}
|
|
|
|
logto_artifact: alteration-integration-test-${{ github.sha }}
|
|
|
|
test_target: ${{ matrix.target }}
|
|
|
|
db_alteration_target: ${{github.head_ref}}
|