-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ci workflow to run unit tests on pr or merge into main branches S…
…CMSUITE-9942 SO107
- Loading branch information
Showing
9 changed files
with
207 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
name: CI | ||
|
||
on: | ||
# Run on creating or updating a PR | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
# And pushing to the trunk or fix branches | ||
push: | ||
branches: | ||
- trunk | ||
- 'fix*' | ||
|
||
jobs: | ||
|
||
build_and_test: | ||
# Run on ubuntu, mac and windows for python 3.8 (in AMS python stack) and 3.11 | ||
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: Move Repo To SCM Namespace and Set PYTHONPATH | ||
if: runner.os != 'Windows' | ||
run: | | ||
mkdir -p scm/plams | ||
find . -mindepth 1 -maxdepth 1 -not -name 'scm' -not -name '.*' -exec mv {} scm/plams/ \; | ||
echo "PYTHONPATH=$(pwd):$PYTHONPATH" >> $GITHUB_ENV | ||
- name: Move Repo To SCM Namespace and Set PYTHONPATH (Windows) | ||
if: runner.os == 'Windows' | ||
shell: pwsh | ||
run: | | ||
New-Item -Path scm\plams -ItemType Directory -Force | ||
Get-ChildItem -Directory | Where-Object { $_.Name -ne 'scm' } | ForEach-Object { | ||
Move-Item -Path $_.FullName -Destination scm\plams | ||
} | ||
Get-ChildItem -File | ForEach-Object { | ||
Move-Item -Path $_.FullName -Destination scm\plams | ||
} | ||
echo "PYTHONPATH=$(pwd);$env:PYTHONPATH" >> $env:GITHUB_ENV | ||
- name: Set Up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-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 | ||
pip install black | ||
- name: Run Unit Tests | ||
working-directory: scm/plams | ||
run: | | ||
pwd | ||
coverage run -m pytest unit_tests | ||
# ToDo: Bump the fail-under threshold over time until acceptable level is reached | ||
- name: Evaluate Coverage | ||
working-directory: scm/plams | ||
run: coverage report --omit="unit_tests/*" -i --fail-under=30 | ||
|
||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install black | ||
pip install "black[jupyter]" | ||
pip install flake8 | ||
- name: Run Black Formatting Check | ||
run: | | ||
# black --check -t py38 -l 120 . | ||
echo "skip for now" | ||
|
||
- name: Run Flake8 Check | ||
run: | | ||
flake8 --color never --count --config .flake8 . | ||
build-docs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Move Repo To SCM Namespace and Set PYTHONPATH | ||
if: runner.os != 'Windows' | ||
run: | | ||
mkdir -p scm/plams | ||
find . -mindepth 1 -maxdepth 1 -not -name 'scm' -not -name '.*' -exec mv {} scm/plams/ \; | ||
echo "PYTHONPATH=$(pwd):$PYTHONPATH" >> $GITHUB_ENV | ||
- name: Set Up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install Dependencies | ||
working-directory: scm/plams | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
cd doc | ||
pip install -r requirements.txt | ||
# Turn on the -W flag when building once warnings to external links have been resolved | ||
# ToDo: add a warning allowlist to check the warnings logged via -w | ||
- name: Build Sphinx Docs | ||
working-directory: scm/plams/doc | ||
run: | | ||
python build_plams_doc |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sphinx | ||
sphinx_copybutton | ||
sphinx_tabs | ||
ipython |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dill==0.3.6 | ||
numpy==1.23.4 | ||
scipy==1.9.3 | ||
natsort==8.1.0 | ||
ase==3.22.1 | ||
rdkit==2024.03.1 |
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
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
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
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