Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Add github package upload workflow #14

Merged
merged 4 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Github Packages Build
# On [push, pull_request] causes double-builds when creating PRs.
# But triggering on push only will miss pull requests from outside authors.
# The push event's ref is the name of the pushed branch;
# The pull_request event's branch name is the merge target branch.
# TODO: Remove otp2-upgrade from here once we've merged to master and deployed to prod
on:
push:
branches:
- master
- otp2-upgrade
pull_request:
branches:
- master
- otp2-upgrade
jobs:
build-linux:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
# Starting in v2.2 checkout action fetches all tags when fetch-depth=0, for auto-versioning.
- uses: actions/checkout@v3.3.0
with:
fetch-depth: 0

# Java setup step completes very fast, no need to run in a preconfigured docker container
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: maven

- name: Prepare coverage agent, build and test
run: mvn --batch-mode package -Dmaven.test.skip

- name: Deploy to Github Package Registry
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/otp2-upgrade')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn --batch-mode deploy --settings maven-settings.xml -DskipTests -DGITHUB_REPOSITORY=$GITHUB_REPOSITORY -P deployGitHub
10 changes: 0 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,3 @@ jobs:

- name: Test project with Maven
run: mvn --no-transfer-progress test verify

- name: Build documentation
run: mvn --no-transfer-progress site

- name: Deploy documentation to Github Pages
# only deploy after merging to master
if: github.repository_owner == 'OneBusAway' github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: target/site/
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
java adoptopenjdk-17.0.6+10
maven 3.8.1
java adoptopenjdk-17.0.7+7
maven 3.9.1
12 changes: 12 additions & 0 deletions maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- This file provides credentials and other details to the Maven plugins that deploy our artifacts.
These are provided with Github repo secrets (and secrets.GITHUB_TOKEN is provided automatically).
Those secrets are copied to environment variables by the CI Action. -->
<settings>
<servers>
<server>
<id>github</id>
<username>NONE</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
</servers>
</settings>
2 changes: 1 addition & 1 deletion onebusaway-gtfs-hibernate-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs-modules</artifactId>
<version>1.3.119-MBTA</version>
<version>1.3.119-MBTA-SNAPSHOT</version>
</parent>
<artifactId>onebusaway-gtfs-hibernate-cli</artifactId>
<name>onebusaway-gtfs-hibernate-cli</name>
Expand Down
2 changes: 1 addition & 1 deletion onebusaway-gtfs-hibernate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs-modules</artifactId>
<version>1.3.119-MBTA</version>
<version>1.3.119-MBTA-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion onebusaway-gtfs-merge-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>onebusaway-gtfs-modules</artifactId>
<groupId>org.onebusaway</groupId>
<version>1.3.119-MBTA</version>
<version>1.3.119-MBTA-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>onebusaway-gtfs-merge-cli</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion onebusaway-gtfs-merge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>onebusaway-gtfs-modules</artifactId>
<groupId>org.onebusaway</groupId>
<version>1.3.119-MBTA</version>
<version>1.3.119-MBTA-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>onebusaway-gtfs-merge</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion onebusaway-gtfs-transformer-cli-aws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs-modules</artifactId>
<version>1.3.119-MBTA</version>
<version>1.3.119-MBTA-SNAPSHOT</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion onebusaway-gtfs-transformer-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs-modules</artifactId>
<version>1.3.119-MBTA</version>
<version>1.3.119-MBTA-SNAPSHOT</version>
</parent>

<properties>
Expand Down
4 changes: 2 additions & 2 deletions onebusaway-gtfs-transformer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<parent>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs-modules</artifactId>
<version>1.3.119-MBTA</version>
<version>1.3.119-MBTA-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs</artifactId>
<version>1.3.119-MBTA</version>
<version>1.3.119-MBTA-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.onebusaway</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,6 @@ public void testResolveConverter() {
String.class);
assertSame(ConvertUtils.lookup(String.class), converter);
}

@Test
public void testResolveConverter_FieldMappingConverter() {
EmmaSimon marked this conversation as resolved.
Show resolved Hide resolved
EntitySchema schema = new EntitySchema(Object.class, "object.txt", false);
FieldMappingAndConverter field = mock(FieldMappingAndConverter.class);
when(field.getCsvFieldName()).thenReturn("xyz");
schema.addField(field);
_schemaCache.addEntitySchema(schema);
Converter converter = _support.resolveConverter(Object.class, "xyz",
String.class);
assertSame(field, converter);
}

private static interface FieldMappingAndConverter extends SingleFieldMapping,
Converter {
Expand Down
2 changes: 1 addition & 1 deletion onebusaway-gtfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs-modules</artifactId>
<version>1.3.119-MBTA</version>
<version>1.3.119-MBTA-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* Copyright (C) 2023 MBTA <lboyarsky@mbta.com>
EmmaSimon marked this conversation as resolved.
Show resolved Hide resolved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onebusaway.gtfs.model;

import org.onebusaway.csv_entities.schema.annotations.CsvField;
Expand Down
55 changes: 35 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,24 @@
</parent>

<artifactId>onebusaway-gtfs-modules</artifactId>
<version>1.3.119-MBTA</version>
<version>1.3.119-MBTA-SNAPSHOT</version>
<packaging>pom</packaging>

<name>onebusaway-gtfs-modules</name>
<description>A collection of GTFS libraries and tools.</description>
<url>https://github.com/OneBusAway/onebusaway-gtfs-modules/wiki/</url>
<url>https://github.com/mbta/onebusaway-gtfs-modules/wiki/</url>

<properties>
<onebusaway_csv_entities_version>1.1.6</onebusaway_csv_entities_version>
<onebusaway_collections_version>1.2.8</onebusaway_collections_version>
<slf4j_version>2.0.6</slf4j_version>
<slf4j_version>2.0.6</slf4j_version>
<GITHUB_REPOSITORY>mbta/onebusaway-gtfs-modules</GITHUB_REPOSITORY>
</properties>

<scm>
<connection>scm:git:https://github.com/OneBusAway/onebusaway-gtfs-modules.git</connection>
<developerConnection>scm:git:ssh://git@github.com/OneBusAway/onebusaway-gtfs-modules.git</developerConnection>
<url>https://github.com/OneBusAway/onebusaway-gtfs-modules</url>
<connection>scm:git:https://github.com/mbta/onebusaway-gtfs-modules.git</connection>
<developerConnection>scm:git:ssh://git@github.com/mbta/onebusaway-gtfs-modules.git</developerConnection>
<url>https://github.com/mbta/onebusaway-gtfs-modules</url>
<tag>onebusaway-gtfs-modules-1.3.119</tag>
</scm>

Expand All @@ -43,26 +44,23 @@
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots-camsys-public-repo</id>
<url>https://repo.camsys-apps.com/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<distributionManagement>
<site>
<id>${site_id}</id>
<url>${site_deployment_base}/onebusaway-gtfs-modules/${project.version}</url>
</site>
<repository>
<id>github</id>
<name>OneBusAway GTFS Modules Maven Repository on Github Packages</name>
<url>https://maven.pkg.github.com/${GITHUB_REPOSITORY}/</url>
</repository>
<snapshotRepository>
<id>github</id>
<name>OneBusAway GTFS Modules Maven Repository on Github Packages</name>
<url>https://maven.pkg.github.com/${GITHUB_REPOSITORY}/</url>
</snapshotRepository>
</distributionManagement>

<modules>
Expand Down Expand Up @@ -200,9 +198,26 @@
<header>LICENSE.txt</header>
<excludes combine.children="append">
<exclude>**/ci.yml</exclude>
<exclude>**/build.yml</exclude>
<exclude>maven-settings.xml</exclude>
<excludes>build.sh</excludes>
<excludes>.tool-versions</excludes>
</excludes>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>deployGitHub</id>
<distributionManagement>
<repository>
<id>github</id>
<name>OneBusAway GTFS Modules Maven Repository on Github Packages</name>
<url>https://maven.pkg.github.com/${GITHUB_REPOSITORY}/</url>
</repository>
</distributionManagement>
</profile>
</profiles>
</project>