Skip to content

Commit 7286f68

Browse files
authored
Extract Unicode dump into separate workflow. Add manual CodeQL workflow (#173)
This reduces the number of downloads and the load on the service is used for that
1 parent 1a05e0d commit 7286f68

File tree

9 files changed

+134
-22
lines changed

9 files changed

+134
-22
lines changed

.github/workflows/benchmark.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ concurrency:
4545
group: bench-${{ github.event_name }}-${{ github.event.pull_request.number || github.event.after }}
4646

4747
jobs:
48+
dump-unicode-data:
49+
uses: ./.github/workflows/unicode-dump.yml
4850
benchmark-matrix:
51+
needs:
52+
- dump-unicode-data
4953
strategy:
5054
matrix:
5155
include:
@@ -86,6 +90,7 @@ jobs:
8690
- name: Cache unicode data
8791
uses: actions/cache@v4
8892
with:
93+
fail-on-cache-miss: true
8994
path: unicode_dump
9095
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
9196
restore-keys: |

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
- name: Cache unicode data
4040
uses: actions/cache@v4
4141
with:
42+
fail-on-cache-miss: true
4243
path: unicode_dump
4344
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
4445
restore-keys: |

.github/workflows/check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
- name: Cache unicode data
5757
uses: actions/cache@v4
5858
with:
59+
fail-on-cache-miss: true
5960
path: unicode_dump
6061
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
6162
restore-keys: |
@@ -65,7 +66,7 @@ jobs:
6566
with:
6667
gradle-version: wrapper
6768
- name: Build
68-
run: ./gradlew --no-daemon --info ${{ inputs.task }} koverXmlReport -x :benchmark:benchmark
69+
run: ./gradlew --no-daemon --info ${{ inputs.task }} koverXmlReport -x :benchmark:benchmark --build-cache
6970
- name: Upload coverage reports to Codecov
7071
if: inputs.upload-code-coverage && github.actor != 'dependabot[bot]'
7172
uses: codecov/codecov-action@v4

.github/workflows/code-coverage-upload.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
upload:
1010
runs-on: ubuntu-latest
11-
if: github.event.workflow_run.actor.name != 'dependabot[bot]' && github.repository == 'OptimumCode/json-schema-validator'
11+
if: github.event.workflow_run.actor.name != 'dependabot[bot]' && github.repository == 'OptimumCode/json-schema-validator' && github.event.workflow_run.conclusion == 'success'
1212
steps:
1313
- name: 'Checkout Repository'
1414
uses: actions/checkout@v4
@@ -21,12 +21,6 @@ jobs:
2121
name: coverage-reports
2222
path: reports/
2323
run_id: ${{ github.event.workflow_run.id }}
24-
- name: Download PR number
25-
uses: dawidd6/action-download-artifact@v6
26-
with:
27-
name: pr-number
28-
path: '.'
29-
run_id: ${{ github.event.workflow_run.id }}
3024
- name: Upload coverage reports to Codecov
3125
uses: codecov/codecov-action@v4
3226
with:

.github/workflows/codeql.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '19 19 * * 6'
10+
11+
jobs:
12+
dump-unicode-data:
13+
uses: ./.github/workflows/unicode-dump.yml
14+
analyze:
15+
needs:
16+
- dump-unicode-data
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 30
19+
permissions:
20+
# required for all workflows
21+
security-events: write
22+
23+
# required to fetch internal or private CodeQL packs
24+
packages: read
25+
26+
# only required for workflows in private repositories
27+
actions: read
28+
contents: read
29+
env:
30+
LANGUAGE: java-kotlin
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
# Initializes the CodeQL tools for scanning.
36+
- name: Initialize CodeQL
37+
uses: github/codeql-action/init@v3
38+
with:
39+
languages: ${{ env.LANGUAGE }}
40+
build-mode: manual
41+
# Build
42+
- uses: actions/setup-java@v4
43+
with:
44+
distribution: temurin
45+
java-version-file: .java-version
46+
- name: Validate Gradle Wrapper
47+
uses: gradle/actions/wrapper-validation@v3
48+
- name: Cache konan
49+
uses: actions/cache@v4
50+
with:
51+
path: ~/.konan
52+
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
53+
restore-keys: |
54+
${{ runner.os }}-gradle-
55+
- name: Cache unicode data
56+
uses: actions/cache@v4
57+
with:
58+
fail-on-cache-miss: true
59+
path: unicode_dump
60+
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
61+
restore-keys: |
62+
unicode-dump-
63+
- name: Setup Gradle
64+
uses: gradle/actions/setup-gradle@v3
65+
with:
66+
gradle-version: wrapper
67+
- name: Build
68+
run: ./gradlew --no-daemon -S -Dorg.gradle.dependency.verification=off -Dorg.gradle.warning.mode=none testClasses
69+
70+
# Perform analysis
71+
- name: Perform CodeQL Analysis
72+
uses: github/codeql-action/analyze@v3
73+
with:
74+
category: "/language:${{ env.LANGUAGE }}"

.github/workflows/pull_request.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14+
dump-unicode-data:
15+
uses: ./.github/workflows/unicode-dump.yml
1416
reviewdog:
17+
needs:
18+
- dump-unicode-data
1519
permissions:
1620
pull-requests: write
1721
runs-on: ubuntu-latest
@@ -34,6 +38,7 @@ jobs:
3438
- name: Cache unicode data
3539
uses: actions/cache@v4
3640
with:
41+
fail-on-cache-miss: true
3742
path: unicode_dump
3843
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
3944
restore-keys: |
@@ -51,6 +56,8 @@ jobs:
5156
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5257
run: reviewdog -tee -reporter=github-pr-review
5358
check-pr:
59+
needs:
60+
- dump-unicode-data
5461
uses: ./.github/workflows/build-and-test.yml
5562
with:
5663
collect-code-coverage: true
@@ -69,17 +76,3 @@ jobs:
6976
dangerfile: Dangerfile.df.kts
7077
env:
7178
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
store-pr-number:
73-
runs-on: ubuntu-latest
74-
steps:
75-
- name: Save PR number
76-
env:
77-
PR_NUMBER: ${{ github.event.number }}
78-
run: |
79-
mkdir -p ./pr
80-
echo $PR_NUMBER > ./pr/pr_number
81-
- uses: actions/upload-artifact@v4
82-
with:
83-
name: pr-number
84-
path: pr/
85-

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ jobs:
2424
version-source: file
2525
version-file: ${{ env.VERSION_FILE }}
2626
version-file-extraction-pattern: ${{ env.VERSION_PATTERN }}
27+
dump-unicode-data:
28+
uses: ./.github/workflows/unicode-dump.yml
2729
build-and-test:
30+
needs:
31+
- dump-unicode-data
2832
uses: ./.github/workflows/build-and-test.yml
2933
publish_artifacts:
3034
needs:
@@ -55,6 +59,7 @@ jobs:
5559
- name: Cache unicode data
5660
uses: actions/cache@v4
5761
with:
62+
fail-on-cache-miss: true
5863
path: unicode_dump
5964
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
6065
restore-keys: |

.github/workflows/snapshot_release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ on:
1313
- '.github/workflows/snapshot_release.yml'
1414

1515
jobs:
16+
dump-unicode-data:
17+
uses: ./.github/workflows/unicode-dump.yml
1618
build-and-test:
19+
needs:
20+
- dump-unicode-data
1721
uses: ./.github/workflows/build-and-test.yml
1822
with:
1923
upload-code-coverage: true
@@ -47,6 +51,7 @@ jobs:
4751
- name: Cache unicode data
4852
uses: actions/cache@v4
4953
with:
54+
fail-on-cache-miss: true
5055
path: unicode_dump
5156
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
5257
restore-keys: |

.github/workflows/unicode-dump.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Dump information for Unicode characters
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
generate-dump:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: 'Checkout Repository'
11+
uses: actions/checkout@v4
12+
- uses: actions/setup-java@v4
13+
with:
14+
distribution: temurin
15+
java-version-file: .java-version
16+
- name: Cache unicode data
17+
id: cache
18+
uses: actions/cache@v4
19+
with:
20+
path: unicode_dump
21+
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
22+
restore-keys: |
23+
unicode-dump-
24+
- name: Validate Gradle Wrapper
25+
if: ${{ !steps.cache.outputs.cache-hit }}
26+
uses: gradle/actions/wrapper-validation@v3
27+
- name: Setup Gradle
28+
if: ${{ !steps.cache.outputs.cache-hit }}
29+
uses: gradle/actions/setup-gradle@v3
30+
with:
31+
gradle-version: wrapper
32+
- name: Build
33+
if: ${{ !steps.cache.outputs.cache-hit }}
34+
run: ./gradlew :json-schema-validator:dumpCharacterData

0 commit comments

Comments
 (0)