|
| 1 | +name:test-alpine |
| 2 | + |
| 3 | +on:[push, pull_request, workflow_dispatch] |
| 4 | + |
| 5 | +jobs: |
| 6 | +build: |
| 7 | +runs-on:ubuntu-latest |
| 8 | + |
| 9 | +container: |
| 10 | +image:alpine:latest |
| 11 | + |
| 12 | +defaults: |
| 13 | +run: |
| 14 | +shell:sudo -u runner sh -exo pipefail {0} |
| 15 | + |
| 16 | +steps: |
| 17 | + -name:Prepare Alpine Linux |
| 18 | +run:| |
| 19 | + apk add sudo git git-daemon python3 py3-pip |
| 20 | + echo 'Defaults env_keep += "CI GITHUB_* RUNNER_*"' >/etc/sudoers.d/ci_env |
| 21 | + addgroup -g 127 docker |
| 22 | + adduser -D -u 1001 runner |
| 23 | + adduser runner docker |
| 24 | +shell:sh -exo pipefail {0}# Run this as root, not the "runner" user. |
| 25 | + |
| 26 | + -uses:actions/checkout@v4 |
| 27 | +with: |
| 28 | +fetch-depth:0 |
| 29 | + |
| 30 | + -name:Set workspace ownership |
| 31 | +run:| |
| 32 | + chown -R runner:docker -- "$GITHUB_WORKSPACE" |
| 33 | +shell:sh -exo pipefail {0}# Run this as root, not the "runner" user. |
| 34 | + |
| 35 | + -name:Prepare this repo for tests |
| 36 | +run:| |
| 37 | + ./init-tests-after-clone.sh |
| 38 | +
|
| 39 | + -name:Set git user identity and command aliases for the tests |
| 40 | +run:| |
| 41 | + git config --global user.email "travis@ci.com" |
| 42 | + git config --global user.name "Travis Runner" |
| 43 | + # If we rewrite the user's config by accident, we will mess it up |
| 44 | + # and cause subsequent tests to fail |
| 45 | + cat test/fixtures/.gitconfig >> ~/.gitconfig |
| 46 | +
|
| 47 | + -name:Set up virtualenv |
| 48 | +run:| |
| 49 | + python -m venv .venv |
| 50 | + . .venv/bin/activate |
| 51 | + printf '%s=%s\n' 'PATH' "$PATH" 'VIRTUAL_ENV' "$VIRTUAL_ENV" >>"$GITHUB_ENV" |
| 52 | +
|
| 53 | + -name:Update PyPA packages |
| 54 | +run:| |
| 55 | + # Get the latest pip, wheel, and prior to Python 3.12, setuptools. |
| 56 | + python -m pip install -U pip $(pip freeze --all | grep -ow ^setuptools) wheel |
| 57 | +
|
| 58 | + -name:Install project and test dependencies |
| 59 | +run:| |
| 60 | + pip install ".[test]" |
| 61 | +
|
| 62 | + -name:Show version and platform information |
| 63 | +run:| |
| 64 | + uname -a |
| 65 | + command -v git python |
| 66 | + git version |
| 67 | + python --version |
| 68 | + python -c 'import os, sys; print(f"sys.platform={sys.platform!r}, os.name={os.name!r}")' |
| 69 | +
|
| 70 | + -name:Test with pytest |
| 71 | +run:| |
| 72 | + pytest --color=yes -p no:sugar --instafail -vv |