Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Soot wrapper build job #203

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ jobs:
with:
tag_name: ${{ github.ref_name }}
files: |
soot-wrapper-11.jar
soot-wrapper-17.jar
soot-wrapper-21.jar
/home/runner/work/cli/cli/soot-wrapper-11.jar
/home/runner/work/cli/cli/soot-wrapper-17.jar
/home/runner/work/cli/cli/soot-wrapper-21.jar

aur:
runs-on: ubuntu-latest
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/soot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
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')
echo ${TAG}
curl -LJO https://github.com/${{ github.repository }}/releases/download/${TAG}/soot-wrapper-${{ matrix.java-version }}.jar
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- 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
run: |
echo ${{ steps.calc-checksum.outputs.hash }} > soot-wrapper-rev-hash.txt

- name: Upload file containing 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: |
ls -la
pwd
Loading