python-tests #930
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: python-tests | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
schedule: | |
- cron: '14 0 * * 3,6' # https://crontab.guru/#14_0_*_*_3,6 - "At 00:14 on Wednesday and Saturday." | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out ApprovalTests.cpp | |
uses: actions/checkout@v4 | |
with: | |
path: ApprovalTests/ApprovalTests.cpp | |
- name: Check out ApprovalTests.cpp.StarterProject | |
uses: actions/checkout@v4 | |
with: | |
repository: approvals/ApprovalTests.cpp.StarterProject | |
path: ApprovalTests/ApprovalTests.cpp.StarterProject | |
- name: Check out claremacrae fork of conan-center-index | |
uses: actions/checkout@v4 | |
with: | |
repository: claremacrae/conan-center-index | |
path: conan/conan-center-index-claremacrae | |
- name: Add upstream remote to conan-center-index-claremacrae, for testing dummy release | |
run: | | |
cd conan/conan-center-index-claremacrae | |
git remote add upstream https://github.com/conan-io/conan-center-index.git | |
- name: Check out llewellyn's fork of vcpkg | |
uses: actions/checkout@v4 | |
with: | |
repository: isidore/vcpkg | |
path: ApprovalTests/vcpkg | |
- name: Add upstream remote to vcpkg, for testing dummy release | |
run: | | |
cd ApprovalTests/vcpkg | |
git remote add upstream https://github.com/microsoft/vcpkg.git | |
- name: print dir | |
run: | | |
sudo apt-get install tree | |
tree -d -L 2 . | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
with: | |
pandoc-version: '2.9.2.1' | |
- name: Install dependencies | |
run: | | |
cd ApprovalTests/ApprovalTests.cpp | |
cd build | |
./install_python_requirements.sh | |
- name: Check type hints | |
run: | | |
python3 -m pip install types-PyYAML | |
cd ApprovalTests/ApprovalTests.cpp/build | |
./check_type_hints.sh | |
- name: Lint with flake8 | |
run: | | |
cd ApprovalTests/ApprovalTests.cpp | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test build/ with pytest | |
run: | | |
cd ApprovalTests/ApprovalTests.cpp | |
cd build | |
python3 -m unittest discover -s tests --verbose | |
- name: Test doc/sphinx with pytest | |
run: | | |
cd ApprovalTests/ApprovalTests.cpp | |
cd doc/sphinx/tests | |
python3 -m unittest discover -t ../.. --verbose | |
- name: Check preparing a release works | |
run: | | |
cd ApprovalTests/ApprovalTests.cpp/build | |
cat automation_hack_all_yesses.txt | ./prepare_minor_release.py |