Initial commit #4
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-22.04 | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
environment: | |
name: release | |
url: https://pypi.org/p/cenclave-lib-sgx | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install package with 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_sgx; print(cenclave_lib_sgx.__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 |