moving from pdm to poetry #164
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: MMPM Build Pipeline | |
on: | |
push: | |
branches: | |
- "*" | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
release: | |
types: [created] | |
jobs: | |
mmpm-cli: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache Python Dependencies | |
uses: actions/cache@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
path: | | |
~/.cache/pip | |
${{ github.workspace }}/.venv | |
key: ${{ runner.os }}-python-deps-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-python-deps-${{ hashFiles('**/poetry.lock') }} | |
- name: Python Dependencies | |
run: | | |
python -m pip install poetry==2.0.1 | |
poetry install | |
- name: Python Tests | |
run: | | |
pylint mmpm | |
mypy mmpm | |
coverage run -m pytest test | |
coverage report | |
- name: Python Build | |
run: | | |
poetry build | |
- name: Install Test | |
run: | | |
poetry install | |
options=("version" "--help" "completion --help" "db --help" "guided-setup --help" "install --help" "list --help" "logs --help" "mm-ctl --help" "mm-pkg --help" "open --help" "remove --help" "search --help" "show --help" "ui --help" "update --help" "upgrade --help" "version --help") | |
for option in "${options[@]}"; do ${{ github.workspace }}/.venv/bin/mmpm $option; done | |
mmpm-ui: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: ["16.x", "18.x", "20.x", "22"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache Node Modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
'./ui/node_modules' | |
key: ${{ runner.os }}-angular-deps-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-angular-deps-${{ hashFiles('**/package-lock.json') }} | |
- name: Cache Angular Build Artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/ui/build | |
key: ${{ runner.os }}-angular-build-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-angular-build-${{ hashFiles('**/package-lock.json') }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Angular Dependencies | |
run: | | |
cd ui && npm install --legacy-peer-deps && cd .. | |
- name: Angular Tests | |
run: | | |
cd ui && npm run lint && cd .. | |
- name: Angular Build | |
run: | | |
cd ui && ./node_modules/@angular/cli/bin/ng.js build --configuration production --output-hashing none --base-href / && cd .. | |
create-artifact: | |
needs: [mmpm-cli, mmpm-ui] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Restore Python Dependencies Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
${{ github.workspace }}/.venv | |
key: ${{ runner.os }}-python-deps-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-python-deps-${{ hashFiles('**/poetry.lock') }} | |
- name: Restore Angular Build Artifacts Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/ui/build | |
key: ${{ runner.os }}-angular-build-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-angular-build-${{ hashFiles('**/package-lock.json') }} | |
- name: Package MMPM | |
run: | | |
python -m pip install poetry==2.0.1 | |
poetry install | |
mkdir -p ${{ github.workspace }}/mmpm/ui | |
cp -r ${{ github.workspace }}/ui/build/* ${{ github.workspace }}/mmpm/ui | |
poetry build | |
- name: Cache MMPM Artifacts | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ github.workspace }}/dist | |
key: ${{ runner.os }}-python-build-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-python-build-${{ hashFiles('**/poetry.lock') }} | |
- name: Publish to PyPi | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
skip_existing: true | |
verbose: true | |
- name: Publish Release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: ${{ github.workspace }}/dist/ |