feat: and a pip installation test #89
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: Python build | |
on: [push] | |
env: | |
POETRY_VERSION: 1.7.1 | |
JETBRAINS_MONO_VERSION: 2.304 | |
PYTHON_VERSION: "3.8" | |
jobs: | |
setup: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
name: Setup files on ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache Poetry | |
id: poetry-cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/poetry | |
key: ${{ runner.os }}-poetry-cache-${{ env.POETRY_VERSION }} | |
- name: Install Poetry | |
if: steps.poetry-cache.outputs.cache-hit != 'true' | |
run: | | |
python3 -m venv ~/poetry | |
~/poetry/bin/pip3 install poetry==$POETRY_VERSION | |
- name: Cache virtual environment | |
id: pip-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./.venv | |
key: ${{ runner.os }}-pip-cache-${{ hashFiles('./poetry.lock') }} | |
- name: Install requirements | |
if: steps.pip-cache.outputs.cache-hit != 'true' | |
run: | | |
~/poetry/bin/poetry install | |
code-style: | |
needs: setup | |
runs-on: ubuntu-latest | |
name: Check code style | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache Poetry | |
id: poetry-cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/poetry | |
key: ${{ runner.os }}-poetry-cache-${{ env.POETRY_VERSION }} | |
- name: Cache virtual environment | |
id: pip-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./.venv | |
key: ${{ runner.os }}-pip-cache-${{ hashFiles('./poetry.lock') }} | |
- name: Run Flake8 | |
run: | | |
~/poetry/bin/poetry run flake8 . --count --statistics --config ./.flake8 | |
- name: Run Black | |
uses: psf/black@stable | |
with: | |
options: "-S --line-length 120 --target-version py38 --check --diff --color" | |
test: | |
needs: code-style | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
name: Run tests on ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Cache Poetry | |
id: poetry-cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/poetry | |
key: ${{ runner.os }}-poetry-cache-${{ env.POETRY_VERSION }} | |
- name: Cache virtual environment | |
id: pip-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./.venv | |
key: ${{ runner.os }}-pip-cache-${{ hashFiles('./poetry.lock') }} | |
- name: Download JetBrains Mono | |
run: | | |
curl -sLO https://github.com/JetBrains/JetBrainsMono/releases/download/v$JETBRAINS_MONO_VERSION/JetBrainsMono-$JETBRAINS_MONO_VERSION.zip | |
unzip JetBrainsMono-$JETBRAINS_MONO_VERSION.zip | |
- name: Install JetBrains Mono on MacOS | |
if: matrix.os == 'macos-latest' | |
run: cp fonts/ttf/JetBrainsMono-Regular.ttf /Library/Fonts/ | |
- name: Install JetBrains Mono on Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo cp fonts/ttf/JetBrainsMono-Regular.ttf /usr/local/share/fonts/ | |
fc-cache -f -v | |
- name: Test anderson | |
run: | | |
~/poetry/bin/poetry install | |
~/poetry/bin/poetry run pytest . -vv | |
pip-test: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
runs-on: ${{ matrix.os }} | |
name: Run Anderson via pip on ${{ matrix.os }} | |
steps: | |
- name: Install anderson | |
run: | | |
python3 -m venv .venv | |
source .venv/bin/activate | |
pip3 install . | |
- name: Generate Python Bot GIFs | |
run: | | |
source .venv/bin/activate | |
cd examples/python_bot | |
anderson "python3 main.py" out config.yaml | |
- name: Upload GIFs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: GIFs | |
path: examples/python_bot/out/ | |
if-no-files-found: error |