From 658bb382cce896d9bbf344fac6e1f2af87f44ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Raes?= Date: Mon, 29 Jan 2024 15:50:14 +0100 Subject: [PATCH] ci: Reorganize workflows (#29) Separates CI workflows in two different flows: - one dedicated to manifest verification - the other to mods verification. The idea is to avoid running mods verification if manifesto checking fails. --- .github/workflows/manifest-check.yml | 31 +++++++++++++++++++++++++ .github/workflows/mods-verification.yml | 16 +++++++++++++ .github/workflows/no-tabs.yml | 19 --------------- .github/workflows/validate.yml | 25 -------------------- .github/workflows/verified-mods.yml | 11 +++++++++ 5 files changed, 58 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/manifest-check.yml create mode 100644 .github/workflows/mods-verification.yml delete mode 100644 .github/workflows/no-tabs.yml delete mode 100644 .github/workflows/validate.yml create mode 100644 .github/workflows/verified-mods.yml diff --git a/.github/workflows/manifest-check.yml b/.github/workflows/manifest-check.yml new file mode 100644 index 0000000..b84d4b4 --- /dev/null +++ b/.github/workflows/manifest-check.yml @@ -0,0 +1,31 @@ +name: Manifest check +on: [workflow_call] # allow this workflow to be called from other workflows + +jobs: + check-for-tabs-in-json: + name: Check for tabulations + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check JSON files for tabs + run: | + set -e + + for file in $(find . -type f -name '*.json'); do + if grep --perl-regexp --quiet '\t' "$file"; then + echo "Error: JSON file $file contains tabs." + exit 1 + fi + done + + verify-json-validation: + name: Run JSON schema validation + needs: check-for-tabs-in-json + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Validate package.json against local schema + uses: cardinalby/schema-validator-action@v3 + with: + file: 'verified-mods.json' + schema: '.github/schema.json' diff --git a/.github/workflows/mods-verification.yml b/.github/workflows/mods-verification.yml new file mode 100644 index 0000000..6d44288 --- /dev/null +++ b/.github/workflows/mods-verification.yml @@ -0,0 +1,16 @@ +name: Mods verification +on: [workflow_call] # allow this workflow to be called from other workflows + +jobs: + verify-mods-versions: + name: Try and fetch mod versions + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + - name: Run mod checks + run: | + python .github/verify_versions.py diff --git a/.github/workflows/no-tabs.yml b/.github/workflows/no-tabs.yml deleted file mode 100644 index b7732d7..0000000 --- a/.github/workflows/no-tabs.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Check for tabs in JSON files - -on: [push, pull_request] - -jobs: - check-for-tabs-in-json: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Check JSON files for tabs - run: | - set -e - - for file in $(find . -type f -name '*.json'); do - if grep --perl-regexp --quiet '\t' "$file"; then - echo "Error: JSON file $file contains tabs." - exit 1 - fi - done diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml deleted file mode 100644 index db0631c..0000000 --- a/.github/workflows/validate.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Validate JSONs - -on: [push, pull_request] - -jobs: - verify-json-validation: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Validate package.json against local schema - uses: cardinalby/schema-validator-action@v3 - with: - file: 'verified-mods.json' - schema: '.github/schema.json' - verify-mods-versions: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup python - uses: actions/setup-python@v5 - with: - python-version: 3.11 - - name: Run mod checks - run: | - python .github/verify_versions.py diff --git a/.github/workflows/verified-mods.yml b/.github/workflows/verified-mods.yml new file mode 100644 index 0000000..4f2599f --- /dev/null +++ b/.github/workflows/verified-mods.yml @@ -0,0 +1,11 @@ +name: VerifiedMods +on: [push, pull_request] + +jobs: + manifest-checking: + name: Manifest check + uses: ./.github/workflows/manifest-check.yml + mods-verification: + name: Mod verification + needs: [manifest-checking] + uses: ./.github/workflows/mods-verification.yml