Merge pull request #89 from jmlopez-rod/hotfix/0.22.1 #237
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@v3 | |
- name: Install | |
run: | | |
python3 -m venv /opt/venv/m | |
poetry install | |
- name: Cache venv | |
uses: actions/cache@v3 | |
with: | |
path: /opt/venv/m | |
key: venv-${{ matrix.py-ver }}-${{ hashFiles('**/poetry.lock') }} | |
tests: | |
needs: 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@v3 | |
- name: Cache venv | |
uses: actions/cache@v3 | |
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@v3 | |
- name: Cache venv | |
uses: actions/cache@v3 | |
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) | |
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@v3 | |
- name: Cache venv | |
uses: actions/cache@v3 | |
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 | |
pylint: | |
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@v3 | |
- name: Cache venv | |
uses: actions/cache@v3 | |
with: | |
path: /opt/venv/m | |
key: venv-py311-${{ hashFiles('**/poetry.lock') }} | |
- name: src | |
shell: bash | |
run: | | |
m ci celt -t pylint -m 10 -c @allowed_errors.json < <(pylint ./packages/python/m --rcfile=.pylintrc -f json) | |
- name: tests | |
shell: bash | |
run: | | |
m ci celt -t pylint -m 10 -c @allowed_errors_tests.json < <(pylint ./packages/python/tests --rcfile=packages/python/tests/.pylintrc -f json) | |
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@v3 | |
- 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@v3 | |
- name: Cache venv | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
path: ./.stage-pypi | |
key: build-${{ github.sha }} | |
release: | |
needs: [build, tests, flake8, mypy, pylint, 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@v3 | |
- name: Cache venv | |
uses: actions/cache@v3 | |
with: | |
path: /opt/venv/m | |
key: venv-py311-${{ hashFiles('**/poetry.lock') }} | |
- name: Restore build | |
uses: actions/cache/restore@v3 | |
with: | |
path: ./.stage-pypi | |
key: build-${{ github.sha }} | |
- name: Release | |
run: | | |
./m/scripts/publish.sh |