Skip to content

Commit

Permalink
Test example code from readme in CI
Browse files Browse the repository at this point in the history
To make sure that our example code actually works, this patch adds a CI
job that extracts the code and tries to run it.
  • Loading branch information
robin-nitrokey committed Jul 30, 2024
1 parent daf92b9 commit 5e2f766
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,22 @@ jobs:
run: ./venv/bin/pip install .
- name: Run test suite
run: ./venv/bin/python -m unittest -v
test-readme:
name: Run example code from readme
runs-on: ubuntu-latest
container: python:3.9-slim
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install required packages
run: apt update && apt install -y ${REQUIRED_PACKAGES} cargo
- name: Checkout tangler
run: git clone https://github.com/wiktor-k/tangler.git --branch v0.3.0 --depth 1
- name: Install Poetry
run: pip install poetry
- name: Create virtual environment
run: make install
- name: Extract code from readme
run: cargo run --manifest-path tangler/Cargo.toml --locked python < README.md > readme.py
- name: Run code from readme
run: poetry run readme.py

0 comments on commit 5e2f766

Please sign in to comment.