WIP: Add ci workflow to run unit tests on pr or merge into main branches S… #6
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: CI | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: | |
- trunk | |
- 'fix*' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.8", "3.11"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set Up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Move Repo To SCM Namespace | |
run: | | |
mkdir -p scm/plams | |
find . -mindepth 1 -maxdepth 1 -not -name 'excluded_directory' -not -name '.*' -exec mv {} scm/plams/ \; | |
- name: Display Python Version | |
run: python -c "import sys; print(sys.version)" | |
- name: Install Dependencies | |
working-directory: scm/plams | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest | |
pip install coverage | |
- name: Run Unit Tests | |
working-directory: scm/plams | |
run: | | |
coverage run -m pytest unit_tests | |
- name: Evaluate Coverage | |
working-directory: scm/plams | |
run: coverage report --omit="unit_tests/*" -i --fail-under=30 |