Skip to content

Commit ffd0574

Browse files
committed
CI - Add benchmark job
1 parent 6a6a043 commit ffd0574

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,55 @@ jobs:
319319
. venv/bin/activate
320320
coveralls --rcfile=${{ env.COVERAGERC_FILE }} --service=github
321321
322+
benchmark-linux:
323+
name: Run benchmark tests Python ${{ matrix.python-version }} (Linux)
324+
runs-on: ubuntu-latest
325+
needs: prepare-tests-linux
326+
strategy:
327+
fail-fast: false
328+
matrix:
329+
python-version: [3.8, 3.9]
330+
steps:
331+
- name: Check out code from GitHub
332+
uses: actions/checkout@v2.3.4
333+
- name: Set up Python ${{ matrix.python-version }}
334+
id: python
335+
uses: actions/setup-python@v2.2.1
336+
with:
337+
python-version: ${{ matrix.python-version }}
338+
- name: Restore Python virtual environment
339+
id: cache-venv
340+
uses: actions/cache@v2.1.4
341+
with:
342+
path: venv
343+
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
344+
needs.prepare-tests-linux.outputs.python-key }}
345+
- name: Fail job if Python cache restore failed
346+
if: steps.cache-venv.outputs.cache-hit != 'true'
347+
run: |
348+
echo "Failed to restore Python venv from cache"
349+
exit 1
350+
- name: Run pytest
351+
run: |
352+
. venv/bin/activate
353+
pip install pygal
354+
pip install -e .
355+
pytest --exitfirst \
356+
--benchmark-only \
357+
--benchmark-autosave \
358+
--benchmark-save-data \
359+
--benchmark-group-by="group"
360+
- name: Create partial artifact name suffix
361+
id: artifact-name-suffix
362+
run: >-
363+
echo "::set-output name=datetime::"$(date "+%Y%m%d_%H%M")
364+
- name: Upload benchmark artifact
365+
uses: actions/upload-artifact@v2.2.2
366+
with:
367+
name: benchmark-${{ runner.os }}-${{ matrix.python-version }}_${{
368+
steps.artifact-name-suffix.outputs.datetime }}
369+
path: .benchmarks/
370+
322371

323372
pytest-windows:
324373
name: Run tests Python ${{ matrix.python-version }} (Windows)

0 commit comments

Comments
 (0)