tests #5111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow for testing Spoon. | |
# | |
# Note that actions are specified by commit hash. This is to avoid the security | |
# risk of someone injecting malicious code into a release and then simply | |
# changing a tag. | |
name: tests | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: "0 0 * * *" | |
env: | |
JAVA_DISTRIBUTION: temurin | |
MAVEN_OPTS: >- | |
-Dmaven.resolver.transport=native | |
-Daether.connector.connectTimeout=300000 | |
-Daether.connector.requestTimeout=300000 | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
java: [11, 17, 20, 21-ea] | |
os: [ubuntu-latest, windows-latest] | |
exclude: | |
- os: windows-latest | |
java: 17 | |
- os: windows-latest | |
java: 20 | |
- os: windows-latest | |
java: 21-ea | |
name: Tests with Java ${{ matrix.java }} on ${{ matrix.os }} | |
steps: | |
- name: Disable Git's autocrlf | |
run: git config --global core.autocrlf false | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- uses: oracle-actions/setup-java@2c4df2930e35870536667f383d87f1246fbe613f # v1 | |
with: | |
website: jdk.java.net | |
java-version: ${{ matrix.java }} | |
- 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 | |
shell: bash | |
- name: Use Maven dependency cache | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
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: Build | |
run: | | |
mvn -f spoon-pom -B test-compile | |
- name: Fetch final dependencies | |
# this is a hack to download the final test dependencies required to actually run the tests | |
run: timeout 20 mvn -f spoon-pom -B test || echo "Done fetching dependencies" | |
shell: bash | |
- name: Test | |
run: | |
mvn -f spoon-pom test | |
- name: print run tests | |
run: cat testResults.spoon | |
coverage: | |
runs-on: ubuntu-latest | |
name: Test with coverage | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0 | |
with: | |
java-version: 17 | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
- 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 | |
shell: bash | |
- name: Use Maven dependency cache | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
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: Build | |
run: | | |
mvn -f spoon-pom -B test-compile | |
- name: Test with coverage | |
run: mvn -f spoon-pom -Pcoveralls test jacoco:report coveralls:report -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER --fail-never | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ github.event.number }} | |
extra: | |
runs-on: ubuntu-latest | |
name: Extra checks | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0 | |
with: | |
java-version: 11 | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 | |
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 | |
shell: bash | |
- name: Use Maven dependency cache | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
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/ | |
- 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@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3 | |
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: | |
runs-on: ubuntu-latest | |
name: reproducible-builds | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0 | |
with: | |
java-version: 17 | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
- name: Check status | |
run: chore/check-reproducible-builds.sh | |
maven-central-requirements: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
# the pom checker needs maven 3.9.0 | |
- name: Set up Maven | |
uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5 | |
with: | |
maven-version: 3.9.0 | |
# we dont enforce that the version must be non snapshot as this is not possible for SNAPSHOT versions in our workflow. | |
- name: Check maven pom quality | |
run: mvn -f spoon-pom org.kordamp.maven:pomchecker-maven-plugin:1.9.0:check-maven-central -D"checker.release=false" |