Skip to content

Commit 237da00

Browse files
add github action services
1 parent dce1798 commit 237da00

File tree

1 file changed

+51
-7
lines changed

1 file changed

+51
-7
lines changed

.github/workflows/ci-actions.yml

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,47 @@ jobs:
3030
contains(github.event.changes.title.from, '[wip]') \
3131
) \
3232
)"
33+
steps:
34+
- uses: actions/checkout@v2
35+
- uses: n1hility/cancel-previous-runs@v2
36+
if: github.event_name == 'pull_request'
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
- name: Set up JDK 11
40+
# Uses sha for added security since tags can be updated
41+
uses: joschi/setup-jdk@b9cc6eabf7e7e3889766b5cee486f874c9e1bd2d
42+
with:
43+
java-version: 11
44+
- name: Compute cache restore key
45+
# Always recompute on a push so that the maven repo doesnt grow indefinitely with old versions
46+
run: |
47+
if ${{ github.event_name == 'pull_request' }}; then echo "::set-env name=COMPUTED_RESTORE_KEY::q2maven-"; fi
48+
- name: Cache Maven Repository
49+
id: cache-maven
50+
uses: n1hility/cache@v2
51+
with:
52+
path: ~/.m2/repository
53+
# Improves the reusability of the cache to limit key changes
54+
key: q2maven-${{ hashFiles('pom.xml') }}
55+
restore-keys: ${{ env.COMPUTED_RESTORE_KEY }}
56+
restore-only: ${{ github.event_name == 'pull_request' }}
57+
- name: Build
58+
run: |
59+
mvn -e -B -DskipTests=true -DskipDocs clean install
60+
- name: Tar Maven Repo
61+
shell: bash
62+
run: tar -czvf maven-repo.tgz -C ~ .m2/repository
63+
- name: Persist Maven Repo
64+
uses: actions/upload-artifact@v1
65+
with:
66+
name: maven-repo
67+
path: maven-repo.tgz
3368

69+
linux-jvm-tests:
70+
name: JDK 11 JVM Tests
71+
timeout-minutes: 120
72+
needs: build-jdk11
73+
runs-on: ubuntu-latest
3474
services:
3575
activemq-artemis:
3676
image: vromero/activemq-artemis:2.9.0-alpine
@@ -47,18 +87,22 @@ jobs:
4787
MINIO_SECRET_KEY: uvgz3LCwWM3e400cDkQIH/y1Y4xgU4iV91CwFSPC
4888
ports:
4989
- 127.0.0.1:9000:9000
50-
90+
options: server /data
5191
steps:
5292
- uses: actions/checkout@v2
53-
- uses: n1hility/cancel-previous-runs@v2
54-
if: github.event_name == 'pull_request'
55-
with:
56-
token: ${{ secrets.GITHUB_TOKEN }}
57-
- name: Set up JDK 11
93+
- name: Set up JDK ${{ matrix.java-version }}
5894
# Uses sha for added security since tags can be updated
5995
uses: joschi/setup-jdk@b9cc6eabf7e7e3889766b5cee486f874c9e1bd2d
6096
with:
61-
java-version: 11
97+
java-version: ${{ matrix.java-version }}
98+
- name: Download Maven Repo
99+
uses: actions/download-artifact@v1
100+
with:
101+
name: maven-repo
102+
path: .
103+
- name: Extract Maven Repo
104+
shell: bash
105+
run: tar -xzvf maven-repo.tgz -C ~
62106
- name: Build with Maven and Coverage
63107
if: github.event_name == 'pull_request'
64108
run: mvn verify -P '!services,coverage'

0 commit comments

Comments
 (0)