ci: validate json schema with cue (#50)

This commit is contained in:
Eligio Mariño
2023-08-20 12:53:21 +02:00
committed by GitHub
parent fbc5d8645c
commit 9fb5874f92
6 changed files with 86 additions and 3 deletions
+28
View File
@@ -0,0 +1,28 @@
on:
pull_request:
paths:
- .github/workflows/pr_config.yml
- config/**
workflow_dispatch:
jobs:
doc:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Setup NodeJS
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
cache: 'npm'
cache-dependency-path: docs/src/package-lock.json
node-version-file: docs/src/package.json
- name: Setup Cue for JSON validation
uses: cue-lang/setup-cue@v1.0.0
- name: Validate version.json and flutter_version.json
run: |
cue vet config/version.cue config/version.json
cue vet config/flutter_version.cue config/flutter_version.json
+8 -2
View File
@@ -1,7 +1,7 @@
on:
pull_request:
paths:
- .github/workflows/pr_integration.yml
- .github/workflows/pr_flutter_app.yml
- script/updateAndroidVersions.gradle
- version.json
workflow_dispatch:
@@ -17,7 +17,7 @@ jobs:
run: |
echo "FLUTTER_VERSION=$(jq -r '.flutter.version' config/version.json)" >> $GITHUB_ENV
echo "FLUTTER_CHANNEL=$(jq -r '.flutter.channel' config/version.json)" >> $GITHUB_ENV
- name: Setup Flutter
uses: flutter-actions/setup-flutter@f59ff7bdbb3127f71345907452e04be356c370f5 # v2
with:
@@ -34,3 +34,9 @@ jobs:
run: |
cat ../../script/updateAndroidVersions.gradle >> app/build.gradle
./gradlew --warning-mode all updateAndroidVersions
- name: Setup Cue for JSON validation
uses: cue-lang/setup-cue@v1.0.0
- name: Validate version.json
run: cue vet config/version.cue config/version.json
@@ -55,6 +55,12 @@ jobs:
run: |
rm -rf test_app
- name: Setup Cue for JSON validation
uses: cue-lang/setup-cue@v1.0.0
- name: Validate version.json
run: cue vet config/version.cue config/version.json
- name: Setup NodeJS
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
with:
@@ -74,7 +80,7 @@ jobs:
- name: Create commit message variable
run: |
echo "COMMIT_MESSAGE='chore: update dependencies versions in manifest with flutter ${{ env.FLUTTER_VERSION }}'" >> $GITHUB_ENV
- name: Create pull request if there are changes
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5
with:
@@ -20,6 +20,12 @@ jobs:
const script = require('./script/updateFlutterVersion.js')
await script({core, fetch})
- name: Setup Cue for JSON validation
uses: cue-lang/setup-cue@v1.0.0
- name: Validate version.json
run: cue vet config/flutter_version.cue config/flutter_version.json
- name: Setup Gitsign to sign git commits
uses: chainguard-dev/actions/setup-gitsign@18e5df81d0b217b89d34c477955f18f5745ebbdd # main
+12
View File
@@ -0,0 +1,12 @@
import "strings"
import "list"
#Version3: {
version!: =~ "^\\d+.\\d+.\\d+$"
}
flutter: {
channel!: "stable" | "beta"
commit!: strings.MaxRunes(40)
#Version3
}
+25
View File
@@ -0,0 +1,25 @@
import "strings"
import "list"
#Version2: {
version!: =~ "^\\d+.\\d+$"
}
#Version3: {
version!: =~ "^\\d+.\\d+.\\d+$"
}
flutter: {
channel!: "stable" | "beta"
commit!: strings.MaxRunes(40)
#Version3
}
android: {
platforms!: [ { version!: int } ] & list.MinItems(1)
gradle!: #Version2
buildTools!: #Version3
cmdlineTools!: #Version2
}
fastlane!: #Version3