test #44
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: test | |
on: | |
push: | |
branches: | |
- "westpa2" | |
- "develop" | |
pull_request: | |
branches: | |
- "westpa2" | |
- "develop" | |
schedule: | |
# Weekly tests run on "westpa2" and "develop" on Thursdays 3:30 PM UTC (which is 10:30/11:30 EST/EDT) | |
# Scheduled workflows run on the latest commit on the default or base branch. | |
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) | |
- cron: "30 15 * * 4" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Linting | |
run: | | |
pip install pre-commit | |
pre-commit run --all-files | |
test: | |
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }} | |
runs-on: "${{ matrix.os }}" | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "macos-13", "macos-latest"] # macos-13 is x86-64, macos-latest is arm64 | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Additional info about the build | |
shell: bash | |
run: | | |
uname -a | |
df -h | |
ulimit -a | |
# More info on options: https://github.com/conda-incubator/setup-miniconda | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
miniforge-variant: Mambaforge | |
environment-file: devtools/conda-envs/test_env.yaml | |
activate-environment: test_env | |
channel-priority: true | |
auto-update-conda: true | |
auto-activate-base: false | |
show-channel-urls: true | |
- name: Install package | |
# conda setup requires this special shell | |
shell: bash -l {0} | |
run: | | |
conda info --all | |
python -m pip install . -v --no-deps | |
conda list | |
- name: Run tests | |
# conda setup requires this special shell | |
shell: bash -l {0} | |
run: | | |
pytest -v --cov=westpa --cov-report=xml --color=yes tests | |
- name: CodeCov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
name: codecov-{{ '${{ matrix.os }}' }}-py{{ '${{ matrix.python-version }}' }} | |
fail_ci_if_error: false | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
install-dev: | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "macos-13", "macos-latest"] # macos-13 is x86-64, macos-latest is arm64 | |
name: "Verify dev env" | |
runs-on: "${{ matrix.os }}" | |
steps: | |
- uses: "actions/checkout@v4" | |
- uses: "actions/setup-python@v5" | |
with: | |
python-version: "3.11" | |
- name: "Install HDF5 with brew if macos-arm64" | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: "brew install hdf5" | |
- name: "Install in dev mode" | |
run: "python -m pip install -e .[dev]" | |
- name: "Import package" | |
run: "python -c 'import westpa; print(westpa.__version__)'" | |