ll #50
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
# Related documentation: | |
# https://jacobian.org/til/github-actions-poetry/ | |
# https://github.com/snok/install-poetry | |
name: m000/j2cli | |
on: | |
push: | |
branches: | |
- "**/*" | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-latest" ] | |
python-version: [ "3.10", "3.11" ] | |
runs-on: ${{ matrix.os }} | |
# env: | |
# TOXENV: py${{ matrix.python-version }}-pyyaml6 | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v4 | |
- name: Python ${{ matrix.python-version }} setup | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Tox env1 (py${{ matrix.python-version }}) | |
run: env | |
- name: Find1 (py${{ matrix.python-version }}) | |
run: find . | |
- name: Load cached Poetry installation | |
id: cached-poetry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local # the path depends on the OS | |
key: poetry-2 # increment to reset cache | |
- name: Find2 (py${{ matrix.python-version }}) | |
run: find . | |
- name: Install Poetry | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.7.0 | |
virtualenvs-create: true | |
virtualenvs-in-project: true # create .venv in test directory | |
- name: Tox env2 (py${{ matrix.python-version }}) | |
run: env | |
- name: Install Poetry development dependencies # main dependencies are handled by tox | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root --only=dev | |
- name: Activate Poetry development dependencies # main dependencies are handled by tox | |
if: steps.cached-poetry.outputs.cache-hit == 'true' | |
run: source .venv/bin/activate | |
- name: Find3 (py${{ matrix.python-version }}) | |
run: find . | |
- name: Tox env3 (py${{ matrix.python-version }}) | |
run: env | |
- name: Load cached tox environment | |
id: cached-toxenv | |
uses: actions/cache@v3 | |
with: | |
path: .tox/py${{ matrix.python-version }}-** | |
key: toxenv-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock', 'tox.ini') }} | |
- name: Tox id1 (py${{ matrix.python-version }}) | |
run: which tox || true | |
- name: Tox id2 (py${{ matrix.python-version }}) | |
run: poetry run which tox || true | |
- name: Tox tests (py${{ matrix.python-version }}) | |
run: poetry run tox | |
- name: Send coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
#files: ./coverage1.xml,./coverage2.xml # optional | |
#flags: unittests # optional | |
#name: codecov-umbrella # optional | |
fail_ci_if_error: false | |
verbose: true | |
- name: WTF1 (py${{ matrix.python-version }}) | |
run: ls -al manifest.txt || true | |
- name: WTF2 (py${{ matrix.python-version }}) | |
run: cat manifest.txt || true |