-
Notifications
You must be signed in to change notification settings - Fork 9
97 lines (83 loc) · 3.15 KB
/
soot.yml
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
name: Release
on:
pull_request:
permissions:
contents: write
jobs:
soot-wrapper-test:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 11, 17, 21 ]
steps:
- uses: actions/checkout@v4
with:
repository: 'debricked/soot-wrapper'
- name: Calculate checksum
id: calc-checksum
run: |
echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
if [ ! -f soot-wrapper-rev-hash.txt ]; then
touch soot-wrapper-rev-hash.txt
fi
echo "prev_hash=$(cat soot-wrapper-rev-hash.txt)" >> $GITHUB_OUTPUT
- name: Pull JAR from previous release if already built
if: steps.calc-checksum.outputs.hash == steps.calc-checksum.outputs.prev_hash
run: |
TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
gh api repos/${{ github.repository }}/releases/tags/$TAG | jq '.assets[] | .name'
gh api repos/${{ github.repository }}/releases/soot-wrapper-${{ matrix.java-version }}.jar \
--raw \
-H 'Accept: application/octet-stream' \
-o soot-wrapper-${{ matrix.java-version }}.jar
- name: Upload JAR from previous release
if: steps.calc-checksum.outputs.hash == steps.calc-checksum.outputs.prev_hash
uses: actions/upload-artifact@v4
with:
name: soot-wrapper-${{ matrix.java-version }}.jar
path: soot-wrapper-${{ matrix.java-version }}.jar
- name: Set up JDK ${{ matrix.java-version }}
if: steps.calc-checksum.outputs.hash != steps.calc-checksum.outputs.prev_hash
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'adopt'
- name: Build with Maven
if: steps.calc-checksum.outputs.hash != steps.calc-checksum.outputs.prev_hash
run: |
cd java/common/
mvn clean package -X -DskipTests
- name: Upload generated JAR
if: steps.calc-checksum.outputs.hash != steps.calc-checksum.outputs.prev_hash
uses: actions/upload-artifact@v4
with:
name: soot-wrapper-${{ matrix.java-version }}.jar
path: java/common/target/*.jar
- name: Store soot-wrapper revision hash
if: steps.calc-checksum.outputs.hash != steps.calc-checksum.outputs.prev_hash
uses: actions/upload-artifact@v4
with:
name: soot-wrapper-rev-hash.txt
path: soot-wrapper-rev-hash.txt
overwrite: 'true'
goreleaser-test:
runs-on: ubuntu-latest
needs: soot-wrapper-test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- name: Download JARs
uses: actions/download-artifact@v4
- name: Ensure files are in place
run: |
if [ -f soot-wrapper-11.jar ]; then
echo "soot-wrapper-11.jar exists"
fi
if [ -f soot-wrapper-17.jar ]; then
echo "soot-wrapper-17.jar exists"
fi
if [ -f soot-wrapper-21.jar ]; then
echo "soot-wrapper-21.jar exists"
fi