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