Skip to content

Commit a4ba99a

Browse files
committed
ci: configure ~/.m2/settings.xml mirror to avoid Maven Central rate limits
Inlines the build job that previously delegated to openrewrite/gh-automation's reusable ci-gradle workflow, and adds an `s4u/maven-settings-action` step that writes a `~/.m2/settings.xml` with a wildcard mirror pointing at Moderne's Artifactory cache. The MavenSettingsAutoLoadingExtension introduced earlier in this PR loads that file into the test ExecutionContext, so recipes resolving Maven artifacts during rewrite-gradle tests no longer hit Maven Central directly and avoid the HTTP 404 + Retry-After throttling that's been failing CI under parallel load. The reusable workflow had no hook to inject extra setup steps, and inlining keeps everything in this PR. Functionality (build, scheduled-failure Slack notification, snapshot publish on main) is preserved.
1 parent 7994ffc commit a4ba99a

1 file changed

Lines changed: 62 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 62 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,67 @@ concurrency:
1818
group: ci-${{ github.ref }}
1919
cancel-in-progress: true
2020

21+
env:
22+
GRADLE_SWITCHES: --console=plain --info --stacktrace --warning-mode=all --no-daemon
23+
2124
jobs:
2225
build:
23-
uses: openrewrite/gh-automation/.github/workflows/ci-gradle.yml@main
24-
with:
25-
java_version: |
26-
25
27-
21
28-
secrets:
29-
gradle_enterprise_access_key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
30-
sonatype_username: ${{ secrets.SONATYPE_USERNAME }}
31-
sonatype_token: ${{ secrets.SONATYPE_TOKEN}}
32-
ossrh_signing_key: ${{ secrets.OSSRH_SIGNING_KEY }}
33-
ossrh_signing_password: ${{ secrets.OSSRH_SIGNING_PASSWORD }}
34-
OPS_GITHUB_ACTIONS_WEBHOOK: ${{ secrets.OPS_GITHUB_ACTIONS_WEBHOOK }}
35-
node_auth_token: ${{ secrets.NPM_TOKEN }}
36-
pypi_token: ${{ secrets.PYPI_OPENREWRITE_PUBLISH }}
37-
nuget_api_key: ${{ secrets.NUGET_API_KEY }}
26+
runs-on: ubuntu-latest
27+
if: github.event_name != 'schedule' || github.repository_owner == 'openrewrite' || github.repository_owner == 'moderneinc'
28+
steps:
29+
- uses: actions/checkout@v6
30+
with:
31+
fetch-depth: 0
32+
show-progress: false
33+
34+
- uses: actions/setup-java@v5
35+
with:
36+
distribution: temurin
37+
java-version: |
38+
25
39+
21
40+
41+
- uses: astral-sh/setup-uv@v7
42+
43+
# Route Maven resolution through Moderne's Artifactory cache to avoid
44+
# Maven Central rate-limiting (HTTP 404 + Retry-After) under parallel test
45+
# load. Picked up by MavenSettingsAutoLoadingExtension at test time. Must
46+
# run after setup-java because that action overwrites ~/.m2/settings.xml.
47+
- uses: s4u/maven-settings-action@v3.1.0
48+
with:
49+
mirrors: '[{"id": "moderne-cache", "name": "Moderne Artifactory Cache", "mirrorOf": "*", "url": "https://artifactory.moderne.ninja/artifactory/moderne-cache-3/"}]'
50+
51+
- name: Setup Gradle
52+
uses: gradle/actions/setup-gradle@v5
53+
with:
54+
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
55+
56+
- name: build
57+
run: ./gradlew ${{ env.GRADLE_SWITCHES }} build
58+
59+
- name: slackNotificationOfFailure
60+
if: failure() && github.event_name == 'schedule' && (github.repository_owner == 'openrewrite' || github.repository_owner == 'moderneinc')
61+
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661
62+
continue-on-error: true
63+
env:
64+
SLACK_WEBHOOK: ${{ secrets.OPS_GITHUB_ACTIONS_WEBHOOK }}
65+
MSG_MINIMAL: true
66+
SLACK_MESSAGE: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
67+
SLACK_USERNAME: ${{ github.repository }} CI failure
68+
SLACK_COLOR: failure
69+
SLACK_FOOTER: ''
70+
71+
- name: publish-snapshots
72+
if: >
73+
github.event_name != 'pull_request' &&
74+
github.ref == 'refs/heads/main' &&
75+
(github.repository_owner == 'openrewrite' || github.repository_owner == 'moderneinc')
76+
run: ./gradlew ${{ env.GRADLE_SWITCHES }} snapshot publish -PforceSigning -x test
77+
env:
78+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
79+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_TOKEN }}
80+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_SIGNING_KEY }}
81+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_SIGNING_PASSWORD }}
82+
ORG_GRADLE_PROJECT_nodeAuthToken: ${{ secrets.NPM_TOKEN }}
83+
ORG_GRADLE_PROJECT_pypiToken: ${{ secrets.PYPI_OPENREWRITE_PUBLISH }}
84+
ORG_GRADLE_PROJECT_nugetApiKey: ${{ secrets.NUGET_API_KEY }}

0 commit comments

Comments
 (0)