|
1 | 1 | ---
|
2 | 2 | name: Tests
|
| 3 | + |
3 | 4 | on: # yamllint disable-line rule:truthy
|
4 | 5 | - push
|
5 | 6 | - pull_request
|
6 | 7 | - workflow_dispatch
|
| 8 | + |
| 9 | +env: |
| 10 | + SC_VER: "0.9.0" |
| 11 | + ESH_VER: "0.3.2" |
| 12 | + |
7 | 13 | jobs:
|
8 | 14 | 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" |
10 | 24 | 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