Skip to content

ocp-freecad-cam-ci #107

ocp-freecad-cam-ci

ocp-freecad-cam-ci #107

Workflow file for this run

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: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest"]
release: ["weekly-builds", "0.21.2"]
python: [ "3.10", "3.11" ]
exclude:
# does not exist
- release: "weekly-builds"
python: "3.11"
# causes an access violation on python interpreter exit
- os: "windows-latest"
python: "3.11"
include:
- python: "3.10"
release: "weekly-builds"
os: "ubuntu-latest"
primary: true
- 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 (Linux)
if: matrix.os == 'ubuntu-latest'
env:
RELEASE: ${{ matrix.release }}
PYPATTERN: ${{ matrix.pypattern }}
PYVER: ${{ matrix.python }}
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
$PWD/squashfs-root/usr/bin/python -m venv --system-site-packages venv
echo "$PWD/squashfs-root/usr/lib" > venv/lib/python${PYVER}/site-packages/freecad.pth
echo "$PWD/../src" > venv/lib/python${PYVER}/site-packages/ocp_freecad_cam.pth
- name: Setup FreeCAD (Windows)
if: matrix.os == 'windows-latest'
env:
RELEASE: ${{ matrix.release }}
PYPATTERN: ${{ matrix.pypattern }}
PYVER: ${{ matrix.python }}
run: |
mkdir freecad
cd freecad
(Invoke-WebRequest -Uri "https://github.com/voneiden/FreeCAD-Bundle/releases/expanded_assets/${{ matrix.release }}").Content -match 'href="([^"]*.x86_64-${{ matrix.pypattern }}.7z)"' | Out-Null
Invoke-WebRequest -Uri ("https://github.com" + $matches[1]) -OutFile freecad.7z
7z x freecad.7z
Invoke-Expression (".\" + (Get-ChildItem . "FreeCAD_*" | select -first 1).Name + "\bin\python -m venv --system-site-packages venv")
"$($PWD)\..\src" | Out-File -FilePath "venv\Lib\site-packages\ocp_freecad_cam.pth"
- name: Test FreeCAD is available (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
source freecad/venv/bin/activate
echo $PYTHONPATH
python -c "import sys; print(sys.path)"
python -c "import FreeCAD"
- name: Test FreeCAD is available (Windows)
if: matrix.os == 'windows-latest'
run: |
.\freecad\venv\Scripts\activate
echo $PYTHONPATH
python -c "import sys; print(sys.path)"
python -c "import FreeCAD"
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
source freecad/venv/bin/activate
python -m pip install --upgrade pip
pip install cadquery build123d
pip install -r requirements-dev.txt
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
.\freecad\venv\Scripts\activate
python -m pip install --upgrade pip
pip install cadquery build123d
pip install -r requirements-dev.txt
- name: Check black
if: matrix.primary
run: |
source freecad/venv/bin/activate
black --check src
black --check tests
#- name: Check flake8
# uses: liskin/gh-problem-matcher-wrap@v2
# with:
# linters: flake8
# run: flake8
- name: Check isort
if: matrix.primary
run: |
source freecad/venv/bin/activate
isort src tests --check-only --diff
- name: Run tests (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
source freecad/venv/bin/activate
python -m pytest -ra -vvv --cov=src --cov-report xml tests
- name: Run tests (Windows)
if: matrix.os == 'windows-latest'
run: |
.\freecad\venv\Scripts\activate
python -m pytest -ra -vvv tests
- name: Codecov
if: matrix.primary
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml