From 1c77a29ba938473968fd119208d830b468835793 Mon Sep 17 00:00:00 2001 From: renaud gaudin Date: Wed, 4 Sep 2024 13:18:58 +0000 Subject: [PATCH] fixup! Adopting-ish openZIM bootstrap --- .github/workflows/CI-wheels.yaml | 4 ++-- .github/workflows/Publish.yaml | 3 ++- .github/workflows/QA.yaml | 34 ++++++++++++++++++++++++++++ .github/workflows/Tests.yaml | 38 +++++++++----------------------- README.md | 3 +-- 5 files changed, 49 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/QA.yaml diff --git a/.github/workflows/CI-wheels.yaml b/.github/workflows/CI-wheels.yaml index 1676cf9..37e7412 100644 --- a/.github/workflows/CI-wheels.yaml +++ b/.github/workflows/CI-wheels.yaml @@ -5,12 +5,12 @@ on: push: branches: - main - - windows env: LIBZIM_DL_VERSION: "9.2.3-2" MACOSX_DEPLOYMENT_TARGET: "12.0" - CIBW_ENVIRONMENT_PASS_LINUX: "LIBZIM_DL_VERSION" + PROFILE: "0" + CIBW_ENVIRONMENT_PASS_LINUX: "LIBZIM_DL_VERSION PROFILE" CIBW_BUILD_VERBOSITY: "3" diff --git a/.github/workflows/Publish.yaml b/.github/workflows/Publish.yaml index 8cc2a10..63c284c 100644 --- a/.github/workflows/Publish.yaml +++ b/.github/workflows/Publish.yaml @@ -8,7 +8,8 @@ on: env: LIBZIM_DL_VERSION: "9.2.3-2" MACOSX_DEPLOYMENT_TARGET: "12.0" - CIBW_ENVIRONMENT_PASS_LINUX: "LIBZIM_DL_VERSION" + PROFILE: "0" + CIBW_ENVIRONMENT_PASS_LINUX: "LIBZIM_DL_VERSION PROFILE" # APPLE_SIGNING_KEYCHAIN_PATH set in prepare keychain step APPLE_SIGNING_KEYCHAIN_PROFILE: "build-profile" APPLE_SIGNING_IDENTITY: "${{ secrets.APPLE_SIGNING_IDENTITY }}" diff --git a/.github/workflows/QA.yaml b/.github/workflows/QA.yaml new file mode 100644 index 0000000..dac48f2 --- /dev/null +++ b/.github/workflows/QA.yaml @@ -0,0 +1,34 @@ +name: QA +on: [push] + +env: + LIBZIM_DL_VERSION: "9.2.3-2" + MACOSX_DEPLOYMENT_TARGET: "12.0" + PROFILE: "0" + +jobs: + lint: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v5 + with: + python-version: "3.12" + architecture: x64 + + - name: Install dependencies (and project) + run: | + pip install -U pip + pip install -e .[lint,scripts,test,check] + + - name: Check black formatting + run: inv lint-black + + - name: Check ruff + run: inv lint-ruff + + # disabled until we add stubs so it has some use + # - name: Check pyright + # run: inv check-pyright diff --git a/.github/workflows/Tests.yaml b/.github/workflows/Tests.yaml index d1e9d10..f4cdb9d 100644 --- a/.github/workflows/Tests.yaml +++ b/.github/workflows/Tests.yaml @@ -1,28 +1,13 @@ -name: test +name: Tests on: [push] env: LIBZIM_DL_VERSION: "9.2.3-2" MACOSX_DEPLOYMENT_TARGET: "12.0" + # on by default now but shows intent + PROFILE: "1" jobs: - lint: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5 - with: - python-version: "3.12" - architecture: x64 - - - name: Check formatting and linting - run: | - pip install -U invoke - invoke install-dev - invoke check - test: runs-on: ${{ matrix.os }} strategy: @@ -39,25 +24,22 @@ jobs: python-version: ${{ matrix.python }} architecture: x64 - - name: Installing dependencies - run: pip install -U pip setuptools build - - name: Building & installing for tests (with profiling) - env: - PROFILE: 1 - run: pip install -e . + - name: Install dependencies (and project) + run: | + pip install -U pip + pip install -e .[test,scripts] - name: move DLLs next to wrapper if: matrix.os == 'windows-2022' run: Move-Item -Force -Path .\libzim\*.dll -Destination .\ - - name: Testing - run: | - pip install pytest pytest-cov cython - py.test --cov=libzim --cov-report=term --cov-report term-missing . + - name: Run the tests + run: inv coverage --args "-vvv" - name: Upload coverage report to codecov if: matrix.os == 'ubuntu-22.04' && matrix.python == '3.11' uses: codecov/codecov-action@v4 with: + fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index 25e22ba..0b371d8 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,7 @@ Users on other platforms can install the source distribution (see [Building](#Bu ```sh git clone git@github.com:openzim/python-libzim.git && cd python-libzim # python -m venv env && source env/bin/activate -pip install -U setuptools invoke -invoke download-libzim install-dev build-ext test +pip install -e . # invoke --list for available development helpers ```