tests #436
This file contains hidden or 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: tests | |
on: | |
push: | |
branches: ["**"] | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- ready_for_review | |
jobs: | |
# pytest-unit: | |
# runs-on: ubuntu-24.04 | |
# strategy: | |
# matrix: | |
# python-version: ["3.9"] | |
# steps: | |
# - name: System Dependencies | |
# run: | | |
# sudo apt install -y build-essential \ | |
# libcairo2-dev \ | |
# pkg-config \ | |
# python3-dev \ | |
# python3-openssl | |
# - uses: actions/checkout@v4 | |
# - name: Set up Python ${{ matrix.python-version }} | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# - name: Cache Python dependencies | |
# uses: actions/cache@v4 | |
# with: | |
# path: ~/.cache/pip | |
# key: ${{ runner.os }}-pip-${{ hashFiles('pip/*.txt') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pip- | |
# - name: Install dependencies | |
# run: | | |
# python3.9 -m pip install --upgrade pip | |
# pip install -e . | |
# if [ -f pip/cpu_requirements.txt ]; then pip install -r pip/cpu_requirements.txt; fi | |
# if [ -f pip/dev_requirements.txt ]; then pip install -r pip/dev_requirements.txt; fi | |
# - name: pytest | |
# run: | | |
# # python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/ddm/test/unit | |
# python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/modac/test/unit | |
# cd atomsci/ddm/test/unit && python3.9 -m pytest -n 2 --capture=sys --capture=fd --cov=atomsci -vv | |
# env: | |
# ENV: test | |
# - name: combine/move .coverage files (for parallel test run) | |
# run: | | |
# cd atomsci/ddm/test/unit | |
# if ls -a .coverage* 1> /dev/null 2>&1; then | |
# coverage combine .coverage* | |
# mv .coverage* $GITHUB_WORKSPACE | |
# fi | |
# - name: Upload coverage-part1 | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: coverage-part1 | |
# path: .coverage | |
# if-no-files-found: ignore | |
pytest-integrative-1: | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
python-version: ["3.9"] | |
steps: | |
- name: System Dependencies | |
run: | | |
sudo apt install -y build-essential \ | |
libcairo2-dev \ | |
pkg-config \ | |
python3-dev \ | |
python3-openssl | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Python dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('pip/*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python3.9 -m pip install --upgrade pip | |
pip install -e . | |
if [ -f pip/cpu_requirements.txt ]; then pip install -r pip/cpu_requirements.txt; fi | |
if [ -f pip/dev_requirements.txt ]; then pip install -r pip/dev_requirements.txt; fi | |
- name: Install sqlite3 | |
run: sudo apt-get update && sudo apt-get install -y sqlite3 | |
- name: pytest | |
run: | | |
# TODO: Run this test with pytest for paralell testing | |
# python3.9 -m pytest -n 2 --capture=sys --capture=fd --cov=atomsci -vv atomsci/ddm/test/integrative | |
cd atomsci/ddm/test/integrative && ./integrative_batch_chunk_tests 0 | |
env: | |
ENV: test | |
- name: Combine coverage files | |
run: | | |
find . -name '.coverage*' | while read covfile; do | |
echo "Report for $covfile" | |
done | |
# combine the coverage files | |
coverage combine $(find . -name '.coverage') | |
if ls -a .coverage* 1> /dev/null 2>&1; then | |
command="pwd && ls -lsa .coverage*" | |
echo "Executing: $command" | |
eval "$command" | |
coverage report | |
else | |
echo ".coverage files not found" | |
fi | |
working-directory: ${{ github.workspace }} | |
- name: Upload coverage-part2 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-part2 | |
path: ${{ github.workspace }}/.coverage | |
if-no-files-found: ignore | |
# pytest-integrative-2: | |
# runs-on: ubuntu-24.04 | |
# strategy: | |
# matrix: | |
# python-version: ["3.9"] | |
# steps: | |
# - name: System Dependencies | |
# run: | | |
# sudo apt install -y build-essential \ | |
# libcairo2-dev \ | |
# pkg-config \ | |
# python3-dev \ | |
# python3-openssl | |
# - uses: actions/checkout@v4 | |
# - name: Set up Python ${{ matrix.python-version }} | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# - name: Cache Python dependencies | |
# uses: actions/cache@v4 | |
# with: | |
# path: ~/.cache/pip | |
# key: ${{ runner.os }}-pip-${{ hashFiles('pip/*.txt') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pip- | |
# - name: Install dependencies | |
# run: | | |
# python3.9 -m pip install --upgrade pip | |
# pip install -e . | |
# if [ -f pip/cpu_requirements.txt ]; then pip install -r pip/cpu_requirements.txt; fi | |
# if [ -f pip/dev_requirements.txt ]; then pip install -r pip/dev_requirements.txt; fi | |
# - name: pytest | |
# run: | | |
# # TODO: Run this test with pytest for paralell testing | |
# # python3.9 -m pytest -n 2 --capture=sys --capture=fd --cov=atomsci -vv atomsci/ddm/test/integrative | |
# cd atomsci/ddm/test/integrative && ./integrative_batch_chunk_tests 1 | |
# env: | |
# ENV: test | |
# - name: Move .coverage to root | |
# run: | | |
# if [ -f atomsci/ddm/test/integrative/.coverage* ]; then | |
# mv atomsci/ddm/test/integrative/.coverage* $GITHUB_WORKSPACE | |
# fi | |
# - name: Check for .coverage file | |
# run: ls -la .coverage* || echo ".coverage not found" | |
# - name: Combine coverage files | |
# run: | | |
# if ls .coverage* 1> /dev/null 2>&1; then | |
# coverage combine .coverage* | |
# fi | |
# - name: Upload coverage-part3 | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: coverage-part3 | |
# path: .coverage | |
# if-no-files-found: ignore | |
# pytest-integrative-3: | |
# runs-on: ubuntu-24.04 | |
# strategy: | |
# matrix: | |
# python-version: ["3.9"] | |
# steps: | |
# - name: System Dependencies | |
# run: | | |
# sudo apt install -y build-essential \ | |
# libcairo2-dev \ | |
# pkg-config \ | |
# python3-dev \ | |
# python3-openssl | |
# - uses: actions/checkout@v4 | |
# - name: Set up Python ${{ matrix.python-version }} | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# - name: Cache Python dependencies | |
# uses: actions/cache@v4 | |
# with: | |
# path: ~/.cache/pip | |
# key: ${{ runner.os }}-pip-${{ hashFiles('pip/*.txt') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pip- | |
# - name: Install dependencies | |
# run: | | |
# python3.9 -m pip install --upgrade pip | |
# pip install -e . | |
# if [ -f pip/cpu_requirements.txt ]; then pip install -r pip/cpu_requirements.txt; fi | |
# if [ -f pip/dev_requirements.txt ]; then pip install -r pip/dev_requirements.txt; fi | |
# - name: pytest | |
# run: | | |
# # TODO: Run this test with pytest for paralell testing | |
# # python3.9 -m pytest -n 2 --capture=sys --capture=fd --cov=atomsci -vv atomsci/ddm/test/integrative | |
# cd atomsci/ddm/test/integrative && ./integrative_batch_chunk_tests 2 | |
# env: | |
# ENV: test | |
# - name: Move .coverage to root | |
# run: | | |
# if [ -f atomsci/ddm/test/integrative/.coverage* ]; then | |
# mv atomsci/ddm/test/integrative/.coverage* $GITHUB_WORKSPACE | |
# fi | |
# - name: Check for .coverage file | |
# run: ls -la .coverage* || echo ".coverage not found" | |
# - name: Combine coverage files | |
# run: | | |
# if ls .coverage* 1> /dev/null 2>&1; then | |
# coverage combine .coverage* | |
# fi | |
# - name: Upload coverage-part4 | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: coverage-part4 | |
# path: .coverage | |
# if-no-files-found: ignore | |
# pytest-integrative-4: | |
# runs-on: ubuntu-24.04 | |
# strategy: | |
# matrix: | |
# python-version: ["3.9"] | |
# steps: | |
# - name: System Dependencies | |
# run: | | |
# sudo apt install -y build-essential \ | |
# libcairo2-dev \ | |
# pkg-config \ | |
# python3-dev \ | |
# python3-openssl | |
# - uses: actions/checkout@v4 | |
# - name: Set up Python ${{ matrix.python-version }} | |
# uses: actions/setup-python@v4 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# - name: Cache Python dependencies | |
# uses: actions/cache@v4 | |
# with: | |
# path: ~/.cache/pip | |
# key: ${{ runner.os }}-pip-${{ hashFiles('pip/*.txt') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pip- | |
# - name: Install dependencies | |
# run: | | |
# python3.9 -m pip install --upgrade pip | |
# pip install -e . | |
# if [ -f pip/cpu_requirements.txt ]; then pip install -r pip/cpu_requirements.txt; fi | |
# if [ -f pip/dev_requirements.txt ]; then pip install -r pip/dev_requirements.txt; fi | |
# - name: pytest | |
# run: | | |
# # TODO: Run this test with pytest for paralell testing | |
# # python3.9 -m pytest -n 2 --capture=sys --capture=fd --cov=atomsci -vv atomsci/ddm/test/integrative | |
# cd atomsci/ddm/test/integrative && ./integrative_batch_chunk_tests 3 | |
# env: | |
# ENV: test | |
# - name: Move .coverage to root | |
# run: | | |
# if [ -f atomsci/ddm/test/integrative/.coverage* ]; then | |
# mv atomsci/ddm/test/integrative/.coverage* $GITHUB_WORKSPACE | |
# fi | |
# - name: Check for .coverage file | |
# run: ls -la .coverage* || echo ".coverage not found" | |
# - name: Combine coverage files | |
# run: | | |
# if ls .coverage* 1> /dev/null 2>&1; then | |
# coverage combine .coverage* | |
# fi | |
# - name: Upload coverage-part5 | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: coverage-part5 | |
# path: .coverage | |
# if-no-files-found: ignore | |
# combine-and-upload: | |
# name: Combine codecov and upload | |
# runs-on: ubuntu-latest | |
# needs: [pytest-unit, pytest-integrative-1, pytest-integrative-2, pytest-integrative-3, pytest-integrative-4] | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: actions/setup-python@v5 | |
# with: | |
# python-version: "3.9" | |
# - run: pip install coverage codecov | |
# - name: Check current directory | |
# run: pwd | |
# - name: Check for .coverage file | |
# run: ls -la .coverage* coverage* || echo ".coverage not found" | |
# # Download all coverage artifacts | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: coverage-part1 | |
# path: coverage1 | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: coverage-part2 | |
# path: coverage2 | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: coverage-part3 | |
# path: coverage3 | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: coverage-part4 | |
# path: coverage4 | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: coverage-part5 | |
# path: coverage5 | |
# # Move and rename .coverage files | |
# - name: Move and rename coverage files | |
# run: | | |
# mv coverage1/.coverage .coverage.1 | |
# mv coverage2/.coverage .coverage.2 | |
# mv coverage3/.coverage .coverage.3 | |
# mv coverage4/.coverage .coverage.4 | |
# mv coverage5/.coverage .coverage.5 | |
# # Combine coverage data | |
# - name: Combine coverage data | |
# run: coverage combine .coverage.1 .coverage.2 .coverage.3 .coverage.4 .coverage.5 | |
# # Generate XML report | |
# - name: Generate XML report | |
# run: coverage xml | |
# # Upload to Codecov | |
# - name: Upload coverage reports to Codecov | |
# uses: codecov/codecov-action@v4 | |
# with: | |
# files: ./coverage.xml | |
# fail_ci_if_error: true | |
# env: | |
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |