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 1, 2024
1 parent fef2722 commit c1e8aea
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,37 @@ 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: Checkout pacman-catalog
uses: actions/checkout@v4

- name: Create workspace
- name: debug A
run: |
./dylan new workspace pc
echo GITHUB_WORKSPACE=${GITHUB_WORKSPACE}
pwd
env | sort
find .. -type d
- uses: actions/checkout@v2
- name: Install dylan-tool
uses: dylan-lang/install-dylan-tool@v2
with:
path: pc/pacman-catalog
tag: v0.11.0

- name: debug B
run: |
find .. -type d
- name: Build pacman-catalog-test-suite
run: |
cd pc
DYLAN_CATALOG=./pacman-catalog ../dylan update
../dylan-compiler -build -jobs 3 pacman-catalog-test-suite
export DYLAN_CATALOG=.
${GITHUB_WORKSPACE}/../dylan update
${GITHUB_WORKSPACE}/../dylan build -a
- name: Run pacman-catalog-test-suite
run: |
cd pc
DYLAN_CATALOG=./pacman-catalog _build/bin/pacman-catalog-test-suite
export DYLAN_CATALOG=.
_build/bin/pacman-catalog-test-suite
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 c1e8aea

Please sign in to comment.