Skip to content

Commit 1a8785a

Browse files
authored
Merge pull request #53 from AhmedBasem20/analysis/optimize-runtime
Speed up the algorithm analysis workflow
2 parents 89bbe0d + 6c6cebb commit 1a8785a

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

.github/workflows/analysis.yml

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ jobs:
1818
uses: actions/setup-python@v5
1919
with:
2020
python-version: "3.11"
21-
cache: 'pip'
22-
# - name: Cache virtualenv
23-
# uses: actions/cache@v3
24-
# with:
25-
# key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('requirements.txt') }}
26-
# path: .venv
21+
- name: Cache pip
22+
uses: actions/cache@v3
23+
id: pip-cache
24+
with:
25+
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}
26+
path: ${{ env.pythonLocation }}
27+
if: steps.pip-cache.outputs.cache-hit != 'true'
28+
2729
- name: Install dependencies
2830
run: |
29-
python -m venv .venv
30-
source .venv/bin/activate
31-
python -m pip install -r requirements.txt
32-
python -m pip install pytest
31+
pip install -r requirements.txt
32+
3333
- name: Read algorithms
3434
id: algorithms
3535
run: |
@@ -58,21 +58,16 @@ jobs:
5858
uses: actions/setup-python@v5
5959
with:
6060
python-version: "3.11"
61-
cache: 'pip'
62-
# - name: Cache virtualenv
63-
# uses: actions/cache@v3
64-
# with:
65-
# key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version}}-${{ hashFiles('requirements.txt') }}
66-
# path: .venv
67-
- name: Install dependencies
68-
run: |
69-
python -m venv .venv
70-
source .venv/bin/activate
71-
python -m pip install -r requirements.txt
72-
python -m pip install pytest
61+
if: steps.pip-cache.outputs.cache-hit != 'true'
62+
- name: Restore cache
63+
id: python-cache
64+
uses: actions/cache@v3
65+
with:
66+
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}
67+
path: ${{ env.pythonLocation }}
68+
7369
- name: Generate fitting data
7470
run: |
75-
source .venv/bin/activate
7671
python -m pytest -m slow --selectAlgorithm ${{ matrix.algorithm }} --saveFileName test_output_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv --SNR ${{ matrix.SNR }} --fitCount 300 --saveDurationFileName test_duration_${{ matrix.algorithm }}_${{ matrix.SNR }}.csv
7772
- name: Upload raw data
7873
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)