CI: upgrade actions/cache from v2 to v4 #40
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: build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*-[0-9]+.*" | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-cross-platform: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.8", "3.12"] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: ${{matrix.python-version}} | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'zulu' | |
- name: Install pyimagej | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e ".[dev]" | |
- name: Test ImageJ | |
run: | | |
python -m pytest -s -p no:faulthandler --color=yes | |
echo "Done!" | |
ensure-clean-code: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v3 | |
- name: Lint code | |
run: | | |
python -m pip install ruff | |
ruff check | |
ruff format --check | |
conda-dev-test: | |
name: Test Conda Development Setup And Code Coverage | |
runs-on: ubuntu-latest | |
defaults: | |
# Steps that rely on the activated environment must be run with this shell setup. | |
# See https://github.com/marketplace/actions/setup-miniconda#important | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache conda | |
uses: actions/cache@v4 | |
env: | |
# Increase this value to reset cache if dev-environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('dev-environment.yml') }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
# Create env with dev packages | |
auto-update-conda: true | |
python-version: 3.9 | |
miniforge-version: latest | |
environment-file: dev-environment.yml | |
# Activate imglyb-dev environment | |
activate-environment: imglyb-dev | |
auto-activate-base: false | |
# Use mamba for faster setup | |
use-mamba: true | |
- name: Test imglyb | |
run: | | |
python -m pytest tests/ -p no:faulthandler --cov-report=xml --cov=. | |
# We could do this in its own action, but we'd have to setup the environment again. | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v2 |