Skip to content

Commit d3b2953

Browse files
authored
Merge branch 'master' into 2017-inverted-service-dates
2 parents e1d542c + 11396ce commit d3b2953

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2568
-229
lines changed

.github/workflows/docker.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v3
18-
- uses: gradle/wrapper-validation-action@v1
18+
- uses: gradle/actions/wrapper-validation@v4
1919
test:
2020
needs: [ validate_gradle_wrapper ]
2121
runs-on: ubuntu-latest
@@ -33,9 +33,11 @@ jobs:
3333
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
3434
restore-keys: ${{ runner.os }}-gradle
3535
- name: Run Java tests
36-
uses: gradle/gradle-build-action@v2
37-
with:
38-
arguments: testAggregateTestReport
36+
uses: gradle/actions/setup-gradle@v4
37+
38+
- name: Generate aggregate test report
39+
run: ./gradlew testAggregateTestReport
40+
3941
- name: Persist aggregated test reports on failure
4042
if: ${{ failure() }}
4143
uses: actions/upload-artifact@v4

.github/workflows/end_to_end.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
runs-on: ubuntu-latest
4444
steps:
4545
- uses: actions/checkout@v3
46-
- uses: gradle/wrapper-validation-action@v1
46+
- uses: gradle/actions/wrapper-validation@v4
4747
pack-snapshot:
4848
needs: validate_gradle_wrapper
4949
runs-on: ubuntu-latest
@@ -61,9 +61,11 @@ jobs:
6161
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
6262
restore-keys: ${{ runner.os }}-gradle
6363
- name: Package cli app jar with Gradle
64-
uses: gradle/gradle-build-action@v2
65-
with:
66-
arguments: shadowJar
64+
uses: gradle/actions/setup-gradle@v3
65+
66+
- name: Builds ShadowJar
67+
run: ./gradlew shadowJar
68+
6769
- name: Persist gtfs-validator snapshot jar
6870
uses: actions/upload-artifact@v4
6971
with:

.github/workflows/package_installers.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ubuntu-latest
3636
steps:
3737
- uses: actions/checkout@v4
38-
- uses: gradle/wrapper-validation-action@v2
38+
- uses: gradle/actions/wrapper-validation@v4
3939

4040
build_push:
4141
needs: [ validate_gradle_wrapper ]
@@ -81,11 +81,9 @@ jobs:
8181
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${MACOS_CI_KEYCHAIN_PWD}" build.keychain
8282
8383
- name: "Package GUI app installer with Gradle"
84-
uses: gradle/actions/setup-gradle@v3
85-
with:
86-
arguments: |
87-
jpackage
88-
-Psign-app=${{github.event_name == 'push' || github.event_name == 'release'}}
84+
uses: gradle/actions/setup-gradle@v4
85+
- name: Run Gradle GUI packaging command on push or release
86+
run: ./gradlew jpackage -Psign-app=${{github.event_name == 'push' || github.event_name == 'release'}}
8987

9088
# On MacOS, we now submit the app for "notarization", where Apple will scan the app for
9189
# malware and other issues. This step can take a few minutes or more; the action will wait
@@ -142,9 +140,10 @@ jobs:
142140
143141
- name: Package cli and gui app jars with Gradle
144142
if: ${{ matrix.os == 'ubuntu-latest' }}
145-
uses: gradle/actions/setup-gradle@v3
146-
with:
147-
arguments: shadowJar
143+
uses: gradle/actions/setup-gradle@v4
144+
145+
- name: Produce shadowJar
146+
run: ./gradlew shadowJar
148147

149148
- name: Persist cli app jar
150149
if: ${{ matrix.os == 'ubuntu-latest' }}

.github/workflows/publish_assets.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
18+
with:
19+
# We need to download all tags so that the axion-release-plugin can resolve the most recent version tag.
20+
# This is useful only for the manual trigger.
21+
# For the release trigger, the tag is available on the current commit.
22+
fetch-depth: 0
23+
1824
# Get the version from the commit. This will depend on the trigger of the workflow
1925
# If the trigger is release, the version will be the tag on the commit.
2026
# If the trigger is a workflow_dispatch, the version will be the branch name, which is
@@ -91,27 +97,22 @@ jobs:
9197
asset_name: javadocs.zip
9298
asset_content_type: application/zip
9399

94-
# The following steps will publish artifacts to a sonatype staging repo with the aim of promoting them to maven central
95-
# Pretty much everything is done through gradle.
96-
# The version used will be according to the axion-release-plugin, meaning it will take a tag if present.
97-
# The tag should follow semantic versioning, e.g. v1.2.3. There could be a suffix, e.g. v1.2.3-TEST
98-
# gradle will build, sign then upload artifacts to a Sonatype staging repo.
99-
# See https://s01.oss.sonatype.org for accessing these repos.
100-
# At this point it should manually be closed, which will trigger acceptance tests for maven central (but not transfer yet)
101-
# Once closed, the repo is available for testing.
102-
# After testing, it can be manually promoted on the sonatype site, which will then publish to maven central.
103-
# Note than once in maven central a release cannot be removed or altered.
104-
105100
- name: Load secrets from 1Password
106101
id: onepw_secrets
107102
uses: ./.github/actions/extract-1password-secret
108103
with:
109104
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} # This is required to connect to the vault in our 1Password account.
110-
VARIABLES_TO_EXTRACT: 'MAVEN_GPG_PASSPHRASE, MAVEN_GPG_PRIVATE_KEY, SONATYPE_TOKEN_USERNAME, SONATYPE_TOKEN_PASSWORD'
105+
VARIABLES_TO_EXTRACT: 'MAVEN_GPG_PASSPHRASE, MAVEN_GPG_PRIVATE_KEY, MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME, MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD'
111106
ONE_PASSWORD_SECRET_REFERENCES: ${{ vars.ONE_PASSWORD_SECRET_REFERENCES }}
112107

113-
- name: Build and Publish to Sonatype
108+
- name: Build and Publish to Maven Central
114109
run: |
115-
# Don't verify since it has already been done when the PR was created.
116-
./gradlew publish --rerun-tasks -x spotlessCheck
110+
# Publishing to Maven Central will fail if the version is a snapshot, i.e. there is no version tag
111+
# directly on the current commit.
112+
# See https://repo1.maven.org/maven2/org/mobilitydata/gtfs-validator/ for the maven central repository.
113+
# Once this step is done, the artefacts will be validated but not yet published.
114+
# See https://central.sonatype.com/publishing/deployments (you need to login as mobilitydata)
115+
# From this page you can examine the list of artefacts, and either drop them or release them.
116+
# Note that once released, the artefacts cannot be removed or altered.
117+
./gradlew publishToMavenCentral
117118
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish Jars Snapshots
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- 'core/src/main/**'
8+
- 'main/src/main/**'
9+
- 'model/src/main/**'
10+
- 'build.gradle'
11+
- '.github/workflows/publish_snapshots.yml'
12+
workflow_dispatch:
13+
14+
env:
15+
java_version: '17'
16+
java_distribution: 'zulu'
17+
18+
jobs:
19+
publish-snapshots:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
# We need to download all tags so that the axion-release-plugin
26+
# can resolve the most recent version tag.
27+
fetch-depth: 0
28+
29+
- name: Set up JDK ${{ env.java_version }}-${{ env.java_distribution }}
30+
uses: actions/setup-java@v3
31+
with:
32+
java-version: ${{ env.java_version }}
33+
distribution: ${{ env.java_distribution }}
34+
35+
- name: Load secrets from 1Password
36+
id: onepw_secrets
37+
uses: ./.github/actions/extract-1password-secret
38+
with:
39+
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} # This is required to connect to the vault in our 1Password account.
40+
VARIABLES_TO_EXTRACT: 'MAVEN_GPG_PASSPHRASE, MAVEN_GPG_PRIVATE_KEY, MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME, MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD'
41+
ONE_PASSWORD_SECRET_REFERENCES: ${{ vars.ONE_PASSWORD_SECRET_REFERENCES }}
42+
43+
- name: Build and Publish to the snapshot repository
44+
run: |
45+
# Publishing to the snapshot repository will fail if the current commit has a version tag.
46+
# Which in effect makes it a release.
47+
# See https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/org/mobilitydata/gtfs-validator/
48+
# for the snapshot repository.
49+
./gradlew publishToSnapshotRepository
50+

.github/workflows/test_pack_doc.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v3
16-
- uses: gradle/wrapper-validation-action@v1
16+
- uses: gradle/actions/wrapper-validation@v4
1717
test:
1818
needs: [ validate_gradle_wrapper ]
1919
runs-on: ${{ matrix.os }}
@@ -35,9 +35,10 @@ jobs:
3535
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
3636
restore-keys: ${{ runner.os }}-gradle
3737
- name: Run tests on Java ${{ matrix.java_version }} and ${{ matrix.os }}
38-
uses: gradle/gradle-build-action@v2
39-
with:
40-
arguments: testAggregateTestReport --continue
38+
uses: gradle/actions/setup-gradle@v4
39+
- name: Continue on test report
40+
run: ./gradlew testAggregateTestReport --continue
41+
4142
- name: Persist aggregated test reports on failure - Java ${{ matrix.java_version }} on ${{ matrix.os }}
4243
if: ${{ failure() }}
4344
uses: actions/upload-artifact@v4
@@ -66,9 +67,10 @@ jobs:
6667
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
6768
restore-keys: ${{ runner.os }}-gradle
6869
- name: Package cli app jar with Gradle
69-
uses: gradle/gradle-build-action@v2
70-
with:
71-
arguments: shadowJar
70+
uses: gradle/actions/setup-gradle@v4
71+
- name: Produce shadowJar
72+
run: ./gradlew shadowJar
73+
7274
- name: Persist cli app jar
7375
uses: actions/upload-artifact@v4
7476
with:
@@ -95,10 +97,10 @@ jobs:
9597
path: ~/.gradle/caches
9698
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
9799
restore-keys: ${{ runner.os }}-gradle
100+
- name: Setup Javadoc build
101+
uses: gradle/actions/setup-gradle@v4
98102
- name: Build Javadoc
99-
uses: gradle/gradle-build-action@v2
100-
with:
101-
arguments: aggregateJavadoc
103+
run: ./gradlew aggregateJavadoc
102104
- name: Persist javadoc
103105
uses: actions/upload-artifact@v4
104106
with:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ To facilitate easier debugging and logging, we have made our user agent header e
6363
### Run it
6464
Once installed, run the application and you will see the following screen:
6565

66-
![Application-Windows](/docs/Application-Windows.png)
66+
![Application-Windows](/docs/images/Application-Windows.png)
6767

6868
There are two primary options to set:
6969

build.gradle

Lines changed: 66 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
*/
1616
/*
1717
* A note about publishing and signing.
18-
* Maven central requires that artifacts be signed. And upload is done to Sonatype.
18+
* Maven central requires that artifacts be signed. And upload is done via Maven Central Portal.
1919
* To publish you will need these environment variables defined:
20-
* SONATYPE_TOKEN_USERNAME
21-
* SONATYPE_TOKEN_PASSWORD
20+
* MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME
21+
* MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD
2222
* MAVEN_GPG_PRIVATE_KEY
2323
* MAVEN_GPG_PASSPHRASE
24-
* Suggestion is to put these in a shell script with restricted read permissions, then source it before calling
25-
* ./gradlew publish.
24+
* If run manually, the suggestion is to put these in a shell script with restricted read permissions,
25+
* then source it before calling ./gradlew
26+
* If run from a Github action, make sure these environment variables are defined.
2627
*/
2728
plugins {
2829
id 'java'
@@ -58,6 +59,7 @@ allprojects {
5859

5960
tasks.withType(Javadoc) {
6061
options.encoding = 'UTF-8'
62+
options.addStringOption('Xdoclint:none', '-quiet')
6163
}
6264

6365
// All projects that include the 'java` plugin will have a Test task by default.
@@ -82,16 +84,6 @@ subprojects {
8284
apply plugin: 'java'
8385
apply plugin: libs.plugins.spotless.get().pluginId
8486

85-
// Cannot publish a SNAPSHOT. The provided sonatype url will not accept it.
86-
tasks.withType(PublishToMavenRepository).all { task ->
87-
task.onlyIf {
88-
if (project.version.toString().contains('SNAPSHOT')) {
89-
throw new GradleException("Publishing is not allowed for SNAPSHOT versions. Currently " + project.version)
90-
}
91-
true
92-
}
93-
}
94-
9587
task javadocJar(type: Jar) {
9688
archiveClassifier.set('javadoc')
9789
from javadoc
@@ -111,24 +103,29 @@ subprojects {
111103

112104
// These modules require the same publishing configuration, apart from the name of the module
113105
// Also we want to limit artefact publishing to these modules.
114-
if (project.name == 'main' ||
115-
project.name == 'core' ||
116-
project.name == 'model') {
106+
if (project.name == 'main'
107+
|| project.name == 'core'
108+
|| project.name == 'model'
109+
) {
117110
def fullProjectName = 'gtfs-validator-' + project.name
118111

119112
afterEvaluate {
120113
publishing {
121114
repositories {
122-
// This is the sonatype staging repo for maven.
123-
// Once uploaded, the repo needs to be manually closed, which will trigger acceptance tests for
124-
// maven central (but not transfer yet).
125-
// Once successfully closed, the repo is available for testing.
126-
// After testing, it can be manually promoted on the sonatype site, which will then publish to maven central.
127115
maven {
128-
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
129-
credentials {
130-
username System.getenv("SONATYPE_TOKEN_USERNAME")
131-
password System.getenv("SONATYPE_TOKEN_PASSWORD")
116+
// Snapshot uses a different repository than release.
117+
// The publish in that case will upload to Maven Central snapshot repository.
118+
if (version.endsWith('SNAPSHOT')) {
119+
url = 'https://central.sonatype.com/repository/maven-snapshots/'
120+
credentials {
121+
username = System.getenv("MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME")
122+
password = System.getenv("MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD")
123+
}
124+
} else {
125+
// For releases, the publish task does not upload to MavenCentral.
126+
// It just creates the artifacts directory hierarchy on the local disk,
127+
// The actual zipping and uploading is done in the publishToMavenCentral task.
128+
url = "${buildDir}/local-repo"
132129
}
133130
}
134131
}
@@ -172,9 +169,51 @@ subprojects {
172169
useInMemoryPgpKeys(System.getenv('MAVEN_GPG_PRIVATE_KEY'), System.getenv('MAVEN_GPG_PASSPHRASE'))
173170
sign publishing.publications.mavenJava
174171
}
172+
173+
174+
tasks.register('publishToMavenCentral') {
175+
// We want to do call the publish task only if the version is a release (ie not a snapshot).
176+
// Without this conditional, with a snapshot it would do the publish first, then throw the Exception below.
177+
// But since the dependsOn is within the conditional, the dependency is not created for snapshot versions
178+
// so the publish in that case is never executed.
179+
if (!version.toString().endsWith('SNAPSHOT')) {
180+
dependsOn tasks.publish
181+
}
182+
doFirst {
183+
if (version.toString().endsWith('SNAPSHOT')) {
184+
throw new GradleException("Version \"" + version +
185+
"\" is a snapshot. Cannot publish to Maven Central")
186+
}
187+
}
188+
189+
doLast {
190+
exec {
191+
workingDir project.projectDir
192+
commandLine 'bash', "${project.rootDir}/scripts/publish_to_maven_central.sh", project.name, project.version
193+
}
194+
}
195+
}
196+
197+
tasks.register('publishToSnapshotRepository') {
198+
// We want to call the publish task only if the version is a snapshot.
199+
// Without this conditional, with a release it would do the publish first, then throw the Exception below.
200+
// But since the dependsOn is within the conditional, the dependency is not created for release versions
201+
// so the publish in that case is never executed.
202+
if (version.toString().endsWith('SNAPSHOT')) {
203+
dependsOn tasks.publish
204+
}
205+
doFirst {
206+
if (!version.toString().endsWith('SNAPSHOT')) {
207+
throw new GradleException("Version \"" + version +
208+
"\" is a NOT a snapshot. Cannot publish to the snapshot repository")
209+
}
210+
}
211+
}
175212
}
176213

214+
177215
}
216+
178217
compileJava {
179218
options.compilerArgs << '-parameters'
180219
}

docs/ACCEPTANCE_TESTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ The source id can be used to find all datasets versions of a source on the [Mobi
102102
## What do we do with the results?
103103
We follow this process:
104104

105-
<img src="/docs/Acceptance-test-process.jpg" width="750">
105+
<img src="/docs/images/Acceptance-test-process.jpg" width="750">
106106

107107
## Performance metrics within the acceptance reports
108108

0 commit comments

Comments
 (0)