Decouple uniq_id from name=, hash the artifact key (#3 + #13) #85
This file contains hidden or 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 application | |
| on: [push] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| id: setup-python | |
| with: | |
| python-version: "3.10" | |
| cache: "pip" | |
| - uses: actions/cache@v3 | |
| id: cache-primes | |
| with: | |
| path: venv | |
| key: venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements*.txt') }} | |
| - name: Install requirements | |
| if: steps.cache-primes.outputs.cache-hit != 'true' | |
| run: | | |
| python -m venv venv | |
| . venv/bin/activate | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt -r requirements_dev.txt | |
| - name: Black | |
| continue-on-error: true | |
| run: | | |
| . venv/bin/activate | |
| black --check solid_node tests | |
| - name: Flake8 | |
| continue-on-error: true | |
| run: | | |
| . venv/bin/activate | |
| flake8 --max-line-length=89 solid_node tests | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: awalsh128/cache-apt-pkgs-action@latest | |
| with: | |
| packages: openscad | |
| version: 1.0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| id: setup-python | |
| with: | |
| python-version: "3.10" | |
| cache: "pip" | |
| - uses: actions/cache@v3 | |
| id: cache-primes | |
| with: | |
| path: venv | |
| key: venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements*.txt') }} | |
| - name: Install requirements | |
| if: steps.cache-primes.outputs.cache-hit != 'true' | |
| run: | | |
| python -m venv venv | |
| . venv/bin/activate | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt -r requirements_dev.txt | |
| - name: Run tests | |
| run: | | |
| . venv/bin/activate | |
| coverage run --source solid_node -m pytest | |
| coverage report -m | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| cache-dependency-path: docs/requirements.txt | |
| - name: Install docs requirements | |
| run: pip install -r docs/requirements.txt | |
| - name: Build docs (fail on warnings) | |
| run: python -m sphinx -b html -W docs docs/_build | |
| build: | |
| if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| needs: test | |
| permissions: | |
| contents: write | |
| env: | |
| SOLID_NODE_VERSION: "${{ github.ref_name }}" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| id: setup-python | |
| with: | |
| python-version: "3.10" | |
| cache: "pip" | |
| - name: Install packaging | |
| run: pip install packaging | |
| - name: Detect package version | |
| id: package_version | |
| run: | | |
| from os import getenv as env | |
| from packaging.version import parse | |
| solid_node_version = str(parse(env("SOLID_NODE_VERSION"))) | |
| print(f"version={solid_node_version}", file=open(env("GITHUB_OUTPUT"), "a"), flush=True) | |
| shell: python | |
| - uses: actions/cache@v3 | |
| id: cache-primes | |
| with: | |
| path: venv | |
| key: venv-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements*.txt') }} | |
| - name: Install requirements | |
| if: steps.cache-primes.outputs.cache-hit != 'true' | |
| run: | | |
| python -m venv venv | |
| . venv/bin/activate | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt -r requirements_dev.txt | |
| - name: Build python package | |
| run: | | |
| . venv/bin/activate | |
| make dist | |
| - name: Create release | |
| if: steps.package_version.outputs.version != null | |
| run: | | |
| gh release create ${{ steps.package_version.outputs.version }} ./dist/* --repo="$GITHUB_REPOSITORY" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |