check if file exist. then move to root dir for upload #424
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: Move .coverage to root | |
run: | | |
if [ -f atomsci/ddm/test/unit/.coverage ]; then | |
mv atomsci/ddm/test/unit/.coverage . | |
fi | |
- name: Check for .coverage file | |
run: ls -l .coverage || echo ".coverage not found" | |
- name: Upload coverage-part1 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-part1 | |
path: .coverage | |
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: 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: Move .coverage to root | |
run: | | |
if [ -f atomsci/ddm/test/integrative/.coverage ]; then | |
mv atomsci/ddm/test/integrative/.coverage . | |
fi | |
- name: Check for .coverage file | |
run: ls -l .coverage || echo ".coverage not found" | |
- name: Upload coverage-part2 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-part2 | |
path: .coverage | |
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 . | |
fi | |
- name: Check for .coverage file | |
run: ls -l .coverage || echo ".coverage not found" | |
- name: Upload coverage-part3 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-part3 | |
path: .coverage | |
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 . | |
fi | |
- name: Check for .coverage file | |
run: ls -l .coverage || echo ".coverage not found" | |
- name: Upload coverage-part4 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-part4 | |
path: .coverage | |
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 . | |
fi | |
- name: Check for .coverage file | |
run: ls -l .coverage || echo ".coverage not found" | |
- name: Upload coverage-part5 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-part5 | |
path: .coverage | |
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 | |
# 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 }} |