Skip to content

Commit 8186f38

Browse files
Update ci.yml
Fix workflow
1 parent bb2f269 commit 8186f38

1 file changed

Lines changed: 117 additions & 40 deletions

File tree

.github/workflows/ci.yml

Lines changed: 117 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,77 +2,106 @@ name: CI Pipeline
22

33
on:
44
push:
5-
branches: [ "**" ] # Run on every commit to any branch
5+
branches: [ "**" ]
66
pull_request:
7-
branches: [ "**" ] # Run for PRs from any branch
7+
branches: [ "**" ]
88
workflow_dispatch:
99

10-
permissions: write-all
10+
# Least privilege by default; each job widens only what it needs.
11+
permissions:
12+
contents: read
13+
14+
# Cancel superseded runs on the same branch/PR to save runner minutes.
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
18+
19+
env:
20+
JAVA_VERSION: '17'
21+
JAVA_DISTRIBUTION: 'temurin'
1122

1223
jobs:
1324
gradle_check:
14-
name: Gradle Check
25+
name: Gradle Check (${{ matrix.os }})
1526
runs-on: ${{ matrix.os }}
1627
strategy:
28+
fail-fast: false # one platform failing should not hide the others
1729
matrix:
1830
os: [ ubuntu-latest, windows-latest, macos-latest ]
1931
steps:
20-
- uses: actions/checkout@main
32+
- uses: actions/checkout@v4
2133
with:
22-
fetch-depth: 0
34+
fetch-depth: 0 # required by the git-changelog / version derivation
2335

24-
- name: Set up JDK 17
25-
uses: actions/setup-java@main
36+
- name: Set up JDK ${{ env.JAVA_VERSION }}
37+
uses: actions/setup-java@v4
2638
with:
27-
java-version: '17'
28-
distribution: 'temurin'
39+
java-version: ${{ env.JAVA_VERSION }}
40+
distribution: ${{ env.JAVA_DISTRIBUTION }}
2941

3042
- name: Set up Gradle
31-
uses: gradle/actions/setup-gradle@main
43+
uses: gradle/actions/setup-gradle@v4
44+
with:
45+
cache-read-only: ${{ github.ref != 'refs/heads/master' }}
3246

3347
- name: Run Gradle Check
34-
run: ./gradlew check
48+
run: ./gradlew check --no-daemon
49+
50+
- name: Upload test reports
51+
if: always()
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: test-reports-${{ matrix.os }}
55+
path: |
56+
build/reports/
57+
build/test-results/
58+
retention-days: 7
59+
if-no-files-found: ignore
3560

3661
maven_verify:
37-
name: Maven Verify
38-
needs: gradle_check # ✅ Run only after Gradle check succeeds
62+
name: Maven Verify (${{ matrix.os }})
63+
needs: gradle_check
3964
runs-on: ${{ matrix.os }}
4065
strategy:
66+
fail-fast: false
4167
matrix:
42-
# os: [ ubuntu-latest, windows-latest, macos-latest ]
68+
# windows-latest disabled: see #<issue> — record the reason, not just the comment
4369
os: [ ubuntu-latest, macos-latest ]
4470
steps:
45-
- uses: actions/checkout@main
71+
- uses: actions/checkout@v4
4672
with:
4773
fetch-depth: 0
4874

49-
- name: Set up JDK 17
50-
uses: actions/setup-java@main
75+
- name: Set up JDK ${{ env.JAVA_VERSION }}
76+
uses: actions/setup-java@v4
5177
with:
52-
java-version: '17'
53-
distribution: 'temurin'
78+
java-version: ${{ env.JAVA_VERSION }}
79+
distribution: ${{ env.JAVA_DISTRIBUTION }}
80+
cache: 'maven'
5481

5582
- name: Run Maven Verify
56-
run: mvn --batch-mode verify
83+
run: mvn --batch-mode --no-transfer-progress verify
5784

5885
gradle_publish:
59-
name: Gradle Publish
60-
needs: [ gradle_check, maven_verify ] # ✅ Run only after both succeed
61-
if: github.ref == 'refs/heads/master' && github.repository == 'JSQLParser/JSqlParser' # ✅ Only for master branch of main repo
86+
name: Gradle Publish (Maven Central)
87+
needs: [ gradle_check, maven_verify ]
88+
if: github.ref == 'refs/heads/master' && github.repository == 'JSQLParser/JSqlParser'
6289
runs-on: ubuntu-latest
90+
permissions:
91+
contents: read
6392
steps:
64-
- uses: actions/checkout@main
93+
- uses: actions/checkout@v4
6594
with:
6695
fetch-depth: 0
6796

68-
- name: Set up JDK 17
69-
uses: actions/setup-java@main
97+
- name: Set up JDK ${{ env.JAVA_VERSION }}
98+
uses: actions/setup-java@v4
7099
with:
71-
java-version: '17'
72-
distribution: 'temurin'
100+
java-version: ${{ env.JAVA_VERSION }}
101+
distribution: ${{ env.JAVA_DISTRIBUTION }}
73102

74-
- name: Build with Gradle
75-
uses: gradle/actions/setup-gradle@main
103+
- name: Set up Gradle
104+
uses: gradle/actions/setup-gradle@v4
76105

77106
- name: Publish with Gradle
78107
# Gradle only picks up a secret as a project property when it is exported with the
@@ -82,33 +111,81 @@ jobs:
82111
# No RELEASE variable here on purpose: getVersion() then produces a -SNAPSHOT version and
83112
# the plugin routes it to the Central Portal snapshot repository. Set RELEASE=true only
84113
# when you actually intend to cut a release.
85-
run: ./gradlew publishToMavenCentral
114+
run: ./gradlew publishToMavenCentral --no-daemon
86115
env:
87116
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.mavenCentralUsername }}
88117
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.mavenCentralPassword }}
89118
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.signingInMemoryKey }}
90119
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.signingInMemoryKeyId }}
91120
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signingInMemoryKeyPassword }}
92121

93-
- uses: actions/setup-python@main
122+
deploy_docs:
123+
name: Build & Deploy Sphinx Docs
124+
needs: [ gradle_check, maven_verify ]
125+
if: github.ref == 'refs/heads/master' && github.repository == 'JSQLParser/JSqlParser'
126+
runs-on: ubuntu-latest
127+
permissions:
128+
contents: read
129+
pages: write
130+
id-token: write
131+
environment:
132+
name: github-pages
133+
url: ${{ steps.deployment.outputs.page_url }}
134+
steps:
135+
- uses: actions/checkout@v4
136+
with:
137+
fetch-depth: 0 # gitChangelogTask needs full history
138+
139+
- name: Set up JDK ${{ env.JAVA_VERSION }}
140+
uses: actions/setup-java@v4
141+
with:
142+
java-version: ${{ env.JAVA_VERSION }}
143+
distribution: ${{ env.JAVA_DISTRIBUTION }}
144+
145+
- name: Set up Gradle
146+
uses: gradle/actions/setup-gradle@v4
94147

95-
- name: Install XSLT Processor
96-
run: sudo apt-get install -y xsltproc sphinx-common
148+
- uses: actions/setup-python@v5
149+
with:
150+
python-version: '3.12'
151+
cache: 'pip'
152+
153+
# Only xsltproc comes from apt. `sphinx-common` used to be installed here as well; it
154+
# pulled in python3-sphinx / python3-docutils / python3-pil from the runner's stale apt
155+
# index (hence the 404 on python3-pil 10.2.0-1ubuntu1.2) and shadowed the pip-installed
156+
# Sphinx that actually knows about manticore_sphinx_theme. `apt-get update` first, because
157+
# the pre-baked index on the runner image is regularly older than the mirror.
158+
- name: Install XSLT processor
159+
run: |
160+
sudo apt-get update
161+
sudo apt-get install -y --no-install-recommends xsltproc
97162
98163
- name: Install Python dependencies
99-
run: pip install manticore_sphinx_theme sphinx_javadoc_xml myst_parser sphinx_substitution_extensions sphinx_issues sphinx_inline_tabs pygments
164+
run: |
165+
python -m pip install --upgrade pip
166+
python -m pip install \
167+
'sphinx>=7,<9' \
168+
manticore_sphinx_theme \
169+
sphinx_javadoc_xml \
170+
myst_parser \
171+
sphinx_substitution_extensions \
172+
sphinx_issues \
173+
sphinx_inline_tabs \
174+
pygments
100175
101176
- name: Build Sphinx documentation with Gradle
102-
run: FLOATING_TOC=false ./gradlew -DFLOATING_TOC=false gitChangelogTask renderRR xslt xmldoc sphinx
177+
env:
178+
FLOATING_TOC: 'false'
179+
run: ./gradlew -DFLOATING_TOC=false --no-daemon gitChangelogTask renderRR xslt xmldoc sphinx
103180

104181
- name: Configure GitHub Pages
105-
uses: actions/configure-pages@main
182+
uses: actions/configure-pages@v5
106183

107184
- name: Upload artifact
108-
uses: actions/upload-pages-artifact@main
185+
uses: actions/upload-pages-artifact@v3
109186
with:
110187
path: 'build/sphinx'
111188

112189
- name: Deploy to GitHub Pages
113190
id: deployment
114-
uses: actions/deploy-pages@main
191+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)