From 00ba8eefbcc2e2ba8f7e3cbc0fa9ae273388dc65 Mon Sep 17 00:00:00 2001 From: "L. Sousa" Date: Tue, 20 Jan 2026 19:04:06 +0000 Subject: [PATCH 1/3] Bump version to 3.5.1 and update java dependency to ^0.18.0 to support Node.js v24 --- Lara-JS/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lara-JS/package.json b/Lara-JS/package.json index 350d26e2f..3ff4f117e 100644 --- a/Lara-JS/package.json +++ b/Lara-JS/package.json @@ -1,6 +1,6 @@ { "name": "@specs-feup/lara", - "version": "3.5.0", + "version": "3.5.1", "description": "A js port of the popular framework for building source-to-source compilers", "type": "module", "bin": { @@ -64,7 +64,7 @@ "cytoscape": "^3.0.0", "debug": "^4.4.0", "fast-glob": "^3.3.3", - "java": "^0.16.1", + "java": "^0.18.0", "supports-color": "^10.0.0", "yargs": "^17.7.2" }, From 7342d678a0ce4f69b8b50d4521352f327cbf72f7 Mon Sep 17 00:00:00 2001 From: "L. Sousa" Date: Thu, 3 Sep 2026 01:24:05 +0100 Subject: [PATCH 2/3] Add stacked PR resilience to the CI workflow --- .github/workflows/copilot-setup-steps.yml | 55 ++++++------------ .github/workflows/nightly.yml | 68 ++++++++++------------- 2 files changed, 46 insertions(+), 77 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 4b3da327d..806e52a48 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -7,6 +7,7 @@ name: "Copilot Setup Steps" on: workflow_dispatch: push: + branches: [master, staging] paths: - .github/workflows/copilot-setup-steps.yml pull_request: @@ -14,7 +15,7 @@ on: - .github/workflows/copilot-setup-steps.yml env: - LARA_FRAMEWORK_BRANCH: ${{ github.head_ref || github.ref_name }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} jobs: # The job MUST be called `copilot-setup-steps` @@ -41,55 +42,31 @@ jobs: uses: gradle/actions/setup-gradle@v4 with: gradle-version: current - dependency-graph: generate-and-submit - name: Checkout lara-framework - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: lara-framework + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Determine repository refs - id: repo-refs - shell: bash - env: - BRANCH_NAME: ${{ env.LARA_FRAMEWORK_BRANCH }} - run: | - set -euo pipefail - - determine_ref() { - local prefix=$1 - local repo=$2 - local url="https://github.com/${repo}.git" - - local default_branch - default_branch=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ {print $2}' | sed 's@refs/heads/@@') - echo "${prefix}_default=${default_branch}" >> "$GITHUB_OUTPUT" - echo "Default branch for ${repo} is '${default_branch}'" - - if git ls-remote --heads "$url" "refs/heads/${BRANCH_NAME}" >/dev/null; then - echo "${prefix}_match=true" >> "$GITHUB_OUTPUT" - echo "${prefix}_ref=${BRANCH_NAME}" >> "$GITHUB_OUTPUT" - echo "Branch '${BRANCH_NAME}' exists in ${repo}" - else - echo "${prefix}_match=false" >> "$GITHUB_OUTPUT" - echo "${prefix}_ref=${default_branch}" >> "$GITHUB_OUTPUT" - echo "Branch '${BRANCH_NAME}' not found in ${repo}. Falling back to '${default_branch}'." - fi - } - - determine_ref "specs" "specs-feup/specs-java-libs" + uses: specs-feup/branch-resolver@v1 + with: + source-directory: lara-framework + evidence-repositories: specs-feup/clava + dependencies: specs specs-feup/specs-java-libs - name: Echo checks run: | - echo "Lara-Framework branch: ${{ env.LARA_FRAMEWORK_BRANCH }}" - echo "Matching branch found (specs-java-libs): ${{ steps.repo-refs.outputs.specs_match }}" - echo "Specs-java-libs ref: ${{ steps.repo-refs.outputs.specs_ref }}" - echo "Specs-java-libs default fallback: ${{ steps.repo-refs.outputs.specs_default }}" - echo "Pull request base_ref (if any): ${{ github.base_ref }}" + echo "Lara branch: ${{ env.BRANCH_NAME }}" + echo "Specs-java-libs branch: ${{ env.specs_branch }}" + echo "Specs-java-libs commit: ${{ env.specs_ref }}" + echo "Specs-java-libs default: ${{ env.specs_default }}" - name: Checkout specs-java-libs - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: specs-feup/specs-java-libs path: specs-java-libs - ref: ${{ steps.repo-refs.outputs.specs_ref }} + ref: ${{ env.specs_ref }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 631d4093c..503e8fe5f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -7,6 +7,10 @@ name: nightly on: push: + # Feature branches are covered by pull_request; push only builds the + # long-lived branches to avoid duplicate runs when a PR is open. + branches: [master, staging] + pull_request: # Daily at midnight schedule: @@ -19,11 +23,6 @@ permissions: 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: @@ -31,7 +30,7 @@ jobs: runs-on: ubuntu-latest outputs: - branch-exists-specs-java-libs: ${{ steps.Branch-specs-java-libs.outputs.value }} + specs_ref: ${{ env.specs_ref }} steps: - name: Setup Java @@ -47,27 +46,32 @@ jobs: dependency-graph: generate-and-submit - name: Checkout lara-framework - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: lara-framework + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha || github.sha }} - - 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: Determine repository refs + uses: specs-feup/branch-resolver@v1 + with: + source-directory: lara-framework + evidence-repositories: specs-feup/clava + dependencies: specs specs-feup/specs-java-libs - name: Echo checks run: | - 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 }}" + echo "Lara branch: ${{ env.BRANCH_NAME }}" + echo "Specs-java-libs branch: ${{ env.specs_branch }}" + echo "Specs-java-libs commit: ${{ env.specs_ref }}" + echo "Specs-java-libs default: ${{ env.specs_default }}" - name: Checkout specs-java-libs - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: specs-feup/specs-java-libs path: specs-java-libs - ref: ${{ steps.Branch-specs-java-libs.outputs.value == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }} + ref: ${{ env.specs_ref }} # Setting up gradle multi-project would be helpful - name: Build and test LanguageSpecification @@ -126,8 +130,7 @@ jobs: strategy: fail-fast: false matrix: - #node-version: ['latest', '22.x', '20.x'] - node-version: ['22.x', '20.x'] + node-version: ['25.x', '24.x'] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} @@ -146,13 +149,14 @@ jobs: registry-url: 'https://registry.npmjs.org/' - name: Checkout lara-framework - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: lara-framework + ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Setup js workspace run: | - echo '{ "name": "SPeCS Workspace", "type": "module", "workspaces": [ "lara-framework/Lara-JS" ] }' > package.json + echo '{ "name": "SPeCS Workspace", "type": "module", "workspaces": [ "lara-framework/Lara-JS" ], "overrides": { "node-gyp": "^12.1.0" } }' > package.json npm install - name: Build Lara-JS @@ -173,26 +177,14 @@ jobs: # Only on ubuntu-latest - name: Publish JS - if: matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x' + if: github.event_name == 'push' && github.ref == 'refs/heads/staging' && matrix.os == 'ubuntu-latest' && matrix.node-version == '25.x' run: | cd lara-framework/Lara-JS npm whoami echo "Attempt to publish while running on ${{ matrix.os }} and Node.js ${{matrix.node-version}}" - if [[ "${{ github.event_name }}" == "push" ]]; then - if [ "${{ github.ref }}" == "refs/heads/staging" ]; then - echo "Publishing from staging, creating timestamped prerelease and updating tag 'staging'" - TIMESTAMP=$(date +"%Y%m%d%H%M") - npm version prerelease --preid="$TIMESTAMP" - npm publish --tag staging --access public - # Not updating automatically the version since this would make the staging branch diverge from the main branch - #elif [ "${{ github.ref }}" == "refs/heads/master" ]; then - # echo "Publishing from main, assumes version was changed before publishing" - # npm publish - else - echo "Not master or staging branches, not publishing even if it is a push event" - fi - else - echo "Not a push event, skipping publish." - fi + echo "Publishing from staging, creating timestamped prerelease and updating tag 'staging'" + TIMESTAMP=$(date +"%Y%m%d%H%M") + npm version prerelease --preid="$TIMESTAMP" + npm publish --tag staging --access public env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 8ade03c0ac200a30ab52645a99f239694ed557e9 Mon Sep 17 00:00:00 2001 From: "L. Sousa" Date: Thu, 3 Sep 2026 03:16:45 +0100 Subject: [PATCH 3/3] Trigger nightly on branch pushes instead of pull_request GitHub does not fire the pull_request event when the synthetic merge ref cannot be created, which silenced CI for conflicted PRs. The workflow never used the merge ref anyway: branch pushes report the same head-SHA checks to the PR's Checks tab. Skip runs for branch deletions, where the event SHA falls back to the default branch and would mislead the branch resolver. --- .github/workflows/nightly.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 503e8fe5f..663a9d5e5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,16 +1,14 @@ # 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: + # No pull_request trigger: GitHub refuses to build the merge ref for + # conflicted PRs, which would suppress the CI signal entirely. Push runs + # on the branch tip report checks to the PR's Checks tab all the same. push: - # Feature branches are covered by pull_request; push only builds the - # long-lived branches to avoid duplicate runs when a PR is open. - branches: [master, staging] - pull_request: # Daily at midnight schedule: @@ -27,6 +25,9 @@ env: jobs: build-java: name: Build Java + # On branch deletion GitHub reports the default branch's SHA; building + # that event would mislead the branch resolver. + if: github.event.deleted != true runs-on: ubuntu-latest outputs: @@ -50,7 +51,6 @@ jobs: with: path: lara-framework fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Determine repository refs uses: specs-feup/branch-resolver@v1 @@ -152,7 +152,6 @@ jobs: uses: actions/checkout@v6 with: path: lara-framework - ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Setup js workspace run: |