Skip to content

Commit b4f26d2

Browse files
committed
Add GH Actions workflow
1 parent 6608373 commit b4f26d2

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/main.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
jobs:
12+
13+
build-and-verify:
14+
name: Build and verify (JDK ${{ matrix.java }})
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
java: [6, 8, 11, 15]
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Download Maven # Download with default JDK because OpenJDK 6 does not support TLS 1.2
23+
run: ./mvnw --version
24+
- name: Set up JDK
25+
uses: actions/setup-java@v1
26+
with:
27+
java-version: ${{ matrix.java }}
28+
- name: Build and verify
29+
run: ./mvnw verify javadoc:javadoc site:site --batch-mode --errors --settings .github/workflows/settings.xml
30+
31+
publish-snapshots:
32+
name: Publish snapshot artifacts
33+
if: github.event_name == 'push' && github.repository == 'junit-team/junit4' && github.ref == 'refs/heads/main'
34+
needs: build-and-verify
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v2
38+
- name: Download Maven # Download with default JDK because OpenJDK 6 does not support TLS 1.2
39+
run: ./mvnw --version
40+
- name: Set up JDK
41+
uses: actions/setup-java@v1
42+
with:
43+
java-version: 6
44+
- name: Publish snapshot artifacts
45+
env:
46+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
47+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
48+
run: ./mvnw deploy --batch-mode --errors --activate-profiles generate-docs --settings .github/workflows/settings.xml

.github/workflows/settings.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<settings>
2+
<mirrors xmlns="http://maven.apache.org/SETTINGS/1.1.0">
3+
<mirror>
4+
<mirrorOf>central</mirrorOf>
5+
<name>GCS Maven Central mirror</name>
6+
<url>https://maven-central.storage-download.googleapis.com/maven2/</url>
7+
<id>google-maven-central</id>
8+
</mirror>
9+
</mirrors>
10+
<servers>
11+
<server>
12+
<id>junit-snapshot-repo</id>
13+
<username>${env.OSSRH_USERNAME}</username>
14+
<password>${env.OSSRH_PASSWORD}</password>
15+
</server>
16+
<server>
17+
<id>junit-releases-repo</id>
18+
<username>${env.OSSRH_USERNAME}</username>
19+
<password>${env.OSSRH_PASSWORD}</password>
20+
</server>
21+
</servers>
22+
</settings>

0 commit comments

Comments
 (0)