-
Notifications
You must be signed in to change notification settings - Fork 3
155 lines (135 loc) · 5.03 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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