Skip to content

Commit 2741624

Browse files
committed
👷 Run package tests in a temporary directory
1 parent ab053b7 commit 2741624

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,10 @@ jobs:
7777
test_package:
7878
name: Test Package
7979
runs-on: ubuntu-latest
80-
strategy:
81-
matrix:
82-
package: [terminal-colorsaurus, termtheme]
8380
steps:
8481
- uses: actions/checkout@v4
85-
- name: Package
86-
run: cargo package -p ${{matrix.package}}
87-
- name: Test Package
88-
run: (cd target/package/${{matrix.package}}-*/ && cargo test)
82+
- uses: taiki-e/install-action@v2
83+
with:
84+
tool: just
85+
- run: just test-package terminal-colorsaurus
86+
- run: just test-package termtheme

Justfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
default:
2+
just --list
3+
4+
test-package name *args:
5+
#!/usr/bin/env bash
6+
set -euxo pipefail
7+
CARGO_TARGET_DIR=$(mktemp -d); export CARGO_TARGET_DIR
8+
trap 'rm -rf "$CARGO_TARGET_DIR"' EXIT
9+
cargo package -p "{{name}}" {{args}}
10+
(cd $CARGO_TARGET_DIR/package/{{name}}-*/ && cargo test)

0 commit comments

Comments
 (0)