From c1e8aea5f304a8720ceafb8537c93fd52511c8a6 Mon Sep 17 00:00:00 2001 From: Carl Gay Date: Wed, 21 Feb 2024 13:36:44 -0500 Subject: [PATCH] Fix testing and automation workflow 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. --- .github/workflows/build-and-test.yml | 32 +++++++++++++++++----------- dylan-package.json | 4 ++-- tests/library.dylan | 4 +++- tests/test-suite.dylan | 5 ++++- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 96bb534..5365a16 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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 diff --git a/dylan-package.json b/dylan-package.json index 82f2466..f7ff120 100644 --- a/dylan-package.json +++ b/dylan-package.json @@ -9,7 +9,7 @@ "category": "development tools", "contact": "dylan-lang@googlegroups.com", "dev-dependencies": [ - "dylan-tool@0.6", - "testworks@2.1" + "dylan-tool", + "testworks@3.2" ] } diff --git a/tests/library.dylan b/tests/library.dylan index f7646a5..28bb23f 100644 --- a/tests/library.dylan +++ b/tests/library.dylan @@ -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; diff --git a/tests/test-suite.dylan b/tests/test-suite.dylan index c8cd1ae..1d638f7 100644 --- a/tests/test-suite.dylan +++ b/tests/test-suite.dylan @@ -1,7 +1,10 @@ Module: pacman-catalog-test-suite + define test test-validate-catalog () - assert-no-errors(validate-catalog(catalog())); + let app-file = as(, 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);