Skip to content

Commit 7015023

Browse files
committed
chore: Migrate build and test to GitHub actions
1 parent 6ea26c8 commit 7015023

File tree

3 files changed

+142
-143
lines changed

3 files changed

+142
-143
lines changed
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: Build and test
2+
on: [push]
3+
4+
jobs:
5+
build-and-check:
6+
name: Build and check
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-java@v4
11+
with:
12+
java-version: '17'
13+
distribution: 'temurin'
14+
15+
- name: Setup Gradle
16+
uses: gradle/actions/setup-gradle@v4
17+
with:
18+
cache-read-only: false
19+
20+
- name: Generate and submit dependency graph
21+
uses: gradle/actions/dependency-submission@v4
22+
if: ${{ github.ref == 'refs/heads/master' }}
23+
24+
- name: Build, check and test
25+
run: ./gradlew shadowJar annotation:jar check integrationTest
26+
27+
- name: Upload artifact
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: Jars
31+
path: |
32+
agent/build/libs/*.jar
33+
annotation/build/libs/*.jar
34+
35+
test-suite:
36+
strategy:
37+
matrix:
38+
java: ['17', '11', '8']
39+
runs-on: ubuntu-latest
40+
name: Run test suite with Java ${{ matrix.java }}
41+
needs: build-and-check
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- uses: actions/setup-java@v4
46+
name: Set up Java
47+
with:
48+
java-version: ${{ matrix.java }}
49+
distribution: 'temurin'
50+
51+
- name: Suid root tar
52+
# Required for the bats libraries cache to restore properly
53+
run: sudo chmod +s /bin/tar
54+
55+
- name: Setup Bats and bats libs
56+
id: setup-bats
57+
uses: bats-core/[email protected]
58+
59+
- uses: sbt/setup-sbt@v1
60+
61+
- name: Download artifact
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: Jars
65+
66+
- name: Clone test projects
67+
shell: bash
68+
env:
69+
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
70+
TERM: xterm
71+
working-directory: ./agent
72+
run: bin/test_projects
73+
74+
- uses: actions/setup-java@v4
75+
name: Set up Gradle cache
76+
with:
77+
java-version: ${{ matrix.java }}
78+
distribution: 'temurin'
79+
cache: gradle
80+
81+
- uses: actions/setup-java@v4
82+
name: Set up Maven cache
83+
with:
84+
java-version: ${{ matrix.java }}
85+
distribution: 'temurin'
86+
cache: maven
87+
88+
- uses: actions/setup-java@v4
89+
name: Set up sbt cache
90+
with:
91+
java-version: ${{ matrix.java }}
92+
distribution: 'temurin'
93+
cache: sbt
94+
95+
- name: Build test projects
96+
shell: bash
97+
env:
98+
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
99+
TERM: xterm
100+
working-directory: ./agent
101+
run: bin/test_install
102+
103+
- name: Run tests
104+
shell: bash
105+
env:
106+
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }}
107+
TERM: xterm
108+
working-directory: ./agent
109+
run: bin/test_run
110+
111+
release:
112+
name: Release
113+
runs-on: ubuntu-latest
114+
needs: test-suite
115+
if: ${{ github.ref == 'refs/heads/master' }}
116+
steps:
117+
- uses: actions/checkout@v4
118+
- uses: actions/setup-java@v4
119+
with:
120+
java-version: '17'
121+
distribution: 'temurin'
122+
- name: Setup Gradle
123+
uses: gradle/actions/setup-gradle@v4
124+
- uses: actions/download-artifact@v4
125+
with:
126+
name: Jars
127+
- name: Install semantic-release
128+
run: |
129+
npm i -g \
130+
semantic-release \
131+
@semantic-release/exec \
132+
@semantic-release/git \
133+
@semantic-release/changelog \
134+
@google/semantic-release-replace-plugin
135+
- name: Run semantic-release
136+
env:
137+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_signingKey }}
139+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingPassword }}
140+
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_ossrhUsername }}
141+
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_ossrhPassword }}
142+
run: semantic-release

.github/workflows/build.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)