Skip to content

Commit

Permalink
Merge pull request #57 from pitest/automate_release
Browse files Browse the repository at this point in the history
setup github actions
  • Loading branch information
hcoles committed Mar 19, 2021
2 parents dc1084c + f55a0a3 commit a514fd7
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 15 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI
on:
push:
branches:
- 'master'
pull_request:
branches-ignore:
- 'release'
jobs:
supported-jdk:
name: ${{ matrix.title }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
include:
- title: "JDK 8"
java: 8
- title: "JDK 11"
java: 11
- title: "JDK 16"
java: "16-ea"
runs-on: ubuntu-latest
steps:
- name: 'Checkout from Git'
uses: actions/checkout@v2
- name: 'Set up JDK ${{ matrix.java }}'
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: 'Display JDK version'
run: java -version
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: 'Test'
run: mvn -B verify
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release
on:
push:
branches:
- release/**
jobs:
release:
runs-on: ubuntu-latest
# sonatype nexus sometimes hangs
timeout-minutes: 20
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
id: extract_branch
- name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Checkout project
uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
java-version: 8
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Configure Git user
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
- name: Publish JAR
run: mvn -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE}} -B -Prelease deploy scm:tag -Drevision=${{ steps.extract_branch.outputs.branch }} -DskipTests=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy snapshot
on:
push:
branches:
- master
jobs:
snapshot:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
java-version: 8
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish JARs
run: mvn -B deploy -DskipTests=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Maven ###
dependency-reduced-pom.xml
/target/
.flattened-pom.xml

### STS ###
.apt_generated
Expand Down
53 changes: 38 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.pitest</groupId>
<artifactId>pitest-junit5-plugin</artifactId>
<version>0.13-SNAPSHOT</version>
<version>${revision}</version>

<name>pitest-junit5-plugin</name>
<url>http://pitest.org</url>
Expand All @@ -13,6 +13,9 @@
<packaging>jar</packaging>

<properties>
<!-- this revision number used only for local builds -->
<revision>1.0.0-SNAPSHOT</revision>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down Expand Up @@ -175,6 +178,31 @@
</artifactSet>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.2.5</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>package</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand All @@ -192,20 +220,15 @@
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-api</artifactId>
<version>1.11.2</version>
</dependency>
</dependencies>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit a514fd7

Please sign in to comment.