Skip to content
Merged
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
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
push:
branches: [main]

jobs:
release:
name: Bump version and release
runs-on: self-hosted
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # necesario para leer tags y changelog
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests before release
run: wolframscript -file tests/RunAllTests.wl

- name: Read current version
id: version
run: |
VERSION=$(cat QMB/version.txt | tr -d '[:space:]')
echo "current=$VERSION" >> $GITHUB_OUTPUT

- name: Bump patch version
id: bump
run: |
VERSION=${{ steps.version.outputs.current }}
MAJOR=$(echo $VERSION | cut -d. -f1)
MINOR=$(echo $VERSION | cut -d. -f2)
PATCH=$(echo $VERSION | cut -d. -f3)
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "$NEW_VERSION" > QMB/version.txt
echo "new=$NEW_VERSION" >> $GITHUB_OUTPUT

- name: Update PacletInfo.wl
run: |
sed -i 's/Version -> "[^"]*"/Version -> "${{ steps.bump.outputs.new }}"/' QMB/PacletInfo.wl

- name: Commit version bump
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git add QMB/version.txt QMB/PacletInfo.wl
git commit -m "chore: bump version to ${{ steps.bump.outputs.new }}"
git push

- name: Create tag
run: |
git tag v${{ steps.bump.outputs.new }}
git push origin v${{ steps.bump.outputs.new }}

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.bump.outputs.new }}
generate_release_notes: true
18 changes: 18 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Run Tests

on:
push:
branches: [develop, main]
pull_request:
branches: [develop, main]

jobs:
test:
name: Run Tests
runs-on: self-hosted
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Run test suite
run: wolframscript -file tests/RunAllTests.wl
6 changes: 3 additions & 3 deletions QMB/Tests/InitTests.wl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ VerifyTest[
data = Import[PacletPath];
Version /. List @@ data
],
"2.4.1",
"2.4.2",
"Local version reads correctly from PacletInfo.wl"
]

Expand Down Expand Up @@ -93,13 +93,13 @@ TestSection["Step 4 \[LongDash] Version comparison"]

Print[" Checking =!= detects mismatch..."];
VerifyProperty[
("2.4.1" =!= "2.4.0"),
("2.4.2" =!= "2.4.0"),
"=!= correctly detects version mismatch"
]

Print[" Checking =!= detects match..."];
VerifyProperty[
!("2.4.1" =!= "2.4.1"),
!("2.4.2" =!= "2.4.2"),
"=!= correctly detects matching versions"
]

Expand Down
1 change: 0 additions & 1 deletion QMB/prueba.txt

This file was deleted.

43 changes: 43 additions & 0 deletions tests/RunAllTests.wl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
(* ::Package:: *)

(* ============================================================
RunAllTests.wl
Discovers and runs all *Tests.wl files in the repo.
Usage: wolframscript -file tests/RunAllTests.wl
============================================================ *)

Get[FileNameJoin[{DirectoryName[$InputFileName],
"..", "QMB", "Tests", "TestUtils.wl"}]]

Print["============================================================"];
Print["libs Test Suite"];
Print["============================================================"];

(* Busca todos los *Tests.wl en el repo, excluyendo TestUtils.wl *)
testFiles = Select[
FileNames[
"*Tests.wl",
DirectoryName[DirectoryName[$InputFileName]],
Infinity
],
!StringContainsQ[#, "TestUtils"] &&
!StringContainsQ[#, "RunAllTests"] &
];

If[Length[testFiles] === 0,
Print["No test files found."];
Quit[]
];

Print["Found ", Length[testFiles], " test file(s):"];
Scan[Print[" ", FileNameTake[#]] &, testFiles];

Scan[
Function[file,
Print["\n>>> Running: ", FileNameTake[file]];
Get[file]
],
testFiles
];

PrintTestSummary[]
Loading