From e9ff834fc9be1eb906cd2ff2549cc2308d6ecbd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tau=20G=C3=A4rtli?= Date: Fri, 27 Sep 2024 14:17:08 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Run=20package=20tests=20in=20a?= =?UTF-8?q?=20temporary=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 10 +++------- Justfile | 10 ++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 Justfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8564e58..927d6cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,12 +77,8 @@ jobs: test_package: name: Test Package runs-on: ubuntu-latest - strategy: - matrix: - package: [terminal-colorsaurus, termtheme] steps: - uses: actions/checkout@v4 - - name: Package - run: cargo package -p ${{matrix.package}} - - name: Test Package - run: (cd target/package/${{matrix.package}}-*/ && cargo test) + - run: sudo apt-get install just + - run: just test-package terminal-colorsaurus + - run: just test-package termtheme diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..ee686be --- /dev/null +++ b/Justfile @@ -0,0 +1,10 @@ +default: + just --list + +test-package name *args: + #!/usr/bin/env bash + set -euxo pipefail + CARGO_TARGET_DIR=$(mktemp -d); export CARGO_TARGET_DIR + trap 'rm -rf "$CARGO_TARGET_DIR"' EXIT + cargo package -p "{{name}}" {{args}} + (cd $CARGO_TARGET_DIR/package/{{name}}-*/ && cargo test)