Improve CI #51
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: ocp-freecad-cam-ci | |
on: | |
schedule: | |
- cron: "30 23 * * 1,5" | |
push: | |
branches: [ dev ] | |
pull_request: | |
branches: [ dev ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
release: ["weekly-builds", "0.21.2"] | |
python: [ "3.10", "3.11" ] | |
exclude: | |
- release: "weekly-builds" | |
python: "3.11" | |
include: | |
- python: "3.10" | |
pypattern: "py310" | |
- python: "3.11" | |
pypattern: "py311" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# Required by Sonar | |
fetch-depth: 0 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
- name: Setup FreeCAD | |
env: | |
RELEASE: ${{ matrix.release }} | |
PYPATTERN: ${{ matrix.pypattern }} | |
run: | | |
mkdir $PWD/freecad | |
cd $PWD/freecad | |
wget -O freecad.AppImage https://github.com$(curl -v --silent https://github.com/voneiden/FreeCAD-Bundle/releases/expanded_assets/${RELEASE} 2>&1 | sed -n 's/.*href="\([^"]*\).*/\1/p' | grep x86_64 | grep $PYPATTERN | grep AppImage$) | |
chmod +x freecad.AppImage | |
./freecad.AppImage --appimage-extract > /dev/null | |
export PYTHONPATH=.:$PWD/../src:$PWD/squashfs-root/usr/lib:$PWD/squashfs-root/usr/Mod/Path:$PWD/squashfs-root/usr/lib/python3.10/site-packages/ | |
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV | |
- name: Test FreeCAD is available | |
run: | | |
echo $PYTHONPATH | |
python -c "import sys; print(sys.path)" | |
python -c "import FreeCAD" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install cadquery | |
pip install -r requirements-dev.txt | |
- name: Check black | |
run: | | |
black --check src | |
black --check tests | |
#- name: Check flake8 | |
# uses: liskin/gh-problem-matcher-wrap@v2 | |
# with: | |
# linters: flake8 | |
# run: flake8 | |
- name: Check isort | |
uses: liskin/gh-problem-matcher-wrap@v2 | |
with: | |
linters: isort | |
run: | | |
isort src --check-only --diff | |
- name: Check isort | |
uses: liskin/gh-problem-matcher-wrap@v2 | |
with: | |
linters: isort | |
run: | | |
isort tests --check-only --diff | |
- name: Run tests | |
uses: liskin/gh-problem-matcher-wrap@v2 | |
with: | |
linters: pytest | |
run: pytest -ra -vvv --cov=src --cov-report xml tests | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml |