From 71b5e8834253f7f58457c19beefae2ec35d51f0b Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Tue, 30 Jul 2024 10:22:22 +0200 Subject: [PATCH] Test example code from readme in CI To make sure that our example code actually works, this patch adds a CI job that extracts the code and tries to run it. --- .github/workflows/ci.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9b7592e..00fdcbf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 git + - name: Install tangler + run: cargo install tangler@0.3.0 + - name: Install Poetry + run: pip install poetry + - name: Create virtual environment + run: make install + - name: Extract code from readme + run: .cargo/bin/tangler python < README.md > readme.py + - name: Run code from readme + run: poetry run python readme.py