From d0daba9b5b1cfcba4554e8a054f3325ec353bd9b Mon Sep 17 00:00:00 2001 From: Chase Lau Date: Tue, 16 Apr 2024 19:19:23 -0500 Subject: [PATCH] Update workflow to separate building from CI --- .github/workflows/build-and-release.yml | 79 +++++++++++++++++++ .github/workflows/flatpak-ci.yml | 28 ------- .../{python-app.yml => python-ci.yml} | 0 3 files changed, 79 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/build-and-release.yml delete mode 100644 .github/workflows/flatpak-ci.yml rename .github/workflows/{python-app.yml => python-ci.yml} (100%) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..3447157 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,79 @@ +name: Build and Release App + +on: + push: + # workflow_dispatch: + # release: + # types: [published] + +jobs: + build: + name: "Build application as Whl" + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + os: [ubuntu-22.04] + runs-on: ${{matrix.os}} + steps: + # Checkout repo and set up python + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: ${{matrix.python-version}} + # Install and configure poetry + - name: Install Poetry + uses: abatilo/actions-poetry@v2 + - name: Set up local virtual environment + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + # Load cached venv if it exists + - name: Cache packages + id: cached-poetry-dependencies + uses: actions/cache@v4 + with: + # This path is specific to ubuntu + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + # Install dependencies of cache does not exist + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: | + sudo apt install qt6-base-dev libsystemd-dev gcc + poetry install --no-interaction + # Compile and build Yin-Yang + - name: Compile ui, translations and resources + run: poetry run ./scripts/build_ui.sh + - name: Build Whl for release + run: poetry build -f=wheel -n + # Upload build artifacts for later use + - name: Upload yin-yang whl for flatpak build + uses: actions/upload-artifact@v4 + with: + name: yin-yang-{{GITHUB_REF}}-py3-none-any.whl + path: dist/$(ls dist) + + flatpak: + name: "Build flatpak file" + runs-on: ubuntu-22.04 + container: + image: bilelmoussaoui/flatpak-github-actions:kde-5.15-23.08 + options: --privileged + strategy: + matrix: + arch: [x86_64] + steps: + - uses: actions/checkout@v4 + - name: Download build from last step + uses: actions/download-artifact@v4 + with: + path: dist/ + name: yin-yang-{{GITHUB_REF}}-py3-none-any.whl + - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 + with: + bundle: yin-yang.flatpak + manifest-path: sh.oskar.yin-yang.json + cache-key: flatpak-builder-${{ github.sha }} + arch: ubuntu-22.04 \ No newline at end of file diff --git a/.github/workflows/flatpak-ci.yml b/.github/workflows/flatpak-ci.yml deleted file mode 100644 index 510b91f..0000000 --- a/.github/workflows/flatpak-ci.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Flatpak CI Tests - -on: - push: - branches: [main] - pull_request: - -jobs: - flatpak: - name: "Flatpak" - runs-on: ubuntu-latest - container: - image: bilelmoussaoui/flatpak-github-actions:kde-5.15-23.08 - options: --privileged - strategy: - matrix: - arch: [x86_64] - steps: - - uses: actions/checkout@v4 - - name: Install packaging deps - run: | - dnf -y install gcc systemd-devel python3-devel libnotify poetry - - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 - with: - bundle: yin-yang.flatpak - manifest-path: sh.oskar.yin-yang.json - cache-key: flatpak-builder-${{ github.sha }} - arch: ${{ matrix.arch }} \ No newline at end of file diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-ci.yml similarity index 100% rename from .github/workflows/python-app.yml rename to .github/workflows/python-ci.yml