|
| 1 | +name: Unit Test with pytest |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build-linux: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + strategy: |
| 9 | + max-parallel: 5 |
| 10 | + |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + with: |
| 14 | + fetch-depth: 0 |
| 15 | + |
| 16 | + - name: Warn if PR is to main |
| 17 | + if: github.event_name == 'pull_request' && github.base_ref == 'main' |
| 18 | + run: | |
| 19 | + echo "::warning::This pull request is targeting the 'main' branch. Please ensure this is intended." |
| 20 | +
|
| 21 | + - name: Update submodule |
| 22 | + run: | |
| 23 | + git submodule init && git submodule update --recursive --remote |
| 24 | +
|
| 25 | + - name: Set up Python 3.11 |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: '3.11' |
| 29 | + - name: Add conda to system path |
| 30 | + run: | |
| 31 | + # $CONDA is an environment variable pointing to the root of the miniconda directory |
| 32 | + echo $CONDA/bin >> $GITHUB_PATH |
| 33 | + - name: Install dependencies |
| 34 | + run: | |
| 35 | + pip install behave pytest tabulate pyparsing sqlalchemy numpy pydantic pydot sqlalchemy_utils django python-dotenv deprecated pandas pyspellchecker rtree |
| 36 | + wget -O /tmp/ifcopenshell_python.zip https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-`python3 -c 'import sys;print("".join(map(str, sys.version_info[0:2])))'`-v0.8.0-90ae709-linux64.zip |
| 37 | + mkdir -p `python3 -c 'import site; print(site.getusersitepackages())'` |
| 38 | + unzip -d `python3 -c 'import site; print(site.getusersitepackages())'` /tmp/ifcopenshell_python.zip |
| 39 | + - name: Lint with flake8 |
| 40 | + run: | |
| 41 | + pip install flake8 |
| 42 | + # stop the build if there are Python syntax errors or undefined names |
| 43 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 44 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 45 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 46 | + - name: Test with pytest |
| 47 | + run: | |
| 48 | + pytest -sv |
0 commit comments