[ImgBot] Optimize images #62
Workflow file for this run
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
--- | |
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Python CI | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
CI-Python: | |
runs-on: ubuntu-latest | |
env: | |
PYTHONDEVMODE: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
# Empty is latest, head is latest from GitHub | |
pdm-version: ["", "head", "2.7.4", "2.8.0", "2.8.1", "2.8.2", "2.9.3", "2.10.4"] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pdm-project/setup-pdm@v3 | |
name: Setup PDM | |
with: | |
cache: true | |
python-version: ${{ matrix.python-version }} # Version range or exact version of a Python version to use, the same as actions/setup-python | |
architecture: x64 # The target architecture (x86, x64) of the Python interpreter. the same as actions/setup-python | |
version: ${{ matrix.pdm-version }} # The version of PDM to install. Leave it as empty to use the latest version from PyPI, or 'head' to use the latest version from GitHub | |
prerelease: true # Allow prerelease versions of PDM to be installed | |
enable-pep582: false # Enable PEP 582 package loading globally | |
allow-python-prereleases: true # Allow prerelease versions of Python to be installed. For example if only 3.12-dev is available, 3.12 will fall back to 3.12-dev | |
- name: Set Cache Variables | |
id: set_variables | |
run: | | |
echo "PIP_CACHE=$(pip cache dir)" >> $GITHUB_OUTPUT | |
echo "PDM_CACHE=$(pdm config cache_dir)" >> $GITHUB_OUTPUT | |
- name: Cache PIP and PDM | |
uses: actions/cache@v2 | |
with: | |
path: | | |
${{ steps.set_variables.outputs.PIP_CACHE }} | |
${{ steps.set_variables.outputs.PDM_CACHE }} | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.pdm-version }} | |
- name: Install dependencies | |
run: | | |
pdm config venv.with_pip True | |
pdm install -G :all --dev | |
pdm venv activate in-project | |
source .venv/bin/activate | |
# Get the pip command to run depending on matrix.pdm-version | |
# We force reinstall of pdm in the virtualenv | |
if [[ "${{ matrix.pdm-version }}" == "head" ]]; then | |
pip install "pdm @ git+https://github.com/pdm-project/pdm" | |
elif [[ "${{ matrix.pdm-version }}" == "" ]]; then | |
pip install pdm | |
else | |
pip install pdm==${{ matrix.pdm-version }} | |
fi | |
- name: Test with pytest | |
run: | | |
pdm run test-cov | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
flags: unittests | |
- name: Type check with mypy | |
run: | | |
pdm run lint-mypy | |
- name: Lint with ruff | |
run: | | |
pdm run lint-ruff --output-format=github --exit-non-zero-on-fix | |
- name: Build with pdm | |
run: | | |
pdm build | |
# Do not upload to PyPI, here we only want to check that the build works | |
# XXX Check valid wheels? |