Skip to content

Add Ruff to pre-commit (before isort + flake8 to test it as a possible replacement) #1161

Add Ruff to pre-commit (before isort + flake8 to test it as a possible replacement)

Add Ruff to pre-commit (before isort + flake8 to test it as a possible replacement) #1161

Workflow file for this run

name: test
on:
pull_request:
push:
branches:
- main
concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
MICROMAMBA_VERSION: 'latest'
jobs:
test-windows:
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: ${{ env.MICROMAMBA_VERSION }}
environment-name: test-env
init-shell: powershell
create-args: >-
python=3.11
mamba
pip
pytest-cov
pytest-xdist
- name: Install dev deps
run: |
python -m pip install -r requirements-dev.txt
- name: install conda-lock
run: |
pip install -e . --force-reinstall
- name: run-test
run: |
copy pyproject.toml "%RUNNER_TEMP%"
Xcopy /E /I tests "%RUNNER_TEMP%\\tests"
pushd "${RUNNER_TEMP}"
set TMPDIR="%RUNNER_TEMP%"
dir
pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term tests
copy coverage.xml %GITHUB_WORKSPACE%
- uses: codecov/codecov-action@v3
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
python-version: [ "3.8", "3.11" ]
defaults:
run:
shell: bash -l {0}
env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
steps:
- uses: actions/checkout@v3
- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: ${{ env.MICROMAMBA_VERSION }}
environment-name: test-env
init-shell: bash
create-args: >-
python=${{ matrix.python-version }}
mamba
pip
pytest-cov
pytest-xdist
- name: Install dev deps
shell: bash -eo pipefail -l {0}
run: |
set -x
echo "${PATH}"
which pip
which python
python -m pip install -r requirements-dev.txt
- name: install conda-lock
shell: bash -eo pipefail -l {0}
run: |
which pip
pip install -e . --force-reinstall
- name: run-test
shell: bash -eo pipefail -l {0}
run: |
cp pyproject.toml "${RUNNER_TEMP}/"
cp -a tests "${RUNNER_TEMP}/"
pushd "${RUNNER_TEMP}"
export TMPDIR="${RUNNER_TEMP}"
ls -lah
set -x
which pytest
pytest --cov=conda_lock --cov-branch --cov-report=xml --cov-report=term tests
cp coverage.xml "${GITHUB_WORKSPACE}"
- uses: codecov/codecov-action@v3
- name: test-gdal
shell: bash -eo pipefail -l {0}
run: |
pushd "${RUNNER_TEMP}/tests/gdal"
export TMPDIR="${RUNNER_TEMP}"
ls -lah
conda-lock --mamba -f environment.yml -p linux-64