Initial commit #1
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: Python CI | |
on: [push] | |
env: | |
PYTHON_SRC: "src" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
environment: | |
name: release | |
url: https://pypi.org/p/cenclave-lib-crypto | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install ".[dev]" | |
- name: Package metadata | |
id: metadata | |
run: | | |
echo "PACKAGE_VERSION=$(python -c 'import cenclave_lib_crypto; print(cenclave_lib_crypto.__version__)')" >> $GITHUB_OUTPUT | |
- name: Code format with black | |
run: | | |
python -m black --check $PYTHON_SRC | |
- name: Import check with isort | |
run: | | |
python -m isort --check $PYTHON_SRC | |
- name: Lint check with pylint | |
run: | | |
python -m pylint $PYTHON_SRC | |
- name: Lint check with pycodestyle | |
run: | | |
python -m pycodestyle $PYTHON_SRC | |
- name: Lint check with pydocstyle | |
run: | | |
python -m pydocstyle $PYTHON_SRC | |
- name: Typecheck with MyPy | |
run: | | |
python -m mypy $PYTHON_SRC | |
- name: Test with pytest | |
run: | | |
python -m pytest | |
- name: Build package | |
if: ${{ startsWith(github.ref, 'refs/tags') && endsWith(github.ref, steps.metadata.outputs.PACKAGE_VERSION) }} | |
run: python -m build | |
- name: Publish package to PyPi | |
if: ${{ startsWith(github.ref, 'refs/tags') && endsWith(github.ref, steps.metadata.outputs.PACKAGE_VERSION) }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
attestations: false |