Skip to content

Commit

Permalink
ci: Reorganize workflows (#29)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Alystrasz authored Jan 29, 2024
1 parent 35aff0f commit 658bb38
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 44 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/manifest-check.yml
Original file line number Diff line number Diff line change
@@ -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'
16 changes: 16 additions & 0 deletions .github/workflows/mods-verification.yml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 0 additions & 19 deletions .github/workflows/no-tabs.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/validate.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/verified-mods.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 658bb38

Please sign in to comment.