Skip to content

Update GH Actions

Update GH Actions #44

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
pull_request:
branches:
- main
env:
NAME: cemu
REPO: hugsy/cemu
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
VERSION: 0.8
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12']
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
outputs:
windows-latest-3-10: ${{ join(steps.*.outputs.windows-latest-3-10,'') }}
windows-latest-3-11: ${{ join(steps.*.outputs.windows-latest-3-11,'') }}
windows-latest-3-12: ${{ join(steps.*.outputs.windows-latest-3-12,'') }}
ubuntu-latest-3-10: ${{ join(steps.*.outputs.ubuntu-latest-3-10,'') }}
ubuntu-latest-3-11: ${{ join(steps.*.outputs.ubuntu-latest-3-11,'') }}
ubuntu-latest-3-12: ${{ join(steps.*.outputs.ubuntu-latest-3-12,'') }}
macos-latest-3-10: ${{ join(steps.*.outputs.macos-latest-3-10,'') }}
macos-latest-3-11: ${{ join(steps.*.outputs.macos-latest-3-11,'') }}
macos-latest-3-12: ${{ join(steps.*.outputs.macos-latest-3-12,'') }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: "Install Pre-requisite (Linux)"
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt update
sudo apt upgrade -y
sudo apt install -y build-essential python3-dev python3-pip python3-wheel python3-setuptools
- name: "Install Pre-requisite (Windows)"
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
env
- name: Build artifact
shell: bash
run: |
mkdir build
mkdir build/bin
python --version
python -m pip --version
python -m pip install --upgrade pip setuptools wheel
python -m pip install --user --upgrade -r tests/requirements.txt
python -m pip install --user --upgrade .
- name: "Post build Cemu (Windows)"
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Copy-Item $env:APPDATA\Python\Python*\Scripts\cemu.exe build\bin\
- name: "Post build Cemu (Linux)"
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
cp -v ~/.local/bin/cemu build/bin/
- name: "Post build Cemu (macOS)"
if: matrix.os == 'macos-latest'
shell: bash
run: |
cp -v ~/.local/bin/cemu build/bin/ || cp -v /Users/runner/Library/Python/${{ matrix.python-version }}/bin/cemu build/bin/
- name: "Run tests"
run: |
python -m pytest tests/
- name: Publish artifact
id: publish_artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.NAME }}_${{ env.VERSION }}_${{ matrix.os }}_py${{ matrix.python-version }}_${{ github.ref }}_${{ github.sha }}
path: build/
- name: Populate the successful output (Windows)
id: output_success_windows
if: ${{ matrix.os == 'windows-latest' && success() }}
shell: pwsh
run: |
$pyVersion = "${{ matrix.python-version }}" -replace "\.", "-"
echo "${{ matrix.os }}-$pyVersion=✅ ${{ matrix.os }} ${{ matrix.python-version }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Populate the successful output (Other)
id: output_success_other
if: ${{matrix.os != 'windows-latest' && success() }}
shell: bash
run: |
pyVersion="$(echo -n ${{ matrix.python-version }} | tr . -)"
echo "${{ matrix.os }}-${pyVersion}=✅ ${{ matrix.os }} ${{ matrix.python-version }}" >> $GITHUB_OUTPUT
- name: Populate the failure output (Windows)
id: output_failure_windows
if: ${{matrix.os == 'windows-latest' && failure() }}
shell: pwsh
run: |
$pyVersion = "${{ matrix.python-version }}" -replace "\.", "-"
echo "${{ matrix.os }}-${pyVersion}=❌ ${{ matrix.os }} ${{ matrix.python-version }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Populate the failure output (Other)
id: output_failure_other
if: ${{matrix.os != 'windows-latest' && failure() }}
shell: bash
run: |
pyVersion="$(echo -n ${{ matrix.python-version }} | tr . -)"
echo "${{ matrix.os }}-$pyVersion=❌ ${{ matrix.os }} ${{ matrix.python-version }}" >> $GITHUB_OUTPUT
notify:
runs-on: 'ubuntu-latest'
needs: build
steps:
- name: Send Discord notification
env:
COMMIT_URL: "https://github.com/${{ env.REPO }}/commit/${{ env.GITHUB_SHA_SHORT }}"
RUN_URL: "https://github.com/${{ env.REPO }}/actions/runs/${{ github.run_id }}"
BRANCH_URL: "https://github.com/${{ env.REPO }}/tree/${{ env.GITHUB_REF_SLUG }}"
AUTHOR_URL: "https://github.com/${{ github.actor }}"
uses: sarisia/[email protected]
with:
nodetail: true
title: 🚧 🚧 Summary of Build `${{ github.sha }}` for `${{ env.REPO }}` 🚧 🚧
description: |
[Job #${{ github.run_number }}](${{ env.RUN_URL }}): CI build `${{ github.sha }}` initiated by [${{ github.actor }}](${{ env.AUTHOR_URL }}):
● Commit [${{ github.sha }}](${{ env.COMMIT_URL }})
● Branch [`${{ github.ref }}`](${{ env.BRANCH_URL }})
● [Detail Page](${{ env.RUN_URL }})
${{ needs.build.outputs.windows-latest-3-10 }}
${{ needs.build.outputs.windows-latest-3-11 }}
${{ needs.build.outputs.windows-latest-3-12 }}
${{ needs.build.outputs.ubuntu-latest-3-10 }}
${{ needs.build.outputs.ubuntu-latest-3-11 }}
${{ needs.build.outputs.ubuntu-latest-3-12 }}
${{ needs.build.outputs.macos-latest-3-10 }}
${{ needs.build.outputs.macos-latest-3-11 }}
${{ needs.build.outputs.macos-latest-3-12 }}
color: 0x0000ff
username: ${{ github.actor }} via GithubBot
avatar_url: "https://github.com/hugsy/cemu/blob/dev/cemu/img/new_logo.png?raw=true"