Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ant-lara-2.0-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Generate build.xml
run: |
wget -q -N http://specs.fe.up.pt/tools/eclipse-build.jar
java -jar eclipse-build.jar https://github.com/specs-feup/specs-java-libs https://github.com/specs-feup/lara-framework?commit=lara-2.0-legacy ./
java -jar eclipse-build.jar https://github.com/specs-feup/specs-java-libs?commit=lara-2.0-legacy https://github.com/specs-feup/lara-framework?commit=lara-2.0-legacy ./
wget -N -O /usr/share/ant/lib/ivy-2.5.0.jar specs.fe.up.pt/libs/ivy-2.5.0.jar
- name: Build with Ant
run: |
Expand Down
96 changes: 43 additions & 53 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
on:
workflow_dispatch:
push:
branches: [master, staging]
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
Expand Down Expand Up @@ -46,74 +47,63 @@
uses: actions/checkout@v6
with:
path: clava
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.BRANCH_NAME }}
BASE_BRANCH: ${{ github.base_ref }}
run: |
set -euo pipefail

# For each dependency repository, determine which branch to checkout.
# Priority order:
# 1. A branch with the same name as the current branch
# 2. If this is a PR, the target branch (base_ref)
# 3. The default branch of the repository

determine_ref() {
local prefix=$1
local repo=$2
local url="https://github.com/${repo}.git"

# Get the default branch
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}'"

local ref_to_use=""

# Priority 1: Same branch name
if [ -n "$(git ls-remote --heads "$url" "refs/heads/${BRANCH_NAME}")" ]; then
ref_to_use="${BRANCH_NAME}"
echo "Using matching branch '${BRANCH_NAME}' in ${repo}"
# Priority 2: PR target branch (if this is a PR)
elif [ -n "${BASE_BRANCH}" ] && [ -n "$(git ls-remote --heads "$url" "refs/heads/${BASE_BRANCH}")" ]; then
ref_to_use="${BASE_BRANCH}"
echo "Using PR target branch '${BASE_BRANCH}' in ${repo}"
# Priority 3: Default branch
else
ref_to_use="${default_branch}"
echo "Using default branch '${default_branch}' for ${repo}"
fi

echo "${prefix}_ref=${ref_to_use}" >> "$GITHUB_OUTPUT"
}

determine_ref "lara" "specs-feup/lara-framework"
determine_ref "specs" "specs-feup/specs-java-libs"
uses: specs-feup/branch-resolver@v1

Check failure on line 54 in .github/workflows/copilot-setup-steps.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use full commit SHA hash for this dependency.

See more on https://sonarcloud.io/project/issues?id=specs-feup_clava&issues=AaBliJUlcPDvgycsdwjR&open=AaBliJUlcPDvgycsdwjR&pullRequest=252
with:
source-directory: clava
dependencies: |
lara specs-feup/lara-framework
specs specs-feup/specs-java-libs

- name: Echo checks
run: |
echo "Weaver branch: ${{ env.BRANCH_NAME }}"
echo "PR target branch (if any): ${{ github.base_ref }}"
echo "Lara framework ref: ${{ steps.repo-refs.outputs.lara_ref }}"
echo "Lara framework default: ${{ steps.repo-refs.outputs.lara_default }}"
echo "Specs-java-libs ref: ${{ steps.repo-refs.outputs.specs_ref }}"
echo "Specs-java-libs default: ${{ steps.repo-refs.outputs.specs_default }}"
echo "Lara framework branch: ${{ env.lara_branch }}"
echo "Lara framework commit: ${{ env.lara_ref }}"
echo "Lara framework default: ${{ env.lara_default }}"
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 lara-framework
uses: actions/checkout@v6
with:
repository: specs-feup/lara-framework
path: lara-framework
ref: ${{ steps.repo-refs.outputs.lara_ref }}
ref: ${{ env.lara_ref }}

- name: Checkout specs-java-libs
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 }}

- name: Build Weaver
run: |
cd clava/ClavaWeaver
gradle installDist

- name: Setup java-binaries symlink
run: |
cd clava/Clava-JS
ln -s ../ClavaWeaver/build/install/ClavaWeaver/ java-binaries


- name: Setup JS workspace
run: |
echo '{ "name": "SPeCS Workspace", "type": "module", "workspaces": [ "clava/Clava-JS", "lara-framework/Lara-JS" ] }' > package.json
npm install

Comment thread
lm-sousa marked this conversation as resolved.
- name: Build Lara-JS
run: |
cd lara-framework/Lara-JS
npm run build

- name: Build Clava-JS
run: |
cd clava/Clava-JS
npm run build
105 changes: 30 additions & 75 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# 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:

# Daily at midnight
Expand All @@ -23,11 +25,14 @@
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:
lara_ref: ${{ steps.repo-refs.outputs.lara_ref }}
specs_ref: ${{ steps.repo-refs.outputs.specs_ref }}
lara_ref: ${{ env.lara_ref }}
specs_ref: ${{ env.specs_ref }}
Comment thread
lm-sousa marked this conversation as resolved.

steps:
- name: Setup Java
Expand All @@ -46,77 +51,39 @@
uses: actions/checkout@v6
with:
path: clava
fetch-depth: 0

- name: Determine repository refs
id: repo-refs
shell: bash
env:
BRANCH_NAME: ${{ env.BRANCH_NAME }}
BASE_BRANCH: ${{ github.base_ref }}
run: |
set -euo pipefail

# For each dependency repository, determine which branch to checkout.
# Priority order:
# 1. A branch with the same name as the current branch
# 2. If this is a PR, the target branch (base_ref)
# 3. The default branch of the repository

determine_ref() {
local prefix=$1
local repo=$2
local url="https://github.com/${repo}.git"

# Get the default branch
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}'"

local ref_to_use=""

# Priority 1: Same branch name
if [ -n "$(git ls-remote --heads "$url" "refs/heads/${BRANCH_NAME}")" ]; then
ref_to_use="${BRANCH_NAME}"
echo "Using matching branch '${BRANCH_NAME}' in ${repo}"
# Priority 2: PR target branch (if this is a PR)
elif [ -n "${BASE_BRANCH}" ] && [ -n "$(git ls-remote --heads "$url" "refs/heads/${BASE_BRANCH}")" ]; then
ref_to_use="${BASE_BRANCH}"
echo "Using PR target branch '${BASE_BRANCH}' in ${repo}"
# Priority 3: Default branch
else
ref_to_use="${default_branch}"
echo "Using default branch '${default_branch}' for ${repo}"
fi

echo "${prefix}_ref=${ref_to_use}" >> "$GITHUB_OUTPUT"
}

determine_ref "lara" "specs-feup/lara-framework"
determine_ref "specs" "specs-feup/specs-java-libs"
uses: specs-feup/branch-resolver@v1

Check failure on line 57 in .github/workflows/nightly.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use full commit SHA hash for this dependency.

See more on https://sonarcloud.io/project/issues?id=specs-feup_clava&issues=AaBliJTUcPDvgycsdwjQ&open=AaBliJTUcPDvgycsdwjQ&pullRequest=252
with:
source-directory: clava
dependencies: |
lara specs-feup/lara-framework
specs specs-feup/specs-java-libs

- name: Echo checks
run: |
echo "Weaver branch: ${{ env.BRANCH_NAME }}"
echo "PR target branch (if any): ${{ github.base_ref }}"
echo "Lara framework ref: ${{ steps.repo-refs.outputs.lara_ref }}"
echo "Lara framework default: ${{ steps.repo-refs.outputs.lara_default }}"
echo "Specs-java-libs ref: ${{ steps.repo-refs.outputs.specs_ref }}"
echo "Specs-java-libs default: ${{ steps.repo-refs.outputs.specs_default }}"
echo "Lara framework branch: ${{ env.lara_branch }}"
echo "Lara framework commit: ${{ env.lara_ref }}"
echo "Lara framework default: ${{ env.lara_default }}"
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 lara-framework
uses: actions/checkout@v6
with:
repository: specs-feup/lara-framework
path: lara-framework
ref: ${{ steps.repo-refs.outputs.lara_ref }}
ref: ${{ env.lara_ref }}

- name: Checkout specs-java-libs
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 }}

- name: Build with Gradle
run: |
Expand Down Expand Up @@ -156,7 +123,7 @@
fail-fast: false
matrix:
#node-version: ['latest', '22.x', '20.x']
node-version: ['22.x', '20.x']
node-version: ['25.x', '24.x']
Comment thread
lm-sousa marked this conversation as resolved.
os: [ubuntu-latest, windows-latest, macos-latest]
Comment thread
lm-sousa marked this conversation as resolved.

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -197,7 +164,7 @@

- name: Setup js workspace
run: |
echo '{ "name": "SPeCS Workspace", "type": "module", "workspaces": [ "clava/Clava-JS", "lara-framework/Lara-JS" ] }' > package.json
echo '{ "name": "SPeCS Workspace", "type": "module", "workspaces": [ "clava/Clava-JS", "lara-framework/Lara-JS" ], "overrides": { "node-gyp": "^12.1.0" } }' > package.json
npm install

- name: Build Lara-JS
Expand All @@ -223,26 +190,14 @@

# 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'
Comment thread
lm-sousa marked this conversation as resolved.
run: |
cd clava/Clava-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 }}
2 changes: 1 addition & 1 deletion Clava-JS/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@specs-feup/clava",
"version": "3.5.0",
"version": "3.5.1",
"description": "A C/C++ source-to-source compiler written in Typescript",
"type": "module",
"files": [
Expand Down
Loading