Skip to content

Commit

Permalink
add restore to rest of the workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
YigitElma committed Aug 21, 2024
1 parent 4927894 commit bf158a0
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 3 deletions.
29 changes: 26 additions & 3 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,31 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies

- name: Restore Python environment cache
id: restore-env
uses: actions/cache/restore@v4
with:
path: .venv-3.9
key: ${{ runner.os }}-venv-3.9-${{ hashFiles('devtools/dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-3.9-
- name: Check if virtual environment exists
if: steps.restore-env.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r devtools/dev-requirements.txt
echo "Error: Virtual environment .venv-3.9 not found!"
exit 1
- name: Activate virtual environment
run: |
source .venv-3.9/bin/activate
- name: Benchmark with pytest-benchmark
run: |
pwd
Expand All @@ -48,11 +65,13 @@ jobs:
--benchmark-save='Latest_Commit' \
--durations=0 \
--benchmark-save-data
- name: Checkout current master
uses: actions/checkout@v4
with:
ref: master
clean: false

- name: Checkout benchmarks from PR head
run: git checkout ${{ github.event.pull_request.head.sha }} -- tests/benchmarks
- name: Benchmark with pytest-benchmark
Expand All @@ -64,6 +83,7 @@ jobs:
--benchmark-save='master' \
--durations=0 \
--benchmark-save-data
- name: put benchmark results in same folder
run: |
pwd
Expand All @@ -75,19 +95,22 @@ jobs:
mkdir compare_results
cp $t1 compare_results
cp $t2 compare_results
- name: Compare latest commit results to the master branch results
run: |
pwd
cd tests/benchmarks
python compare_bench_results.py
cat commit_msg.txt
- name: comment PR with the results
uses: thollander/actions-comment-pull-request@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filePath: tests/benchmarks/commit_msg.txt
comment_tag: benchmark

- name: Upload benchmark data
if: always()
uses: actions/upload-artifact@v4
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/nbtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,26 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Restore Python environment cache
id: restore-env
uses: actions/cache/restore@v4
with:
path: .venv-${{ matrix.python-version }}
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('devtools/dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-${{ matrix.python-version }}-
- name: Check if virtual environment exists
if: steps.restore-env.outputs.cache-hit != 'true'
run: |
echo "Error: Virtual environment .venv-${{ matrix.python-version }} not found!"
exit 1
- name: Activate virtual environment
run: |
source .venv-${{ matrix.python-version }}/bin/activate
- name: Test notebooks with pytest and nbmake
run: |
source .venv-${{ matrix.python-version }}/bin/activate
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/regression_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Restore Python environment cache
id: restore-env
uses: actions/cache/restore@v4
Expand All @@ -52,6 +53,7 @@ jobs:
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10

- name: Test with pytest
run: |
source .venv-${{ matrix.python-version }}/bin/activate
Expand All @@ -69,6 +71,7 @@ jobs:
--group ${{ matrix.group }} \
--splitting-algorithm least_duration \
--db ./prof.db
- name: save coverage file and plot comparison results
if: always()
uses: actions/upload-artifact@v4
Expand All @@ -78,6 +81,7 @@ jobs:
./cov.xml
./mpl_results.html
./prof.db
- name: Upload coverage
id : codecov
uses: Wandalen/[email protected]
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,31 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.combos.python_version }}

- name: Restore Python environment cache
id: restore-env
uses: actions/cache/restore@v4
with:
path: .venv-${{ matrix.combos.python_version }}
key: ${{ runner.os }}-venv-${{ matrix.combos.python_version }}-${{ hashFiles('devtools/dev-requirements.txt') }}
restore-keys: |
${{ runner.os }}-venv-${{ matrix.combos.python_version }}-
- name: Check if virtual environment exists
if: steps.restore-env.outputs.cache-hit != 'true'
run: |
echo "Error: Virtual environment .venv-${{ matrix.combos.python_version }} not found!"
exit 1
- name: Activate virtual environment
run: |
source .venv-${{ matrix.combos.python_version }}/bin/activate
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10

- name: Test with pytest
run: |
pwd
Expand All @@ -58,6 +76,7 @@ jobs:
--group ${{ matrix.combos.group }} \
--splitting-algorithm least_duration \
--db ./prof.db
- name: save coverage file and plot comparison results
if: always()
uses: actions/upload-artifact@v4
Expand All @@ -67,6 +86,7 @@ jobs:
./cov.xml
./mpl_results.html
./prof.db
- name: Upload coverage
id : codecov
uses: Wandalen/[email protected]
Expand Down

0 comments on commit bf158a0

Please sign in to comment.