|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - dev |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - dev |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ci-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + |
| 17 | + lint-build: |
| 18 | + name: Linting |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + - name: Set up Python |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: 3.12 |
| 28 | + - name: Install dependencies |
| 29 | + run: | |
| 30 | + python -m pip install --upgrade pip |
| 31 | + pip install ruff |
| 32 | + - name: Ruff lint |
| 33 | + run: | |
| 34 | + ruff check --output-format=github . |
| 35 | +
|
| 36 | + docs-build: |
| 37 | + name: Docs |
| 38 | + runs-on: ubuntu-latest |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + - name: Set up Python |
| 44 | + uses: actions/setup-python@v5 |
| 45 | + with: |
| 46 | + python-version: 3.12 |
| 47 | + - name: Install calculix dependencies |
| 48 | + run: | |
| 49 | + sudo apt-get update -y -qq |
| 50 | + sudo apt-get install -qq -y calculix-ccx libglu1-mesa gmsh |
| 51 | + - name: Install dev dependencies |
| 52 | + run: | |
| 53 | + python -m pip install --upgrade pip |
| 54 | + pip install -U -e .[docs] |
| 55 | + - name: Build docs |
| 56 | + run: | |
| 57 | + cd docs |
| 58 | + sphinx-build --builder html . out |
| 59 | + test-builds: |
| 60 | + name: ${{ matrix.name }} |
| 61 | + runs-on: ${{ matrix.os }} |
| 62 | + strategy: |
| 63 | + fail-fast: false |
| 64 | + matrix: |
| 65 | + include: |
| 66 | + - name: Test py39 |
| 67 | + os: ubuntu-latest |
| 68 | + pyversion: '3.9' |
| 69 | + - name: Test py310 |
| 70 | + os: ubuntu-latest |
| 71 | + pyversion: '3.10' |
| 72 | + - name: Test py311 |
| 73 | + os: ubuntu-latest |
| 74 | + pyversion: '3.11' |
| 75 | + - name: Test py312 |
| 76 | + os: ubuntu-latest |
| 77 | + pyversion: '3.12' |
| 78 | + - name: Test py313 |
| 79 | + os: ubuntu-latest |
| 80 | + pyversion: '3.13' |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v4 |
| 83 | + - name: Set up Python ${{ matrix.pyversion }} |
| 84 | + uses: actions/setup-python@v5 |
| 85 | + with: |
| 86 | + python-version: ${{ matrix.pyversion }} |
| 87 | + - name: Install calculix |
| 88 | + if: matrix.os == 'ubuntu-latest' |
| 89 | + run: | |
| 90 | + sudo apt-get update -y -qq |
| 91 | + sudo apt-get install -qq -y calculix-ccx |
| 92 | + - name: Install package and dev dependencies |
| 93 | + run: | |
| 94 | + python -m pip install --upgrade pip |
| 95 | + pip install . |
| 96 | + pip install .[tests] |
| 97 | + pip install .[support] |
| 98 | + rm -r pyccx |
| 99 | + - name: Unit tests with pytest |
| 100 | + run: | |
| 101 | + pytest tests/ |
| 102 | + test-coverage: |
| 103 | + name: Test Coverage |
| 104 | + runs-on: ubuntu-latest |
| 105 | + strategy: |
| 106 | + fail-fast: false |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@v4 |
| 109 | + - name: Set up Python |
| 110 | + uses: actions/setup-python@v5 |
| 111 | + with: |
| 112 | + python-version: 3.12 |
| 113 | + - name: Install calculix |
| 114 | + run: | |
| 115 | + sudo apt-get update -y -qq |
| 116 | + sudo apt-get install -qq -y calculix-ccx gmsh libglu1-mesa |
| 117 | + - name: Install package and dev dependencies |
| 118 | + run: | |
| 119 | + python -m pip install --upgrade pip |
| 120 | + pip install . |
| 121 | + pip install .[tests] |
| 122 | + pip install .[support] |
| 123 | + rm -r pyccx |
| 124 | + - name: Run Pytest coverage |
| 125 | + run: | |
| 126 | + pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=pyccx tests/ | tee pytest-coverage.txt |
| 127 | + - name: Pytest coverage comment |
| 128 | + uses: MishaKav/pytest-coverage-comment@main |
| 129 | + with: |
| 130 | + pytest-coverage-path: ./pytest-coverage.txt |
| 131 | + junitxml-path: ./pytest.xml |
| 132 | + test-examples-build: |
| 133 | + name: Test examples ${{ matrix.pyversion }} |
| 134 | + runs-on: ${{ matrix.os }} |
| 135 | + strategy: |
| 136 | + fail-fast: false |
| 137 | + matrix: |
| 138 | + include: |
| 139 | + - os: ubuntu-latest |
| 140 | + pyversion: '3.10' |
| 141 | + - os: ubuntu-latest |
| 142 | + pyversion: '3.12' |
| 143 | + steps: |
| 144 | + - uses: actions/checkout@v4 |
| 145 | + - name: Set up Python |
| 146 | + uses: actions/setup-python@v5 |
| 147 | + with: |
| 148 | + python-version: 3.12 |
| 149 | + - name: Install calculix solver |
| 150 | + run: | |
| 151 | + sudo apt-get update -y -qq |
| 152 | + sudo apt-get install -qq -y calculix-ccx gmsh libglu1-mesa |
| 153 | + - name: Install dev dependencies |
| 154 | + run: | |
| 155 | + python -m pip install --upgrade pip |
| 156 | + pip install -e .[examples] |
| 157 | + - name: Show pyccx version and calculix version |
| 158 | + run: | |
| 159 | + python -c "import pyccx; print(pyccx.__version__)" |
| 160 | + python -c "import pyccx; print(pyccx.Simulation.version())" |
| 161 | +
|
| 162 | + release-build: |
| 163 | + name: Build release on ubuntu-latest |
| 164 | + runs-on: ubuntu-latest |
| 165 | + strategy: |
| 166 | + fail-fast: false |
| 167 | + steps: |
| 168 | + - uses: actions/checkout@v4 |
| 169 | + - name: Set up Python |
| 170 | + uses: actions/setup-python@v5 |
| 171 | + with: |
| 172 | + python-version: 3.12 |
| 173 | + - name: Install Hatch |
| 174 | + uses: pypa/hatch@install |
| 175 | + - name: Install calculix solver |
| 176 | + run: | |
| 177 | + sudo apt-get update -y -qq |
| 178 | + sudo apt-get install -qq -y calculix-ccx gmsh libglu1-mesa |
| 179 | + - name: Install dev dependencies |
| 180 | + run: | |
| 181 | + python -m pip install --upgrade pip |
| 182 | + pip install -U setuptools flit build twine hatchling |
| 183 | + - name: Create source distribution |
| 184 | + run: | |
| 185 | + python -m build -n -s |
| 186 | + - name: Build wheel |
| 187 | + run: | |
| 188 | + python -m build -n -w |
| 189 | + - name: Test sdist |
| 190 | + shell: bash |
| 191 | + run: | |
| 192 | + rm -rf ./pyccx |
| 193 | + pushd $HOME |
| 194 | + pip install $GITHUB_WORKSPACE/dist/*.tar.gz |
| 195 | + python -c "import pyccx; print(pyccx.__version__)" |
| 196 | + popd |
| 197 | + # don't run tests, we just want to know if the sdist can be installed |
| 198 | + pip uninstall -y pyccx |
| 199 | + git reset --hard HEAD |
| 200 | + - name: Twine check |
| 201 | + run: | |
| 202 | + twine check dist/* |
| 203 | + - name: Upload distributions |
| 204 | + uses: actions/upload-artifact@v4 |
| 205 | + with: |
| 206 | + path: dist |
| 207 | + name: dist |
0 commit comments