♾️ ZUnit #265
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "♾️ ZUnit" | |
on: | |
workflow_call: | |
push: | |
branches: [main] | |
paths: | |
- "**/*.zunit" | |
schedule: | |
- cron: "0 12 * * 1/2" | |
workflow_dispatch: | |
env: | |
zi_branch: main | |
jobs: | |
zunit-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Set matrix output" | |
id: set-matrix | |
run: | | |
builtin cd docker/tests | |
MATRIX="$(ls -1 *.zunit | sed 's/.zunit$//' | jq -ncR '{"include": [{"file": inputs}]}')" | |
echo "MATRIX=${MATRIX}" >&2 | |
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT | |
zunit: | |
runs-on: ubuntu-latest | |
needs: zunit-matrix | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.zunit-matrix.outputs.matrix) }} | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v4 | |
- run: command git clone --branch ${{ env.zi_branch }} --depth 1 -- https://github.com/z-shell/zi.git zi | |
- name: "⚡ Install dependencies" | |
run: | | |
sudo apt-get update && sudo apt-get install -yq zsh | |
mkdir bin | |
curl -fsSL https://raw.githubusercontent.com/zdharma/revolver/v0.2.4/revolver > bin/revolver | |
curl -fsSL https://raw.githubusercontent.com/zdharma/color/d8f91ab5fcfceb623ae45d3333ad0e543775549c/color.zsh > bin/color | |
git clone https://github.com/zdharma/zunit.git zunit.git | |
cd zunit.git | |
./build.zsh | |
cd .. | |
mv ./zunit.git/zunit bin | |
chmod u+x bin/{color,revolver,zunit} | |
- name: "⚡ ZUnit: ${{ matrix.file }}" | |
env: | |
ZUNIT_TEST: ${{ matrix.file }} | |
run: | | |
echo "⚡ $ZUNIT_TEST" >&2 | |
export PATH="$PWD/bin:$PATH" | |
export TERM=xterm | |
zunit --tap --verbose "docker/tests/${ZUNIT_TEST}.zunit" |