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
31 changes: 6 additions & 25 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ on:
- '**.md'
- '**.rst'
repository_dispatch:
types: [run_build, run_release]
types:
- run_build
- run_release
workflow_dispatch: {}
env:
HOMEBREW_NO_ANALYTICS: 1
Expand All @@ -31,7 +33,7 @@ jobs:
container: null
container-options: " "
macos-package-manager: brew
- runs-on: macos-13
- runs-on: macos-15-intel
architecture: x86_64
shell: bash
container: null
Expand Down Expand Up @@ -112,30 +114,9 @@ jobs:
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 (ps2toolchain-iop)
if: github.event.repository.name == 'ps2toolchain-iop'
- name: Print version of executables
run: |
export PS2DEV=$PWD/ps2dev
export PATH=$PATH:$PS2DEV/iop/bin
mipsel-none-elf-as --version
mipsel-none-elf-ld --version
mipsel-none-elf-gcc --version

- name: Print version of executables (ps2toolchain-ee)
if: github.event.repository.name == 'ps2toolchain-ee'
run: |
export PS2DEV=$PWD/ps2dev
export PATH=$PATH:$PS2DEV/ee/bin
mips64r5900el-ps2-elf-as --version
mips64r5900el-ps2-elf-ld --version
mips64r5900el-ps2-elf-gcc --version

- name: Print version of executables (ps2toolchain-dvp)
if: github.event.repository.name == 'ps2toolchain-dvp'
run: |
export PS2DEV=$PWD/ps2dev
export PATH=$PATH:$PS2DEV/dvp/bin
dvp-as --version
if test -f ./config/ci-print-version.sh; then ./config/ci-print-version.sh; fi

- name: Get short SHA
id: slug
Expand Down
161 changes: 132 additions & 29 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,111 @@ on:
- '**.rst'
workflow_dispatch: {}
repository_dispatch:
types: [run_build]
types:
- run_build

jobs:
build:
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BASE_DOCKER_IMAGE_NAME: ${{ (github.event.repository.name == 'ps2sdk' && 'ps2toolchain') || (github.event.repository.name == 'ps2sdk-ports' && 'ps2sdk') || (github.event.repository.name == 'ps2-packer' && 'ps2sdk') || (github.event.repository.name == 'ps2dev' && 'ps2sdk-ports') || 'none' }}
strategy:
matrix:
runs-on: [ubuntu-latest, ubuntu-24.04-arm]
runs-on: ${{ matrix.runs-on }}
platform:
- runs-on: ubuntu-latest
container-platform: linux/amd64
- runs-on: ubuntu-24.04-arm
container-platform: linux/arm64
runs-on: ${{ matrix.platform.runs-on }}
timeout-minutes: 180

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

- name: Prepare
run: |
platform=${{ matrix.platform.container-platform }}
printf 'PLATFORM_PAIR=%s\n' "${platform//\//-}" >> $GITHUB_ENV

- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare additional environment variables from repo
run: if test -f ./config/ci-docker-env.ini; then cat ./config/ci-docker-env.ini | sed -e 's/$REPOSITORY_OWNER/'"${{ github.repository_owner }}"'/g;s/$DOCKER_TAG/'"${{ env.DOCKER_TAG }}"'/g' >> $GITHUB_ENV; fi

- name: Extract DOCKER_TAG using tag name
if: startsWith(github.ref, 'refs/tags/')
if: env.BUILD_ARGS_LIST != null
run: |
printf 'DOCKER_TAG=%s\n' "${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
printf 'BUILD_ARGS_LIST_NEWLINES<<EOF\n%s\nEOF\n' "${{ env.BUILD_ARGS_LIST }}" | tr ' ' $'\n' >> $GITHUB_ENV

- name: Use default DOCKER_TAG
if: startsWith(github.ref, 'refs/tags/') != true
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and Push to container registry
id: build
uses: docker/build-push-action@v6
with:
platforms: ${{ matrix.platform.container-platform }}
labels: ${{ steps.meta.outputs.labels }}
tags: ghcr.io/${{ github.repository }}
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
build-args: ${{ env.BUILD_ARGS_LIST_NEWLINES }}

- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ steps.build.outputs.digest }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"

- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1

merge:
needs:
- build
runs-on: ubuntu-latest
timeout-minutes: 20
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
outputs:
dest-repo: ${{ steps.dest-repo.outputs.DEST_REPO }}

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

- name: Install Ubuntu packages
run: |
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
sudo apt-get -y update
sudo apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install jq

- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true

- name: Login to DockerHub
uses: docker/login-action@v3
if: env.DOCKER_USERNAME != null
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

- name: Login to Github Container Registry
uses: docker/login-action@v3
Expand All @@ -54,33 +125,53 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

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

- name: Use default DOCKER_TAG
if: startsWith(github.ref, 'refs/tags/') != true
run: |
printf 'DOCKER_TAG=%s\n' "latest" >> $GITHUB_ENV

- name: Set docker tag list to include DockerHub if credentials available
if: env.DOCKER_USERNAME != null
run: |
printf 'DOCKER_TAG_LIST=%s\n' "ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }},${{ github.repository }}:${{ env.DOCKER_TAG }}" >> $GITHUB_ENV
printf 'DOCKER_CONTAINER_LIST<<EOF\n%s\nEOF\n' "ghcr.io/${{ github.repository }}"$'\n'"${{ github.repository }}" >> $GITHUB_ENV

- name: Set docker tag list to not include DockerHub if credentials not available
if: env.DOCKER_USERNAME == null
run: |
printf 'DOCKER_TAG_LIST=%s\n' "ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }}" >> $GITHUB_ENV
printf 'DOCKER_CONTAINER_LIST<<EOF\n%s\nEOF\n' "ghcr.io/${{ github.repository }}" >> $GITHUB_ENV

- name: Build and Push to container registry
uses: docker/build-push-action@v5
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
push: true
tags: ${{ env.DOCKER_TAG_LIST }}
build-args: |
BASE_DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ env.BASE_DOCKER_IMAGE_NAME }}:${{ env.DOCKER_TAG }}
BASE_DOCKER_DVP_IMAGE=ghcr.io/${{ github.repository_owner }}/ps2toolchain-dvp:${{ env.DOCKER_TAG }}
BASE_DOCKER_IOP_IMAGE=ghcr.io/${{ github.repository_owner }}/ps2toolchain-iop:${{ env.DOCKER_TAG }}
BASE_DOCKER_EE_IMAGE=ghcr.io/${{ github.repository_owner }}/ps2toolchain-ee:${{ env.DOCKER_TAG }}
images: ${{ env.DOCKER_CONTAINER_LIST }}
tags: |
type=raw,value=${{ env.DOCKER_TAG }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") $(printf 'ghcr.io/${{ github.repository }}@sha256:%s ' *)

- name: Inspect image
run: |
docker buildx imagetools inspect ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.version }}

- name: Gather information for repository dispatch
id: dest-repo
run: if test -f ./config/repository-dispatch.ini; then cat ./config/repository-dispatch.ini >> $GITHUB_OUTPUT; fi

perform-repository-dispatch:
needs: [build]
needs:
- merge
runs-on: ubuntu-latest
container:
image: ubuntu:20.04
Expand All @@ -90,9 +181,21 @@ jobs:
DISPATCH_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
strategy:
matrix:
dest-repo: ${{ fromJson(needs.build.outputs.DEST_REPO) }}
dest-repo: ${{ fromJson(needs.merge.outputs.dest-repo) }}

steps:
- name: Gather environment variables (normal)
if: github.event_name != 'repository_dispatch'
run: |
printf 'PAYLOAD_REPO_PARENT_NAME=%s\n' "${{ github.repository }}" >> $GITHUB_ENV
printf 'PAYLOAD_REPO_PARENT_SHA=%s\n' "${{ github.sha }}" >> $GITHUB_ENV

- name: Gather environment variables (dispatch)
if: github.event_name == 'repository_dispatch'
run: |
printf 'PAYLOAD_REPO_PARENT_NAME=%s\n' "${{ github.event.client_payload.parent_name }}" >> $GITHUB_ENV
printf 'PAYLOAD_REPO_PARENT_SHA=%s\n' "${{ github.event.client_payload.parent_sha }}" >> $GITHUB_ENV

- name: Send Compile action
run: |
export DISPATCH_ACTION="$(printf 'run_build\n')"
Expand All @@ -105,7 +208,7 @@ jobs:
repository: ${{ github.repository_owner }}/${{ matrix.dest-repo }}
token: ${{ secrets.DISPATCH_TOKEN }}
event-type: ${{ env.NEW_DISPATCH_ACTION }}
client-payload: '{"ref": "${{ github.ref }}"}'
client-payload: '{"ref": "${{ github.ref }}", "parent_name": "${{ env.PAYLOAD_REPO_PARENT_NAME }}", "parent_sha": "${{ env.PAYLOAD_REPO_PARENT_SHA }}"}'

- name: Repository Dispatch to specific ${{ matrix.dest-repo }}
uses: peter-evans/repository-dispatch@v3
Expand All @@ -114,4 +217,4 @@ jobs:
repository: ${{ matrix.dest-repo }}
token: ${{ secrets.DISPATCH_TOKEN }}
event-type: ${{ env.NEW_DISPATCH_ACTION }}
client-payload: '{"ref": "${{ github.ref }}"}'
client-payload: '{"ref": "${{ github.ref }}", "parent_name": "${{ env.PAYLOAD_REPO_PARENT_NAME }}", "parent_sha": "${{ env.PAYLOAD_REPO_PARENT_SHA }}"}'
7 changes: 7 additions & 0 deletions config/ci-print-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

export PS2DEV=$PWD/ps2dev
export PATH=$PATH:$PS2DEV/ee/bin
mips64r5900el-ps2-elf-as --version
mips64r5900el-ps2-elf-ld --version
mips64r5900el-ps2-elf-gcc --version
Loading