Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 117 additions & 30 deletions .github/workflows/compilation.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,157 @@ name: CI

on:
push:
paths-ignore:
- '**.md'
- '**.rst'
pull_request:
paths-ignore:
- '**.md'
- '**.rst'
repository_dispatch:
types: [run_build]
types:
- run_build
- run_release
workflow_dispatch: {}
env:
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_UPGRADE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
DEBIAN_FRONTEND: noninteractive
TZ: Japan

jobs:
build:
runs-on: ${{ matrix.os[0] }}
strategy:
matrix:
os: [
[macos-latest, arm64, bash],
[macos-13, x86_64, bash],
[ubuntu-latest, x86_64, bash],
[windows-latest, x86_64, msys2]
]
os:
- runs-on: macos-latest
architecture: arm64
shell: bash
container: null
container-options: " "
macos-package-manager: brew
- runs-on: macos-15-intel
architecture: x86_64
shell: bash
container: null
container-options: " "
macos-package-manager: brew
- runs-on: macos-latest
architecture: arm64
shell: bash
container: null
container-options: " "
macos-package-manager: port
- runs-on: ubuntu-latest
architecture: x86_64
shell: bash
container: "ubuntu:20.04"
container-options: "--user 0"
macos-package-manager: null
- runs-on: ubuntu-24.04-arm
architecture: arm64
shell: bash
container: "ubuntu:20.04"
container-options: "--user 0"
macos-package-manager: null
- runs-on: windows-latest
architecture: x86_64
shell: msys2
container: null
container-options: " "
macos-package-manager: null
fail-fast: false
runs-on: ${{ matrix.os.runs-on }}
defaults:
run:
shell: ${{ matrix.os[2] }} {0}
shell: ${{ matrix.os.shell }} {0}
container:
image: ${{ matrix.os.container }}
options: ${{ matrix.os.container-options }}
timeout-minutes: 240

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Ubuntu packages
if: matrix.os[0] == 'ubuntu-latest'
if: startsWith(matrix.os.runs-on, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get -y install texinfo bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev
apt-get -y update
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

- name: Install macOS packages
if: startsWith(matrix.os[0], 'macos')
- name: Install macOS packages (brew)
if: startsWith(matrix.os.runs-on, 'macos') && matrix.os.macos-package-manager == 'brew'
run: |
brew update
brew install texinfo bison flex gnu-sed gsl gmp mpfr libmpc
brew install texinfo bison flex gnu-sed autoconf automake libtool gsl gmp mpfr libmpc md5sha1sum wget curl

- name: Install macOS packages (port)
if: startsWith(matrix.os.runs-on, 'macos') && matrix.os.macos-package-manager == 'port'
run: |
curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci
. ./macports-ci install --remove-brew --version=2.11.5 --sync=rsync
sudo port install gsl gmp mpfr libmpc libiconv bison flex gsed texinfo autoconf automake libtool md5sha1sum wget curl

- name: Install MSYS2 packages
if: matrix.os[0] == 'windows-latest'
if: startsWith(matrix.os.runs-on, 'windows')
uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
install: |
base-devel git make texinfo flex bison patch binutils mpc-devel tar
base-devel git make texinfo flex bison patch binutils mpc-devel tar wget curl
autotools gettext gettext-devel
mingw-w64-i686-readline mingw-w64-i686-gcc mingw-w64-i686-cmake
mingw-w64-i686-make mingw-w64-i686-libogg
update: true

- name: Runs all the stages in the shell
run: |
export PS2DEV=$PWD/ps2dev
export PS2SDK=$PS2DEV/ps2sdk
export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH" # This is just needed for MacOS
export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
./toolchain.sh
. ./config/ci-env.sh
if test -f ./build-all.sh; then ./build-all.sh; fi
if test -f ./toolchain.sh; then ./toolchain.sh; fi

- name: Print version of executables
run: |
if test -f ./config/ci-print-version.sh; then ./config/ci-print-version.sh; fi

- name: Get short SHA
id: slug
run: echo "sha8=${MSYSTEM}-sha[$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT
- name: Prepare ps2dev folder
run: printf '%s\n' "sha8=$(printf '%s\n' ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT

- name: Compress ps2dev folder
run: |
tar -zcvf ps2dev-${{matrix.os[0]}}.tar.gz ps2dev
tar -zcvf ps2dev-${{ matrix.os.runs-on }}.tar.gz ps2dev

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ matrix.os.runs-on }}-ps2dev-${{ matrix.os.architecture }}-${{ matrix.os.macos-package-manager }}-${{ steps.slug.outputs.sha8 }}
path: ps2dev-${{ matrix.os.runs-on }}.tar.gz

- name: Extract tag name
if: startsWith(github.ref, 'refs/tags/')
id: tag
run: printf 'VERSION=%s\n' "${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT

- name: Create pre-release
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && github.event.repository.name == 'ps2dev' && matrix.os.macos-package-manager != 'port'
uses: softprops/action-gh-release@v2
with:
files: ps2dev-${{ matrix.os.runs-on }}.tar.gz
prerelease: true
name: "Development build"
tag_name: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/upload-artifact@v4
- name: Release
if: startsWith(github.ref, 'refs/tags/') && github.event.repository.name == 'ps2dev' && matrix.os.macos-package-manager != 'port'
uses: softprops/action-gh-release@v2
with:
name: ps2dev-${{matrix.os[0]}}-ps2dev-${{matrix.os[1]}}-${{ steps.slug.outputs.sha8 }}
path: ps2dev-${{matrix.os[0]}}.tar.gz
files: ps2dev-${{ matrix.os.runs-on }}.tar.gz
tag_name: ${{ steps.tag.outputs.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading