Bump actions/download-artifact from 3 to 4 (#160) #573
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
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
name: CI | |
jobs: | |
test: | |
name: Cargo test (${{ matrix.os }}) | |
runs-on: ${{ matrix. os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: cargo build --release --verbose --examples | |
- name: Test | |
run: cargo test --release | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add rustfmt | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check # Also fmt subdirectories | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add clippy | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all -- -D warnings | |
R-CMD-check: | |
name: R CMD check (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest', 'macos-latest'] # TODO: Add windows here | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: 'release' | |
use-public-rspm: true | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 'stable' | |
- name: Install dependencies | |
run: | | |
install.packages(c("R6", "testthat", "rcmdcheck"), repos="http://cran.us.r-project.org") | |
shell: Rscript {0} | |
- name: Run R CMD check | |
run: | | |
R CMD check --as-cran --no-vignettes --no-manual ./changeforest-r | |
env: | |
_R_CHECK_CRAN_INCOMING_: false | |
if: matrix.os != 'windows-latest' | |
- name: Check for warnings | |
run: | | |
CHECK_LOG_FILE=changeforest-r.Rcheck/00check.log | |
CHECK_INSTALL_FILE=changeforest-r.Rcheck/00install.out | |
if ! [[ -f "$CHECK_LOG_FILE" ]]; then | |
echo "Log-file not found." | |
exit 1 | |
fi | |
if cat $CHECK_LOG_FILE | grep -q "ERROR"; then | |
cat $CHECK_INSTALL_FILE | |
cat $CHECK_LOG_FILE | |
exit 1 | |
fi | |
if cat $CHECK_LOG_FILE | grep -q "WARNING"; then | |
echo "Found warnings, treated as errors." | |
cat $CHECK_LOG_FILE | |
exit 1 | |
fi | |
# e: pipefail | |
# x: print commands | |
# u: unset variables are errors | |
# l: as login script | |
shell: bash -lxu {0} | |
if: matrix.os != 'windows-latest' | |
python-tests: | |
name: Python tests (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.9] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
env: | |
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 'stable' | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build wheel | |
run: | | |
pip install --upgrade maturin | |
maturin build --release -m changeforest-py/Cargo.toml | |
- name: Install wheel | |
run: | | |
pip install numpy matplotlib pytest | |
pip install --force-reinstall --no-index --find-links changeforest-py/target/wheels/ changeforest | |
- name: Run tests | |
run: pytest changeforest-py/tests |