Merge pull request #50 from QAInsights/feature/windows #43
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python. | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Hamster | |
on: | |
push: | |
branches: [ "main" ] | |
paths-ignore: | |
- '**/**.md' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
env: | |
RELEASE_TAG: v0.0.${{ github.run_number }} | |
INTEL_DMG: Hamster-x86-64-intel.dmg | |
ARM64_DMG: Hamster-arm64-silicon.dmg | |
strategy: | |
matrix: | |
# os: [ windows-latest ] | |
# arch: [ 'X86' ] | |
os: [ self-hosted, macos, windows-latest ] | |
arch: [ 'X64', 'ARM64', 'X86' ] | |
steps: | |
# - name: Checkout feature/windows branch | |
# uses: actions/checkout@v3 | |
# with: | |
# ref: feature/windows | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10.11" | |
- name: Install dependencies in Windows | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r .\windows\requirements.txt | |
if: matrix.os == 'windows' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install py2app | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
if: matrix.os == 'macos' || matrix.os == 'self-hosted' | |
- name: Generate app for intel architecture | |
run: | | |
python setup.py py2app | |
mv dist dist-intel | |
if: matrix.os == 'macos' && matrix.arch == 'X64' | |
- name: Generate app for arm64 architecture | |
run: | | |
python setup.py py2app | |
mv dist dist-arm64 | |
if: matrix.os == 'self-hosted' && matrix.arch == 'ARM64' | |
- name: Generate app for windows | |
run: | | |
python .\windows\setup.py bdist_msi | |
mv dist dist-windows | |
if: matrix.os == 'windows' | |
- name: Convert dist-intel to DMG | |
run: | | |
hdiutil create -volname "Hamster" -srcfolder dist-intel -ov -format UDZO dist-intel/${{ env.INTEL_DMG }} | |
if: matrix.os == 'macos' && matrix.arch == 'X64' | |
- name: Convert dist-arm64 to DMG | |
run: | | |
hdiutil create -volname "Hamster" -srcfolder dist-arm64 -ov -format UDZO dist-arm64/${{ env.ARM64_DMG }} | |
if: matrix.os == 'self-hosted' && matrix.arch == 'ARM64' | |
- name: Upload intel app | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Hamster-macos-intel-x86_64 | |
path: dist-intel/Hamster-intel.dmg | |
if: matrix.os == 'macos' && matrix.arch == 'X64' | |
- name: Upload arm64 app | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Hamster-macos-apple-arm64 | |
path: dist-arm64/Hamster-darwin.dmg | |
if: matrix.os == 'self-hosted' && matrix.arch == 'ARM64' | |
- name: Upload windows app | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Hamster-windows-x86_64 | |
path: dist-windows/Hamster-*.msi | |
if: matrix.os == 'windows' | |
- name: GitHub Tag | |
uses: mathieudutour/[email protected] | |
with: | |
tag: ${{ env.RELEASE_TAG }} | |
github_token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }} | |
- name: Release Darwin | |
uses: softprops/action-gh-release@v1 | |
if: github.ref == 'refs/heads/main' && matrix.os == 'macos' && matrix.arch == 'ARM64' | |
with: | |
token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }} | |
body: 'Release for commit ${{ github.sha }}' | |
tag_name: ${{ env.RELEASE_TAG }} | |
generate_release_notes: true | |
files: | | |
dist-arm64/${{ env.ARM64_DMG }} | |
- name: Release Intel | |
uses: softprops/action-gh-release@v1 | |
if: github.ref == 'refs/heads/main' && matrix.os == 'macos' && matrix.arch == 'X64' | |
with: | |
token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }} | |
body: 'Release for commit ${{ github.sha }}' | |
generate_release_notes: true | |
tag_name: ${{ env.RELEASE_TAG }} | |
files: | | |
dist-intel/${{ env.INTEL_DMG }} | |
- name: Release Windows | |
uses: softprops/action-gh-release@v1 | |
if: github.ref == 'refs/heads/main' && matrix.os == 'windows' | |
with: | |
token: ${{ secrets.HAMSTER_APP_RELEASE_SECRET }} | |
body: 'Release for commit ${{ github.sha }}' | |
generate_release_notes: true | |
tag_name: ${{ env.RELEASE_TAG }} | |
files: | | |
dist-windows/Hamster-*.msi |