desophos/idleon-saver

View on GitHub
.github/workflows/build.yml

Summary

Maintainability
Test Coverage
name: Build

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  workflow_dispatch:

jobs:
  build:
    defaults:
      run:
        shell: bash
    runs-on: windows-latest
    steps:
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.9

      - name: Install Poetry
        uses: snok/install-poetry@v1
        with:
          version: 1.2.0b1

      - name: Cache PyInstaller
        uses: actions/cache@v2
        id: cache-pyinstaller
        env:
          cache-name: cache-pyinstaller
        with:
          path: pyinstaller
          key: ${{ runner.os }}-build-${{ env.cache-name }}
          restore-keys: |
            ${{ runner.os }}-build-
            ${{ runner.os }}-

      - name: Clone PyInstaller
        if: steps.cache-pyinstaller.outputs.cache-hit != 'true'
        uses: actions/checkout@v2
        with:
          repository: pyinstaller/pyinstaller
          ref: v4.5.1
          path: pyinstaller

      - name: Build bootloader
        if: steps.cache-pyinstaller.outputs.cache-hit != 'true'
        run: |
          cd pyinstaller/bootloader
          python ./waf all

      - name: Check out repository
        uses: actions/checkout@v2
        with:
          path: main
          submodules: true

      - name: Install PyInstaller
        run: |
          cd main
          poetry add $GITHUB_WORKSPACE/pyinstaller/ --no-interaction

      - name: Install dependencies
        run: |
          cd main
          poetry install --no-interaction --no-root

      - name: Install package
        run: |
          cd main
          poetry install --no-interaction

      - name: Build exe
        run: |
          cd main
          poetry run pyinstaller -y onefile.spec
        env:
          KIVY_GL_BACKEND: angle_sdl2

      - name: Archive exe
        uses: actions/upload-artifact@v2
        with:
          name: IdleonSaver.exe
          path: main/dist/IdleonSaver.exe