Test scripts #194
This file contains 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: Test scripts | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '56 1 * * 2' | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
strategy: | |
max-parallel: 4 | |
fail-fast: false | |
matrix: | |
python-version: ['3.11', '3.10', '3.9', '3.8', '3.7'] | |
script_collection: | |
- 03-dns-empirical/collect | |
- 03-dns-empirical/plot | |
- 05-06-evaluation/scripts/exp_ctrl | |
- 05-06-evaluation/scripts/plots | |
steps: | |
- uses: actions/checkout@main | |
with: | |
submodules: true | |
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Provide script_collection to environment | |
if: matrix.script_collection == '05-06-evaluation/scripts/plots' | |
env: | |
script_collection: ${{ matrix.script_collection }} | |
run: | | |
script_collection="${script_collection////-}" | |
results_dir="05-06-evaluation/results" | |
echo "script_collection=${script_collection}" >> ${GITHUB_ENV} | |
echo "results_dir=${results_dir}" >> ${GITHUB_ENV} | |
- name: Cache tox environments | |
id: cache-tox | |
uses: actions/cache@main | |
with: | |
path: ${{ matrix.script_collection }}/.tox | |
# setup.cfg and tox.ini have versioning info that would impact the tox environment. | |
key: tox-${{ matrix.python-version }}-${{ matrix.script_collection }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@main | |
with: | |
cache: pip | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox | |
- name: Install LaTeX and matplotlib dependencies (for plots) | |
if: contains(matrix.script_collection, 'plot') | |
run: | | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install cm-super-minimal dvipng python3-matplotlib \ | |
texlive texlive-latex-extra texlive-fonts-extra tshark | |
- name: Test ${{ matrix.script_collection }} scripts | |
run: | | |
cd ${{ matrix.script_collection }} | |
pyenv="py$(echo "${{ matrix.python-version }}" | tr -d '.')" | |
toxenvs="lint,flake8,black,${pyenv}-test" | |
tox -e ${toxenvs} | |
# - uses: actions/upload-artifact@main | |
# name: Generate plots artifacts | |
# if: matrix.script_collection == '05-06-evaluation/scripts/plots' | |
# with: | |
# name: plots-${{ env.script_collection }}-py${{ matrix.python-version }} | |
# path: | | |
# ${{ env.results_dir }}/*.pdf | |
# ${{ env.results_dir }}/*.svg | |
# ${{ env.results_dir }}/*/*.pdf | |
# ${{ env.results_dir }}/*/*.svg | |
# retention-days: 8 |