-
-
Notifications
You must be signed in to change notification settings - Fork 100
168 lines (146 loc) · 6.04 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Build
on:
workflow_dispatch:
push:
branches:
- main
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 libegl1 libgl1-mesa-glx python3-dev python3-pip python3-wheel python3-setuptools
- name: "Install Pre-requisite (macOS)"
if: matrix.os == 'macos-latest'
run: |
env
- 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 .[all]
- 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.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/${{ github.sha }}"
RUN_URL: "https://github.com/${{ env.REPO }}/actions/runs/${{ github.run_id }}"
BRANCH_URL: "https://github.com/${{ env.REPO }}/tree/${{ github.ref_name }}"
AUTHOR_URL: "https://github.com/${{ github.actor }}"
uses: sarisia/actions-status-discord@v1.14.0
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_name }}`](${{ 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"