npm/docker tags and fixes #392
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: M | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
env: | |
VIRTUAL_ENV: /opt/venv/m | |
PYTHONPATH: ./packages/python | |
FORCE_COLOR: 1 | |
MYPY_FORCE_COLOR: 1 | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
setup: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
py-ver: [py310, py311] | |
container: | |
image: ghcr.io/jmlopez-rod/m-devcontainer-${{ matrix.py-ver }}:latest | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
python3 -m venv /opt/venv/m | |
poetry install | |
- name: Cache venv | |
uses: actions/cache@v4 | |
with: | |
path: /opt/venv/m | |
key: venv-${{ matrix.py-ver }}-${{ hashFiles('**/poetry.lock') }} | |
tests: | |
needs: setup | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
py-ver: [py310, py311] | |
container: | |
image: ghcr.io/jmlopez-rod/m-devcontainer-${{ matrix.py-ver }}:latest | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache venv | |
uses: actions/cache@v4 | |
with: | |
path: /opt/venv/m | |
key: venv-${{ matrix.py-ver }}-${{ hashFiles('**/poetry.lock') }} | |
- name: run tests | |
run: ./packages/python/tests/run.sh | |
flake8: | |
needs: setup | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/jmlopez-rod/m-devcontainer-py311:latest | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache venv | |
uses: actions/cache@v4 | |
with: | |
path: /opt/venv/m | |
key: venv-py311-${{ hashFiles('**/poetry.lock') }} | |
- name: lint src | |
shell: bash | |
run: | | |
m ci celt -t flake8 -c @allowed_errors.json < <(flake8 packages/python/m) | |
- name: lint tests | |
shell: bash | |
run: | | |
m ci celt -t flake8 -c @allowed_errors_tests.json < <(flake8 packages/python/tests --config .flake8-tests) | |
- name: lint docs | |
shell: bash | |
run: flake8 packages/web/docs | |
mypy: | |
needs: setup | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/jmlopez-rod/m-devcontainer-py311:latest | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache venv | |
uses: actions/cache@v4 | |
with: | |
path: /opt/venv/m | |
key: venv-py311-${{ hashFiles('**/poetry.lock') }} | |
- name: src | |
run: | | |
mypy ./packages/python/m | |
- name: tests | |
run: | | |
mypy ./packages/python/tests | |
- name: docs | |
run: | | |
mypy ./packages/web/docs | |
docs: | |
needs: setup | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/jmlopez-rod/m-devcontainer-py311:latest | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache venv | |
uses: actions/cache@v4 | |
with: | |
path: /opt/venv/m | |
key: venv-py311-${{ hashFiles('**/poetry.lock') }} | |
- name: Install | |
run: poetry install --with docs | |
- name: build | |
run: cd packages/web && mkdocs build | |
prettier: | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/jmlopez-rod/m-devcontainer-py311:latest | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: pnpm install | |
run: | | |
pnpm install | |
- name: prettier | |
shell: bash | |
run: | | |
pnpm exec prettier -c . | |
build: | |
needs: setup | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/jmlopez-rod/m-devcontainer-py311:latest | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
outputs: | |
m-is-release: ${{ steps.build.outputs.m-is-release }} | |
m-tag: ${{ steps.build.outputs.m-tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache venv | |
uses: actions/cache@v4 | |
with: | |
path: /opt/venv/m | |
key: venv-py311-${{ hashFiles('**/poetry.lock') }} | |
- name: Build | |
id: build | |
run: | | |
./m/scripts/build.sh | |
- name: Save build | |
uses: actions/cache/save@v4 | |
with: | |
path: ./.stage-pypi | |
key: build-${{ github.sha }} | |
release: | |
needs: [build, tests, flake8, mypy, prettier] | |
if: ${{ needs.build.outputs.m-is-release == 'True' }} | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/jmlopez-rod/m-devcontainer-py311:latest | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
M_TAG: ${{ needs.build.outputs.m-tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache venv | |
uses: actions/cache@v4 | |
with: | |
path: /opt/venv/m | |
key: venv-py311-${{ hashFiles('**/poetry.lock') }} | |
- name: Restore build | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./.stage-pypi | |
key: build-${{ github.sha }} | |
- name: Release | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
./m/scripts/publish.sh |