|
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 | + |
| 27 | + - name: Install dependencies on Linux |
| 28 | + if: ${{ runner.os == 'Linux' }} |
| 29 | + run: | |
| 30 | + sudo apt-get update |
| 31 | + sudo apt-get install -y expect |
| 32 | + - name: Install dependencies on macOS |
| 33 | + if: ${{ runner.os == 'macOS' }} |
| 34 | + run: | |
| 35 | + brew install expect |
| 36 | +
|
| 37 | + - name: Prepare tools directory |
| 38 | + run: | |
| 39 | + mkdir "$RUNNER_TEMP/tools" |
| 40 | + echo "$RUNNER_TEMP/tools" >> "$GITHUB_PATH" |
| 41 | +
|
| 42 | + - name: Install shellcheck |
| 43 | + run: | |
| 44 | + if [ "$RUNNER_OS" = "macOS" ]; then |
| 45 | + OS=darwin |
| 46 | + else |
| 47 | + OS=linux |
| 48 | + fi |
| 49 | +
|
| 50 | + if [ "$RUNNER_ARCH" = "ARM64" ]; then |
| 51 | + ARCH=aarch64 |
| 52 | + else |
| 53 | + ARCH=x86_64 |
| 54 | + fi |
| 55 | +
|
| 56 | + cd "$RUNNER_TEMP" |
| 57 | +
|
| 58 | + BASE_URL="https://github.com/koalaman/shellcheck/releases/download" |
| 59 | + SC="v$SC_VER/shellcheck-v$SC_VER.$OS.$ARCH.tar.xz" |
| 60 | + curl -L "$BASE_URL/$SC" | tar Jx shellcheck-v$SC_VER/shellcheck |
| 61 | + mv shellcheck-v$SC_VER/shellcheck tools |
| 62 | +
|
| 63 | + - name: Install esh |
| 64 | + run: | |
| 65 | + cd "$RUNNER_TEMP/tools" |
| 66 | +
|
| 67 | + BASE_URL="https://github.com/jirutka/esh/raw/refs/tags" |
| 68 | + curl -L -o esh "$BASE_URL/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 fetch origin $version:refs/tags/$version |
| 75 | + git cat-file blob $version:yadm > "$RUNNER_TEMP/tools/yadm-$version" |
| 76 | + chmod +x "$RUNNER_TEMP/tools/yadm-$version" |
| 77 | + done |
| 78 | +
|
| 79 | + - name: Set up Python ${{ matrix.python-version }} |
| 80 | + uses: actions/setup-python@v5 |
| 81 | + with: |
| 82 | + python-version: ${{ matrix.python-version }} |
| 83 | + - name: Install Python dependencies |
| 84 | + run: | |
| 85 | + python -m pip install --upgrade pip |
| 86 | + python -m pip install -r test/requirements.txt |
| 87 | +
|
| 88 | + - name: Run tests |
| 89 | + run: | |
| 90 | + git config --global user.email [email protected] |
| 91 | + git config --global user.name "Yadm Test" |
| 92 | + pytest -v --color=yes |
0 commit comments