Skip to content

Commit 564935c

Browse files
committed
Test running tests directly on action runner
To be able to test on different systems.
1 parent d74a41b commit 564935c

File tree

1 file changed

+79
-4
lines changed

1 file changed

+79
-4
lines changed

.github/workflows/test.yml

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,88 @@
11
---
22
name: Tests
3+
34
on: # yamllint disable-line rule:truthy
45
- push
56
- pull_request
67
- workflow_dispatch
8+
9+
env:
10+
SC_VER: "0.9.0"
11+
ESH_VER: "0.3.2"
12+
713
jobs:
814
Tests:
9-
runs-on: ubuntu-latest
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os:
20+
- ubuntu-24.04
21+
- macos-13
22+
python-version:
23+
- "3.11"
1024
steps:
11-
- uses: actions/checkout@v2
12-
- name: Tests
13-
run: make test
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-tags: true
28+
29+
- name: Install dependencies on Linux
30+
if: ${{ runner.os == 'Linux' }}
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y expect lsb-release
34+
- name: Install dependencies on macOS
35+
if: ${{ runner.os == 'macOS' }}
36+
run: |
37+
brew install expect
38+
39+
- name: Prepare tools directory
40+
run: |
41+
mkdir "$RUNNER_TEMP/tools"
42+
echo "$RUNNER_TEMP/tools" >> "$GITHUB_PATH"
43+
44+
- name: Install shellcheck
45+
run: |
46+
if [ "$RUNNER_OS" = "macOS" ]; then
47+
OS=darwin
48+
else
49+
OS=linux
50+
fi
51+
52+
if [ "$RUNNER_ARCH" = "ARM64" ]; then
53+
ARCH=aarch64
54+
else
55+
ARCH=x86_64
56+
fi
57+
58+
cd "$RUNNER_TEMP"
59+
60+
BASE_URL="https://github.com/koalaman/shellcheck/releases/download"
61+
SC="v$SC_VER/shellcheck-v$SC_VER.$OS.$ARCH.tar.xz"
62+
curl -L "$BASE_URL/$SC" | tar Jx shellcheck-v$SC_VER/shellcheck
63+
mv shellcheck-v$SC_VER/shellcheck tools
64+
65+
- name: Install esh
66+
run: |
67+
cd "$RUNNER_TEMP/tools"
68+
curl -L -o esh https://github.com/jirutka/esh/raw/refs/tags/v$ESH_VER/esh
69+
chmod +x esh
70+
71+
- name: Add old yadm versions # to test upgrades
72+
run: |
73+
for version in 1.12.0 2.5.0; do
74+
git cat-file blob $version:yadm > "$RUNNER_TEMP/tools/yadm-$version"
75+
chmod +x "$RUNNER_TEMP/tools/yadm-$version"
76+
done
77+
78+
- name: Set up Python ${{ matrix.python-version }}
79+
uses: actions/setup-python@v5
80+
with:
81+
python-version: ${{ matrix.python-version }}
82+
- name: Install Python dependencies
83+
run: |
84+
python -m pip install --upgrade pip
85+
python -m pip install -r test/requirements.txt
86+
87+
- name: Run tests
88+
run: pytest -v --color=yes

0 commit comments

Comments
 (0)