Skip to content

Commit

Permalink
Fix testing and automation workflow
Browse files Browse the repository at this point in the history
This makes the test work locally without needing to set `DYLAN_CATALOG=.` when
executing the tests (which is easy to forget).

Also use the latest published versions of dylan-tool and testworks as dev
dependencies.
  • Loading branch information
cgay committed Mar 6, 2024
1 parent a8f906d commit c1787d7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,30 @@ on:
# This enables the Run Workflow button on the Actions tab.
workflow_dispatch:

# We use dylan-tool here so that the library will be tested with the package
# deps specified in pkg.json.

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:

- uses: dylan-lang/install-dylan-tool@v1

- name: Create workspace
run: |
./dylan new workspace pc
- name: Checkout pacman-catalog
uses: actions/checkout@v4

- uses: actions/checkout@v2
with:
path: pc/pacman-catalog
- name: Install dylan-tool
uses: dylan-lang/install-dylan-tool@v3

- name: Build pacman-catalog-test-suite
run: |
cd pc
DYLAN_CATALOG=./pacman-catalog ../dylan update
../dylan-compiler -build -jobs 3 pacman-catalog-test-suite
DYLAN_CATALOG=. dylan update
dylan build -a
- name: Run pacman-catalog-test-suite
run: |
cd pc
DYLAN_CATALOG=./pacman-catalog _build/bin/pacman-catalog-test-suite
DYLAN_CATALOG=. _build/bin/pacman-catalog-test-suite --report surefire --report-file _build/pacman-catalog-tests.xml
- name: Publish Test Report
if: success() || failure()
uses: mikepenz/action-junit-report@v4
with:
report_paths: '**/_build/*-tests.xml'
detailed_summary: true
include_passed: true
4 changes: 2 additions & 2 deletions dylan-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"category": "development tools",
"contact": "[email protected]",
"dev-dependencies": [
"dylan-tool@0.6",
"testworks@2.1"
"dylan-tool",
"testworks@3.2"
]
}
4 changes: 3 additions & 1 deletion tests/library.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ Module: dylan-user

define library pacman-catalog-test-suite
use common-dylan;
use dylan-tool-lib,
use dylan-tool,
import: { pacman };
use system;
use testworks;
end;

define module pacman-catalog-test-suite
use common-dylan;
use locators;
use pacman,
import: { catalog, load-all-catalog-packages, validate-catalog };
use testworks;
Expand Down
5 changes: 4 additions & 1 deletion tests/test-suite.dylan
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Module: pacman-catalog-test-suite


define test test-validate-catalog ()
assert-no-errors(validate-catalog(catalog()));
let app-file = as(<file-locator>, application-filename());
let cat-dir = app-file.locator-directory.locator-directory.locator-directory;
assert-no-errors(validate-catalog(catalog(directory: cat-dir)));
let packages = load-all-catalog-packages(catalog());
test-output("loaded %d packages from catalog\n", packages.size);
assert-true(packages.size > 0);
Expand Down

0 comments on commit c1787d7

Please sign in to comment.