Skip to content

Commit 8aa9f60

Browse files
committed
CI: improve compilation CI
Merge changes from other repo Run in ubuntu 20.04 container for ubuntu runner Add 4 hour timeout use standardized printf instead of echo Only add gnu-sed to path if brew available Correct archive name Avoid Homebrew additional network stuff
1 parent 2bc93bb commit 8aa9f60

File tree

1 file changed

+119
-43
lines changed

1 file changed

+119
-43
lines changed

.github/workflows/compilation.yml

Lines changed: 119 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,108 +2,184 @@ name: CI
22

33
on:
44
push:
5+
paths-ignore:
6+
- '**.md'
7+
- '**.rst'
58
pull_request:
9+
paths-ignore:
10+
- '**.md'
11+
- '**.rst'
612
repository_dispatch:
713
types: [run_build, run_release]
814
workflow_dispatch: {}
15+
env:
16+
HOMEBREW_NO_ANALYTICS: 1
17+
HOMEBREW_NO_AUTO_UPDATE: 1
18+
HOMEBREW_NO_INSTALL_UPGRADE: 1
19+
HOMEBREW_NO_INSTALL_CLEANUP: 1
20+
DEBIAN_FRONTEND: noninteractive
21+
TZ: Japan
922

1023
jobs:
1124
build:
12-
runs-on: ${{ matrix.target.machine }}
1325
strategy:
1426
matrix:
15-
target:
16-
- machine: macos-latest
27+
os:
28+
- runs-on: macos-latest
1729
architecture: arm64
1830
shell: bash
19-
packageManager: brew
20-
- machine: macos-13
31+
container: null
32+
container-options: " "
33+
macos-package-manager: brew
34+
- runs-on: macos-13
2135
architecture: x86_64
2236
shell: bash
23-
packageManager: brew
24-
- machine: macos-latest
37+
container: null
38+
container-options: " "
39+
macos-package-manager: brew
40+
- runs-on: macos-latest
2541
architecture: arm64
2642
shell: bash
27-
packageManager: macport
28-
- machine: ubuntu-latest
43+
container: null
44+
container-options: " "
45+
macos-package-manager: port
46+
- runs-on: ubuntu-latest
2947
architecture: x86_64
3048
shell: bash
31-
packageManager: default
32-
- machine: ubuntu-22.04-arm
49+
container: "ubuntu:20.04"
50+
container-options: "--user 0"
51+
macos-package-manager: null
52+
- runs-on: ubuntu-24.04-arm
3353
architecture: arm64
3454
shell: bash
35-
packageManager: default
36-
- machine: ubuntu-24.04-arm
37-
architecture: arm64
38-
shell: bash
39-
packageManager: default
40-
- machine: windows-latest
55+
container: "ubuntu:20.04"
56+
container-options: "--user 0"
57+
macos-package-manager: null
58+
- runs-on: windows-latest
4159
architecture: x86_64
4260
shell: msys2
43-
packageManager: default
61+
container: null
62+
container-options: " "
63+
macos-package-manager: null
4464
fail-fast: false
65+
runs-on: ${{ matrix.os.runs-on }}
4566
defaults:
4667
run:
47-
shell: ${{ matrix.target.shell }} {0}
68+
shell: ${{ matrix.os.shell }} {0}
69+
container:
70+
image: ${{ matrix.os.container }}
71+
options: ${{ matrix.os.container-options }}
72+
timeout-minutes: 240
4873

4974
steps:
50-
- uses: actions/checkout@v4
75+
- name: Checkout repository
76+
uses: actions/checkout@v4
5177

5278
- name: Install Ubuntu packages
53-
if: startsWith(matrix.target.machine, 'ubuntu')
79+
if: startsWith(matrix.os.runs-on, 'ubuntu')
5480
run: |
55-
sudo apt-get update
56-
sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev
81+
apt-get -y update
82+
apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install texinfo bison flex gettext autopoint autoconf automake libgmp3-dev libmpfr-dev libmpc-dev cmake g++ gcc git libgsl-dev make patch zlib1g-dev wget curl
5783
58-
- name: Install macOS packages with brew
59-
if: startsWith(matrix.target.machine, 'macos') && matrix.target.packageManager == 'brew'
84+
- name: Install macOS packages (brew)
85+
if: startsWith(matrix.os.runs-on, 'macos') && matrix.os.macos-package-manager == 'brew'
6086
run: |
6187
brew update
62-
brew install texinfo bison flex gnu-sed gsl gmp mpfr libmpc
88+
brew install texinfo bison flex gnu-sed autoconf automake libtool gsl gmp mpfr libmpc md5sha1sum wget curl
6389
64-
- name: Install macOS packages with macport
65-
if: startsWith(matrix.target.machine, 'macos') && matrix.target.packageManager == 'macport'
90+
- name: Install macOS packages (port)
91+
if: startsWith(matrix.os.runs-on, 'macos') && matrix.os.macos-package-manager == 'port'
6692
run: |
6793
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci
6894
source ./macports-ci install --remove-brew --version=2.11.5 --sync=rsync
69-
sudo port install gmp mpfr libmpc libiconv bison flex texinfo
95+
sudo port install gsl gmp mpfr libmpc libiconv bison flex gsed texinfo autoconf automake libtool md5sha1sum wget curl
7096
7197
- name: Install MSYS2 packages
72-
if: startsWith(matrix.target.machine, 'windows')
98+
if: startsWith(matrix.os.runs-on, 'windows')
7399
uses: msys2/setup-msys2@v2
74100
with:
75101
msystem: MINGW32
76102
install: |
77-
base-devel git make texinfo flex bison patch binutils mpc-devel tar
78-
mingw-w64-i686-readline mingw-w64-i686-gcc
79-
mingw-w64-i686-cmake mingw-w64-i686-make mingw-w64-i686-libogg
103+
base-devel git make texinfo flex bison patch binutils mpc-devel tar wget curl
104+
autotools gettext gettext-devel
105+
mingw-w64-i686-readline mingw-w64-i686-gcc mingw-w64-i686-cmake
106+
mingw-w64-i686-make mingw-w64-i686-libogg
80107
update: true
81108

82109
- name: Runs all the stages in the shell
83110
run: |
84111
export PS2DEV=$PWD/ps2dev
85-
export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH" # This is just needed for MacOS
112+
export PS2SDK=$PS2DEV/ps2sdk
113+
export GSKIT=$PS2DEV/gsKit
114+
if command -v brew &> /dev/null; then export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH"; fi # This is just needed for MacOS
115+
export PATH=$PATH:$PS2DEV/bin
86116
export PATH=$PATH:$PS2DEV/iop/bin
87-
./toolchain.sh
117+
export PATH=$PATH:$PS2DEV/ee/bin
118+
export PATH=$PATH:$PS2DEV/dvp/bin
119+
export PATH=$PATH:$PS2SDK/bin
120+
if test -f ./build-all.sh; then ./build-all.sh; fi
121+
if test -f ./toolchain.sh; then ./toolchain.sh; fi
88122
89-
- name: Print version of executables
123+
- name: Print version of executables (ps2toolchain-iop)
124+
if: github.event.repository.name == 'ps2toolchain-iop'
90125
run: |
91126
export PS2DEV=$PWD/ps2dev
92127
export PATH=$PATH:$PS2DEV/iop/bin
93128
mipsel-none-elf-as --version
94129
mipsel-none-elf-ld --version
95130
mipsel-none-elf-gcc --version
96131
132+
- name: Print version of executables (ps2toolchain-ee)
133+
if: github.event.repository.name == 'ps2toolchain-ee'
134+
run: |
135+
export PS2DEV=$PWD/ps2dev
136+
export PATH=$PATH:$PS2DEV/ee/bin
137+
mips64r5900el-ps2-elf-as --version
138+
mips64r5900el-ps2-elf-ld --version
139+
mips64r5900el-ps2-elf-gcc --version
140+
141+
- name: Print version of executables (ps2toolchain-dvp)
142+
if: github.event.repository.name == 'ps2toolchain-dvp'
143+
run: |
144+
export PS2DEV=$PWD/ps2dev
145+
export PATH=$PATH:$PS2DEV/dvp/bin
146+
dvp-as --version
147+
97148
- name: Get short SHA
98149
id: slug
99-
run: |
100-
echo "sha8=${MSYSTEM}-sha[$(echo ${GITHUB_SHA} | cut -c1-8)]" >> $GITHUB_OUTPUT
150+
run: printf '%s\n' "sha8=$(printf '%s\n' ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT
101151

102-
- name: Prepare ps2dev folder
152+
- name: Compress ps2dev folder
103153
run: |
104-
tar -zcvf ps2dev-${{matrix.target.machine}}.tar.gz ps2dev
154+
tar -zcvf ps2dev-${{ matrix.os.runs-on }}.tar.gz ps2dev
155+
156+
- name: Upload artifact
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: ${{ github.event.repository.name }}-${{ matrix.os.runs-on }}-ps2dev-${{ matrix.os.architecture }}-${{ matrix.os.macos-package-manager }}-${{ steps.slug.outputs.sha8 }}
160+
path: ps2dev-${{ matrix.os.runs-on }}.tar.gz
161+
162+
- name: Extract tag name
163+
if: startsWith(github.ref, 'refs/tags/')
164+
id: tag
165+
run: printf 'VERSION=%s\n' "${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
166+
167+
- name: Create pre-release
168+
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && github.event.repository.name == 'ps2dev' && matrix.os.macos-package-manager != 'port'
169+
uses: softprops/action-gh-release@v2
170+
with:
171+
files: ps2dev-${{ matrix.os.runs-on }}.tar.gz
172+
prerelease: true
173+
name: "Development build"
174+
tag_name: "latest"
175+
env:
176+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105177

106-
- uses: actions/upload-artifact@v4
178+
- name: Release
179+
if: startsWith(github.ref, 'refs/tags/') && github.event.repository.name == 'ps2dev' && matrix.os.macos-package-manager != 'port'
180+
uses: softprops/action-gh-release@v2
107181
with:
108-
name: ps2dev-${{matrix.target.machine}}-ps2dev-${{matrix.target.architecture}}-${{matrix.target.packageManager}}-${{ steps.slug.outputs.sha8 }}
109-
path: ps2dev-${{matrix.target.machine}}.tar.gz
182+
files: ps2dev-${{ matrix.os.runs-on }}.tar.gz
183+
tag_name: ${{ steps.tag.outputs.VERSION }}
184+
env:
185+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)