Make docopt library version available as a variable for sourcing #102
Workflow file for this run
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: Lint & test | |
on: | |
push: | |
branches: ['*'] | |
tags: | |
- '*' | |
- '!v*' # Don't run on version tags, instead the release workflow will include this file and call the build step | |
workflow_call: {} | |
pull_request: | |
branches: ['*'] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the project | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Cache virtualenv | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv | |
- name: Install dependencies | |
run: .devcontainer/post.sh | |
- name: Lint with shellcheck | |
uses: ludeeus/action-shellcheck@master | |
with: | |
scandir: './docopt_sh' | |
- name: Lint with flake8 | |
run: | | |
# error out if there are Python syntax errors or undefined names | |
.venv/bin/flake8 docopt_sh --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
.venv/bin/flake8 docopt_sh --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
test-python: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.11', '3.12'] | |
steps: | |
- name: Checkout the project | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache virtualenv | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv | |
- name: Install dependencies | |
run: .devcontainer/post.sh | |
- name: Test with pytest | |
run: .venv/bin/pytest | |
test-bash: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# Skip 4.2.53, it errors out on `$(fn)` | |
bash-version: | |
- '3.2' | |
- '3.2.48' | |
- '3.2.57' | |
- '4.0' | |
- '4.1' | |
- '4.2' | |
- '4.3' | |
- '4.3.30' | |
- '4.4' | |
- '5.0' | |
- '5.1' | |
- '5.1.8' | |
- '5.1.12' | |
- '5.1.16' | |
- '5.2' | |
- '5.2.9' | |
- '5.2.15' | |
- '5.2.21' | |
steps: | |
- name: Checkout the project | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: .devcontainer/post.sh | |
- name: Add .venv/bin to path | |
run: printf "$PWD/.venv/bin" >> $GITHUB_PATH | |
- name: Cache bash versions | |
uses: actions/cache@v4 | |
env: | |
cache-name: bash-version | |
with: | |
path: tests/bash-versions/bash-${{ matrix.bash-version }}/bash | |
key: ${{ env.cache-name }}-${{ matrix.bash-version }} | |
- name: Download & compile bash ${{ matrix.bash-version }} | |
run: | |
tests/get_bash.py "${{ matrix.bash-version }}" | |
- name: Test with pytest | |
run: pytest --bash-version "${{ matrix.bash-version }}" |