From 537faa994184ba0d24c631da3ce5403909797002 Mon Sep 17 00:00:00 2001 From: Martin Wittlinger Date: Tue, 11 Jul 2023 17:04:48 +0200 Subject: [PATCH] chore: convert extra checks to github action (#5333) --- .github/workflows/tests.yml | 83 ++++++++++++++++++++++++++-- chore/ci-extra.sh | 106 ------------------------------------ 2 files changed, 79 insertions(+), 110 deletions(-) delete mode 100755 chore/ci-extra.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6646cd0f3d3..aca6882f2a6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -121,7 +121,6 @@ jobs: - uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1 with: python-version: 3.11 - - name: Get date for cache # see https://github.com/actions/cache README id: get-date run: echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT @@ -132,11 +131,87 @@ jobs: path: ~/.m2/repository key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-maven- - - name: Use silent log config run: mv chore/logback.xml src/test/resources/ - - name: Run extra checks - run: ./chore/ci-extra.sh + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + fetch-depth: 0 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y python3-pip + pip3 install --user CommonMark==0.9.1 requests pygithub + + - name: Verify and Site Maven goals + run: mvn verify license:check site -DskipTests -DadditionalJOption=-Xdoclint:syntax,-missing -Dscan + - name: Install spoon-pom + working-directory: spoon-pom + run: mvn install -DskipTests + + - name: Checkstyle in src/tests + run: mvn -q checkstyle:checkstyle -Pcheckstyle-test + + - name: Check documentation links + run: python3 ./chore/check-links-in-doc.py + + - name: Analyze dependencies through DepClean in spoon-core + run: mvn -q depclean:depclean + + - name: Spoon-decompiler + working-directory: spoon-decompiler + run: | + mvn -q versions:use-latest-versions -DallowSnapshots=true -Dincludes=fr.inria.gforge.spoon + mvn -q versions:update-parent -DallowSnapshots=true + git diff + mvn -q test + mvn -q checkstyle:checkstyle license:check + mvn -q depclean:depclean + + - name: Spoon-control-flow + working-directory: spoon-control-flow + run: | + mvn -q versions:use-latest-versions -DallowSnapshots=true -Dincludes=fr.inria.gforge.spoon + mvn -q versions:update-parent -DallowSnapshots=true + git diff + mvn -q test + mvn -q checkstyle:checkstyle license:check + # spoon dataflow + - name: Cache downloaded file + uses: actions/cache@v2 + with: + path: spoon-dataflow/z3-4.8.4.d6df51951f4c-x64-ubuntu-14.04.zip + key: ${{ runner.os }}-z3-4.8.4.d6df51951f4c-x64-ubuntu-14.04.zip + restore-keys: | + ${{ runner.os }}-z3-4.8.4.d6df51951f4c-x64-ubuntu-14.04.zip + - name: Spoon-dataflow + working-directory: spoon-dataflow + run: | + wget https://projects.ow2.org/download/spoon/WebHome/z3-4.8.4.d6df51951f4c-x64-ubuntu-14.04.zip + unzip z3-4.8.4.d6df51951f4c-x64-ubuntu-14.04.zip + export LD_LIBRARY_PATH=./z3-4.8.4.d6df51951f4c-x64-ubuntu-14.04/bin + ./gradlew build + - name: Spoon-visualisation + working-directory: spoon-visualisation + run: | + mvn -q versions:use-latest-versions -DallowSnapshots=true -Dincludes=fr.inria.gforge.spoon + mvn -q versions:update-parent -DallowSnapshots=true + git diff + mvn -q test + mvn -q depclean:depclean + + - name: Spoon-smpl + working-directory: spoon-smpl + run: | + mvn -q versions:use-latest-versions -DallowSnapshots=true -Dincludes=fr.inria.gforge.spoon + mvn -q versions:update-parent -DallowSnapshots=true + git diff + mvn -q -Djava.src.version=11 test + mvn -q checkstyle:checkstyle license:check + mvn -q depclean:depclean + - name: Trigger extra tasks + if: github.repository == 'INRIA/spoon' && github.event_name == 'pull_request' + run: | + curl https://raw.githubusercontent.com/SpoonLabs/spoon-ci-external/master/spoon-pull-request.sh | bash - name: Run Javadoc quality check run: ./chore/check-javadoc-regressions.py COMPARE_WITH_MASTER reproducible-builds: diff --git a/chore/ci-extra.sh b/chore/ci-extra.sh deleted file mode 100755 index 9f13fc3a1ed..00000000000 --- a/chore/ci-extra.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash - -# This script intends to be run in continuous integration. -# it runs verify and site maven goals -# and to check documentation links -# -# It also run test, verify, checkstyle, and depclean goals on spoon-decompiler - -# fails if anything fails -set -e - -pip install --user CommonMark==0.9.1 requests pygithub - -mvn -version - -# verify includes checkstyle, , outputing the errors in the log of CI -# javadoc check is included in goal "site" -# it's better to have the doclint here because the pom.xml config of javadoc is a nightmare -mvn verify license:check site install -DskipTests -DadditionalJOption=-Xdoclint:syntax,-missing -Dscan - -# checkstyle in src/tests -mvn -q checkstyle:checkstyle -Pcheckstyle-test - -python ./chore/check-links-in-doc.py - -# Analyze the usage of dependencies through DepClean in spoon-core. -# The build fails if DepClean detects at least one unused direct dependency. -mvn -q depclean:depclean - -################################################################## -# Spoon-decompiler -################################################################## -cd spoon-decompiler - -# always depends on the latest snapshot, just installed with "mvn install" above -mvn -q versions:use-latest-versions -DallowSnapshots=true -Dincludes=fr.inria.gforge.spoon -git diff - -mvn -q test -mvn -q checkstyle:checkstyle license:check -mvn -q depclean:depclean - -################################################################## -# Spoon-control-flow -################################################################## -cd ../spoon-control-flow - -# always depends on the latest snapshot, just installed with "mvn install" above -mvn -q versions:use-latest-versions -DallowSnapshots=true -Dincludes=fr.inria.gforge.spoon -git diff - -mvn -q test -mvn -q checkstyle:checkstyle license:check - -################################################################## -# Spoon-dataflow -################################################################## -cd ../spoon-dataflow - -# download and install z3 lib -# the github URL is rate limited, and this results in flaky CI -# wget https://github.com/Z3Prover/z3/releases/download/z3-4.8.4/z3-4.8.4.d6df51951f4c-x64-ubuntu-14.04.zip -# so we have a copy on OW2 -wget https://projects.ow2.org/download/spoon/WebHome/z3-4.8.4.d6df51951f4c-x64-ubuntu-14.04.zip - -unzip z3-4.8.4.d6df51951f4c-x64-ubuntu-14.04.zip -export LD_LIBRARY_PATH=./z3-4.8.4.d6df51951f4c-x64-ubuntu-14.04/bin - -# build and run tests -./gradlew build - - -################################################################## -# Spoon-visualisation -################################################################## -cd ../spoon-visualisation - -# always depends on the latest snapshot, just installed with "mvn install" above -mvn -q versions:use-latest-versions -DallowSnapshots=true -Dincludes=fr.inria.gforge.spoon -git diff - -mvn -q -Djava.src.version=11 test -mvn -q depclean:depclean - -################################################################## -# Spoon-smpl -################################################################## -cd ../spoon-smpl - -# always depends on the latest snapshot, just installed with "mvn install" above -mvn -q versions:use-latest-versions -DallowSnapshots=true -Dincludes=fr.inria.gforge.spoon -git diff - -mvn -q -Djava.src.version=11 test -mvn -q checkstyle:checkstyle license:check -mvn -q depclean:depclean - -################################################################## -## Trigerring extra tasks that we don't want to commit to master -## (For experimental CI features, short lived tasks, etc) - -if [[ "$GITHUB_REPOSITORY" == "INRIA/spoon" ]] && [[ "$GITHUB_EVENT_NAME" == "pull_request" ]] -then - echo "downloading extra CI PR script from SpoonLabs/spoon-ci-external" - curl https://raw.githubusercontent.com/SpoonLabs/spoon-ci-external/master/spoon-pull-request.sh | bash -fi