Skip to content

Commit b9e6d93

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 585027e commit b9e6d93

File tree

1 file changed

+142
-28
lines changed

1 file changed

+142
-28
lines changed

.github/workflows/compilation.yml

Lines changed: 142 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,106 @@ 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:
7-
types: [run_build]
13+
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.os[0] }}
1325
strategy:
1426
matrix:
15-
os: [
16-
[macos-latest, arm64, bash],
17-
[macos-13, x86_64, bash],
18-
[ubuntu-latest, x86_64, bash],
19-
[windows-latest, x86_64, msys2]
20-
]
27+
os:
28+
- runs-on: macos-latest
29+
architecture: arm64
30+
shell: bash
31+
container: null
32+
container-options: " "
33+
macos-package-manager: brew
34+
- runs-on: macos-13
35+
architecture: x86_64
36+
shell: bash
37+
container: null
38+
container-options: " "
39+
macos-package-manager: brew
40+
- runs-on: macos-latest
41+
architecture: arm64
42+
shell: bash
43+
container: null
44+
container-options: " "
45+
macos-package-manager: port
46+
- runs-on: ubuntu-latest
47+
architecture: x86_64
48+
shell: bash
49+
container: "ubuntu:20.04"
50+
container-options: "--user 0"
51+
macos-package-manager: null
52+
- runs-on: ubuntu-24.04-arm
53+
architecture: arm64
54+
shell: bash
55+
container: "ubuntu:20.04"
56+
container-options: "--user 0"
57+
macos-package-manager: null
58+
- runs-on: windows-latest
59+
architecture: x86_64
60+
shell: msys2
61+
container: null
62+
container-options: " "
63+
macos-package-manager: null
2164
fail-fast: false
65+
runs-on: ${{ matrix.os.runs-on }}
2266
defaults:
2367
run:
24-
shell: ${{ matrix.os[2] }} {0}
68+
shell: ${{ matrix.os.shell }} {0}
69+
container:
70+
image: ${{ matrix.os.container }}
71+
options: ${{ matrix.os.container-options }}
72+
timeout-minutes: 240
2573

2674
steps:
27-
- uses: actions/checkout@v4
75+
- name: Checkout repository
76+
uses: actions/checkout@v4
2877

2978
- name: Install Ubuntu packages
30-
if: matrix.os[0] == 'ubuntu-latest'
79+
if: startsWith(matrix.os.runs-on, 'ubuntu')
3180
run: |
32-
sudo apt-get update
33-
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
3483
35-
- name: Install macOS packages
36-
if: startsWith(matrix.os[0], 'macos')
84+
- name: Install macOS packages (brew)
85+
if: startsWith(matrix.os.runs-on, 'macos') && matrix.os.macos-package-manager == 'brew'
3786
run: |
3887
brew update
39-
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
89+
90+
- name: Install macOS packages (port)
91+
if: startsWith(matrix.os.runs-on, 'macos') && matrix.os.macos-package-manager == 'port'
92+
run: |
93+
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci
94+
source ./macports-ci install --remove-brew --version=2.11.5 --sync=rsync
95+
sudo port install gsl gmp mpfr libmpc libiconv bison flex gsed texinfo autoconf automake libtool md5sha1sum wget curl
4096
4197
- name: Install MSYS2 packages
42-
if: matrix.os[0] == 'windows-latest'
98+
if: startsWith(matrix.os.runs-on, 'windows')
4399
uses: msys2/setup-msys2@v2
44100
with:
45101
msystem: MINGW32
46102
install: |
47-
base-devel git make texinfo flex bison patch binutils mpc-devel tar
103+
base-devel git make texinfo flex bison patch binutils mpc-devel tar wget curl
104+
autotools gettext gettext-devel
48105
mingw-w64-i686-readline mingw-w64-i686-gcc mingw-w64-i686-cmake
49106
mingw-w64-i686-make mingw-w64-i686-libogg
50107
update: true
@@ -53,19 +110,76 @@ jobs:
53110
run: |
54111
export PS2DEV=$PWD/ps2dev
55112
export PS2SDK=$PS2DEV/ps2sdk
56-
export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH" # This is just needed for MacOS
57-
export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
58-
./toolchain.sh
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
116+
export PATH=$PATH:$PS2DEV/iop/bin
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
122+
123+
- name: Print version of executables (ps2toolchain-iop)
124+
if: github.event.repository.name == 'ps2toolchain-iop'
125+
run: |
126+
export PS2DEV=$PWD/ps2dev
127+
export PATH=$PATH:$PS2DEV/iop/bin
128+
mipsel-none-elf-as --version
129+
mipsel-none-elf-ld --version
130+
mipsel-none-elf-gcc --version
131+
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
59147
60148
- name: Get short SHA
61149
id: slug
62-
run: echo "sha8=${MSYSTEM}-sha[$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT
63-
64-
- name: Prepare ps2dev folder
150+
run: printf '%s\n' "sha8=$(printf '%s\n' ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT
151+
152+
- name: Compress ps2dev folder
65153
run: |
66-
tar -zcvf ps2dev-${{matrix.os[0]}}.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 }}
67177

68-
- 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
69181
with:
70-
name: ps2dev-${{matrix.os[0]}}-ps2dev-${{matrix.os[1]}}-${{ steps.slug.outputs.sha8 }}
71-
path: ps2dev-${{matrix.os[0]}}.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)