CI: Fix windows installer test (pip only binary) #418
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: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test-python-package: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Build and install ms2rescore package | |
run: | | |
pip install --only-binary :all: .[dev] | |
- name: Test with pytest | |
run: | | |
pytest | |
- name: Test installation | |
run: | | |
ms2rescore --help | |
test-windows-installer: | |
# Only run on push to main (e.g., after PR merge) | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: Install package and dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --only-binary :all: . pyinstaller | |
- name: Install Inno Setup | |
uses: crazy-max/ghaction-chocolatey@v1 | |
with: | |
args: install innosetup -y --allow-unofficial --force | |
- name: Run pyinstaller | |
run: pyinstaller ./ms2rescore.spec --clean --noconfirm | |
- name: Test built exe | |
run: dist/ms2rescore/ms2rescore.exe | |
- name: Run Inno Setup | |
run: ISCC.exe ./ms2rescore_innosetup.iss /DAppVersion=${{ github.ref_name }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/*.exe |