diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..2c6bb93 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,13 @@ +Running with [nektos/act](nektos/act) +===================================== +Requires `HEAD` version of `act` +``` +$ act --version +act version HEAD-4d71071 +``` + +`act -r --artifact-server-path /tmp/ -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-latest` + +Known issues: +- https://github.com/nektos/act/issues/910 +- https://github.com/nektos/act/issues/973 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f96a8de --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,71 @@ +# https://michaelheap.com/dynamic-matrix-generation-github-actions/ + +name: test +on: [push] +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: which node && node --version && env + + - if: ${{ env.ACT }} # act workaround + run: sudo chown -R runner:runner /var/run/act + + - uses: actions/checkout@v2 + + - if: ${{ env.ACT }} # act workaround + run: sudo chown -R runner:runner . + + + - name: Set up JDK 1.8 + uses: actions/setup-java@v2 + with: + java-version: 8 + distribution: adopt + + - if: ${{ !env.ACT }} # use -r with act + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - run: mvn -B clean package -DskipTests + + - uses: actions/upload-artifact@v3 + with: + name: jar + path: target/ysoserial-*-all.jar + + set-matrix: + runs-on: ubuntu-latest + container: dwdraju/alpine-curl-jq + steps: + - id: get-versions + # TODO paging + run: echo "::set-output name=versions::$(curl -s https://hub.docker.com/v2/repositories/vulhub/java/tags/?page_size=100 | jq -rc [.results[].name])" + + outputs: + versions: ${{ steps.get-versions.outputs.versions }} + + run-java: + needs: + - set-matrix + - build + strategy: + matrix: + version: ${{ fromJson(needs.set-matrix.outputs.versions) }} # broken in act +# version: +# - 7u21-jdk +## - 7u25-jdk + runs-on: ubuntu-latest + container: + image: vulhub/java:${{ matrix.version }} + + steps: + - uses: actions/download-artifact@v3 + with: + name: jar + - run: echo ${{ matrix.version }} && java -version && env +