CreateAndTestRelease #21
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: CreateAndTestRelease | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'New PyMeshLab Version' | |
required: true | |
default: 'YYYY.MM' | |
env: | |
QT_VERSION: 5.15.2 | |
jobs: | |
update_version: | |
name: Update Version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Update PYML_VERSION | |
run: | | |
echo ${{ github.event.inputs.version }} | tr -d '\n'> PYML_VERSION | |
- name: Commit change | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Set PyMeshLab version to ${{ github.event.inputs.version }} | |
# first, we build PyMeshLab | |
build_pymeshlab: | |
name: Build PyMeshLab | |
runs-on: ${{ matrix.os }} | |
needs: update_version | |
strategy: | |
matrix: | |
pyversion: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
os: ['ubuntu-20.04', 'macos-latest', 'windows-latest'] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
ref: main | |
- name: Setup Windows env variables | |
if: runner.os == 'Windows' | |
run: | | |
echo "name=VCINSTALLDIR::C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC" >> $GITHUB_ENV | |
- name: Setup Windows MSVC | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
cache: true | |
version: ${{ env.QT_VERSION }} | |
- name: Install Python ${{ matrix.pyversion }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyversion }} | |
- name: Install dependencies | |
shell: bash | |
run: | | |
sh scripts/${{ runner.os }}/0_setup_env.sh | |
- name: Cache external libraries sources | |
id: cache-ext-libs | |
uses: actions/cache@v3 | |
with: | |
path: src/meshlab/src/external/downloads/* | |
key: ${{ runner.os }}-external-libraries | |
- name: Ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: ${{ runner.os }}-${{ github.ref }} | |
- name: Build PyMeshLab ${{ matrix.pyversion }} | |
run: | | |
sh scripts/${{ runner.os }}/1_build.sh --ccache --use_brew_llvm | |
- name: Deploy PyMeshLab ${{ matrix.pyversion }} | |
run: | | |
sh scripts/${{ runner.os }}/2_deploy.sh | |
- name: Upload PyMeshLab_${{ runner.os }}_python${{ matrix.pyversion }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: PyMeshLab_${{ runner.os }}_python${{ matrix.pyversion }} | |
path: pymeshlab | |
build_wheel: | |
name: Build PyMeshLab Wheel | |
runs-on: ${{ matrix.os }} | |
needs: build_pymeshlab | |
strategy: | |
matrix: | |
pyversion: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
os: ['ubuntu-20.04', 'macos-latest', 'windows-latest'] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Download PyMeshLab_${{ runner.os }}_python${{ matrix.pyversion }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: PyMeshLab_${{ runner.os }}_python${{ matrix.pyversion }} | |
path: pymeshlab/ | |
- name: Install Python ${{ matrix.pyversion }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyversion }} | |
- name: Build Wheel | |
shell: bash | |
run: | | |
pip install wheel | |
pip wheel . -w wheels/ | |
- name: Upload wheel ${{ runner.os }} python ${{ matrix.pyversion }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pymeshlab_whl_${{ runner.os }}_python${{ matrix.pyversion }} | |
path: wheels/pymeshlab*.whl | |
test_pymeshlab: | |
name: Test PyMeshLab | |
runs-on: ${{ matrix.os }} | |
needs: build_pymeshlab | |
strategy: | |
matrix: | |
pyversion: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] | |
steps: | |
- name: Download PyMeshLab_${{ runner.os }}_python${{ matrix.pyversion }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: PyMeshLab_${{ runner.os }}_python${{ matrix.pyversion }} | |
path: pymeshlab/ | |
- name: Install Python ${{ matrix.pyversion }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyversion }} | |
- name: Install dependencies | |
run: | | |
pip install pytest numpy | |
- name: Set CPU opengl | |
if: runner.os == 'Windows' | |
run: | | |
python -c 'import pymeshlab; pymeshlab.use_cpu_opengl()' #just for windows | |
- name: Run tests | |
run: | | |
pytest --pyargs pymeshlab -m "not glcontext" | |
#- name: Upload PyMeshLab results | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: PyMeshLabResults_${{ runner.os }}_python${{ matrix.pyversion }} | |
# path: pymeshlab/tests/sample_meshes/test_output | |
test_wheel: | |
name: Test Wheel | |
needs: build_wheel | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
pyversion: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] | |
steps: | |
- name: Download pymeshlab_whl_${{ runner.os }}_python${{ matrix.pyversion }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: pymeshlab_whl_${{ runner.os }}_python${{ matrix.pyversion }} | |
path: . | |
- name: Install Python ${{ matrix.pyversion }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.pyversion }} | |
- name: Install wheel and dependencies | |
shell: bash | |
run: | | |
pip install pytest numpy | |
pip install pymeshlab*.whl | |
- name: Set CPU opengl | |
if: runner.os == 'Windows' | |
run: | | |
python -c 'import pymeshlab; pymeshlab.use_cpu_opengl()' #just for windows | |
- name: Run tests | |
run: | | |
pytest --pyargs pymeshlab -m "not glcontext" | |
# after building and testing PyMeshLab for the three platforms, we create a release in github | |
create_release: | |
name: Create Release | |
needs: [test_pymeshlab, test_wheel] | |
runs-on: ubuntu-latest | |
steps: | |
#download all the artifact wheels | |
- name: Download Pymeshlab Wheels | |
uses: actions/download-artifact@v3 | |
with: | |
path: wheels/ | |
#Create release | |
- name: Create Release | |
uses: "ncipollo/release-action@v1" | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
tag: v${{ github.event.inputs.version }} | |
name: 'PyMeshLab v${{ github.event.inputs.version }}' | |
artifacts: | | |
wheels/pymeshlab_whl_*/pymeshlab*.whl |