From c7db22163e19c8b437d57ffe31144ec2ccbc51e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joris=20Pelgr=C3=B6m?= Date: Fri, 28 Oct 2022 19:18:29 +0200 Subject: [PATCH] Add database checks to PR workflow (#3000) * Add database checks to PR workflow * Update step names --- .github/workflows/pr.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5db5e7677..7e579727b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -66,6 +66,15 @@ jobs: with: fetch-depth: 0 + - name: Check for modified DB schemas on branch + run: | + if git diff --name-only --diff-filter=DMR origin/master... | grep "^common/schemas"; then + echo -e "\n❌ Existing database schema modified, please increase the database version instead" + exit 1 + else + echo -e "\n✔️ No changed database schemas on branch" + fi + - name: Set up JDK 11 uses: actions/setup-java@v3.6.0 with: @@ -91,6 +100,16 @@ jobs: - name: Build Debug APK run: ./gradlew assembleDebug + + - name: Check for missing/modified DB schemas after build + run: | + if [[ $(git status common/schemas --porcelain) ]]; then + echo $(git status common/schemas --porcelain) + echo -e "\n❌ Found uncommitted changes in database schema directory, please make sure to include all changes in your commit(s)" + exit 1; + else + echo -e "\n✔️ No changes in database schema directory after build" + fi - name: Archive Debug Build uses: kittaakos/upload-artifact-as-is@v0