From d0108920bd47625068e22143b2c3e7fa3bfbebf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Bispo?= Date: Mon, 11 Nov 2024 15:43:42 +0000 Subject: [PATCH 1/2] Updates junit --- jsAst/build.gradle | 2 +- jsweaver/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jsAst/build.gradle b/jsAst/build.gradle index 5b26a66..1ff0e21 100644 --- a/jsAst/build.gradle +++ b/jsAst/build.gradle @@ -17,7 +17,7 @@ repositories { } dependencies { - implementation "junit:junit:4.11" + implementation "junit:junit:4.13.1" implementation ':JsEngine' implementation ':SpecsUtils' diff --git a/jsweaver/build.gradle b/jsweaver/build.gradle index 40db5ea..bcd91e6 100644 --- a/jsweaver/build.gradle +++ b/jsweaver/build.gradle @@ -23,7 +23,7 @@ repositories { mavenCentral() } dependencies { - implementation "junit:junit:4.11" + implementation "junit:junit:4.13.1" implementation ':jOptions' From 7101076eb7d049f2678d69982c371ffe3211f849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Bispo?= Date: Tue, 31 Dec 2024 11:47:28 +0000 Subject: [PATCH 2/2] Replaces main and staging workflow with a nightly workflow --- .github/workflows/ant-main.yml | 65 ----------- .github/workflows/ant-staging.yml | 65 ----------- .github/workflows/nightly.yml | 176 ++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 130 deletions(-) delete mode 100644 .github/workflows/ant-main.yml delete mode 100644 .github/workflows/ant-staging.yml create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/ant-main.yml b/.github/workflows/ant-main.yml deleted file mode 100644 index d0635ba..0000000 --- a/.github/workflows/ant-main.yml +++ /dev/null @@ -1,65 +0,0 @@ -# This workflow will build a Java project with Ant -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant - -name: Java CI - Main - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - - # Daily at midnight - schedule: - - cron: '0 0 * * *' - -permissions: - checks: write - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - # Because of scheduled runs, by default run on default branch - with: - ref: master - path: workspace/jsweaver - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - - name: Check out specs-java-libs repo - uses: actions/checkout@v4 - with: - repository: specs-feup/specs-java-libs - path: workspace/specs-java-libs - - - name: Check out lara-framework repo - uses: actions/checkout@v4 - with: - repository: specs-feup/lara-framework - ref: feature/lara-js - path: workspace/lara-framework - - # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. - # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md - - name: Setup Gradle - uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 - - # Setting up gradle multi-project would be helpful - - name: Build and Test Jackdaw - working-directory: workspace/jsweaver/jsweaver - run: gradle build test - - - name: Publish Test Report - uses: mikepenz/action-junit-report@v4 - if: always() - with: - report_paths: 'workspace/jsweaver/**/build/test-results/test/TEST-*.xml' - summary: true diff --git a/.github/workflows/ant-staging.yml b/.github/workflows/ant-staging.yml deleted file mode 100644 index 0e6989f..0000000 --- a/.github/workflows/ant-staging.yml +++ /dev/null @@ -1,65 +0,0 @@ -# This workflow will build a Java project with Ant -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant - -name: Java CI - Staging - -on: - push: - branches: [ staging ] - pull_request: - branches: [ staging ] - - # Daily at midnight - schedule: - - cron: '0 0 * * *' - -permissions: - checks: write - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - # Because of scheduled runs, by default run on default branch - with: - ref: staging - path: workspace/jsweaver - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - - name: Check out specs-java-libs repo - uses: actions/checkout@v4 - with: - repository: specs-feup/specs-java-libs - path: workspace/specs-java-libs - - - name: Check out lara-framework repo - uses: actions/checkout@v4 - with: - repository: specs-feup/lara-framework - ref: feature/lara-js - path: workspace/lara-framework - - # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. - # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md - - name: Setup Gradle - uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 - - # Setting up gradle multi-project would be helpful - - name: Build and Test Jackdaw - working-directory: workspace/jsweaver/jsweaver - run: gradle build test - - - name: Publish Test Report - uses: mikepenz/action-junit-report@v4 - if: always() - with: - report_paths: 'workspace/jsweaver/**/build/test-results/test/TEST-*.xml' - summary: true diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..e797934 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,176 @@ +# This workflow will build a the whole project every day at midnight +# It will build the Java part and the JS part +# Every push to a branch will trigger the build +# Every pull request will trigger the build + +name: nightly + +on: + push: + pull_request: + + # Daily at midnight + schedule: + - cron: '0 0 * * *' + +permissions: + checks: write + contents: write + +env: + JAVA_VERSION: 17 + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + # Setting default branch to staging assuming PRs will be done against the staging versions of the repository + # main versions will just receive what comes from the staging + DEFAULT_BRANCH: ${{ github.base_ref || 'staging' }} + #SPECS_JAVA_LIBS_BRANCH: ${{ 'master' }} + #LARA_FRAMEWORK_BRANCH: ${{ github.head_ref || github.ref_name }} + +jobs: + build-java: + name: Build Java + runs-on: ubuntu-latest + + outputs: + branch-exists-lara-framework: ${{ steps.Branch-lara-framework.outputs.value }} + branch-exists-specs-java-libs: ${{ steps.Branch-specs-java-libs.outputs.value }} + + steps: + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ env.JAVA_VERSION }} + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: current + dependency-graph: generate-and-submit + + - name: Checkout JsWeaver + uses: actions/checkout@v4 + with: + path: jsweaver + + - name: Check if branch exists on lara-framework + id: Branch-lara-framework + run: echo "value=$(git ls-remote --heads https://github.com/specs-feup/lara-framework.git refs/heads/${{ env.BRANCH_NAME }} | wc -l)" >> $GITHUB_OUTPUT + + - name: Check if branch exists on specs-java-libs + id: Branch-specs-java-libs + run: echo "value=$(git ls-remote --heads https://github.com/specs-feup/specs-java-libs.git refs/heads/${{ env.BRANCH_NAME }} | wc -l)" >> $GITHUB_OUTPUT + + - name: Echo checks + run: | + echo "Branch-lara-framework: ${{ steps.Branch-lara-framework.outputs.value }}" + echo "Branch-specs-java-libs: ${{ steps.Branch-specs-java-libs.outputs.value }}" + echo "Branch name: ${{ env.BRANCH_NAME }}" + echo "Default branch: ${{ env.DEFAULT_BRANCH }}" + echo "Branch base_ref: ${{ github.base_ref }}" + + - name: Checkout lara-framework + uses: actions/checkout@v4 + with: + repository: specs-feup/lara-framework + path: lara-framework + ref: ${{ steps.Branch-lara-framework.outputs.value == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }} + + - name: Checkout specs-java-libs + uses: actions/checkout@v4 + with: + repository: specs-feup/specs-java-libs + path: specs-java-libs + # This is causing problems in PRs, for now it will always be the default branch + #ref: ${{ steps.Branch-specs-java-libs.outputs.value == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }} + + - name: Build with Gradle + run: | + cd jsweaver/jsweaver + gradle installDist + + - name: Test with Gradle + run: | + cd jsweaver/jsweaver + gradle test + env: + GITHUB_DEPENDENCY_GRAPH_ENABLED: false + + - name: Publish Test Report + uses: mikepenz/action-junit-report@v4 + if: always() + with: + report_paths: './**/build/test-results/test/TEST-*.xml' + summary: true + + - name: Upload JsWeaver artifacts + uses: actions/upload-artifact@v4 + with: + name: java-binaries + path: jsweaver/jsweaver/build/install/jsweaver + + +# Uncomment after adding jsweaver-JS +# build-js: +# name: Build JS +# needs: build-java +# strategy: +# fail-fast: false +# matrix: +# #node-version: ['latest', '20.x', '18.x'] +# node-version: ['20.x', '18.x'] +# os: [ubuntu-latest, windows-latest, macos-latest] +# +# runs-on: ${{ matrix.os }} +# +# steps: +# - name: Setup Java +# uses: actions/setup-java@v4 +# with: +# distribution: 'temurin' +# java-version: ${{ env.JAVA_VERSION }} +# +# - name: Setup Node.js +# uses: actions/setup-node@v4 +# with: +# node-version: ${{ matrix.node-version }} +# +# - name: Checkout jsweaver +# uses: actions/checkout@v4 +# with: +# path: jsweaver +# +# - name: Checkout lara-framework +# uses: actions/checkout@v4 +# with: +# repository: specs-feup/lara-framework +# path: lara-framework +# ref: ${{ needs.build-java.outputs.branch-exists-lara-framework == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }} +# +# - name: Setup js workspace +# run: | +# echo '{ "name": "SPeCS Workspace", "type": "module", "workspaces": [ "jsweaver/jsweaver-JS", "lara-framework/Lara-JS" ] }' > package.json +# npm install +# +# - name: Build Lara-JS +# run: | +# cd lara-framework/Lara-JS +# npm run build +# +# - name: Build jsweaver-JS +# run: | +# cd jsweaver/jsweaver-JS +# npm run build +# +# - name: Pull java-binaries +# uses: actions/download-artifact@v4 +# with: +# name: java-binaries +# path: jsweaver/jsweaver-JS/java-binaries +# +# # TODO: Uncomment this after adding tests to the flow +# #- name: Test JS +# # run: | +# # cd jsweaver/jsweaver-JS +# # npm run test +# \ No newline at end of file