Skip to content

Commit 1cea0ff

Browse files
authored
Merge pull request #26 from uyjulian/ci_improvements_20251010
CI improvements 20251010
2 parents 43c3224 + ec4e9c2 commit 1cea0ff

File tree

4 files changed

+48
-37
lines changed

4 files changed

+48
-37
lines changed

.github/workflows/compilation.yml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ on:
1010
- '**.md'
1111
- '**.rst'
1212
repository_dispatch:
13-
types: [run_build, run_release]
13+
types:
14+
- run_build
15+
- run_release
1416
workflow_dispatch: {}
1517
env:
1618
HOMEBREW_NO_ANALYTICS: 1
@@ -31,7 +33,7 @@ jobs:
3133
container: null
3234
container-options: " "
3335
macos-package-manager: brew
34-
- runs-on: macos-13
36+
- runs-on: macos-15-intel
3537
architecture: x86_64
3638
shell: bash
3739
container: null
@@ -112,30 +114,9 @@ jobs:
112114
if test -f ./build-all.sh; then ./build-all.sh; fi
113115
if test -f ./toolchain.sh; then ./toolchain.sh; fi
114116
115-
- name: Print version of executables (ps2toolchain-iop)
116-
if: github.event.repository.name == 'ps2toolchain-iop'
117+
- name: Print version of executables
117118
run: |
118-
export PS2DEV=$PWD/ps2dev
119-
export PATH=$PATH:$PS2DEV/iop/bin
120-
mipsel-none-elf-as --version
121-
mipsel-none-elf-ld --version
122-
mipsel-none-elf-gcc --version
123-
124-
- name: Print version of executables (ps2toolchain-ee)
125-
if: github.event.repository.name == 'ps2toolchain-ee'
126-
run: |
127-
export PS2DEV=$PWD/ps2dev
128-
export PATH=$PATH:$PS2DEV/ee/bin
129-
mips64r5900el-ps2-elf-as --version
130-
mips64r5900el-ps2-elf-ld --version
131-
mips64r5900el-ps2-elf-gcc --version
132-
133-
- name: Print version of executables (ps2toolchain-dvp)
134-
if: github.event.repository.name == 'ps2toolchain-dvp'
135-
run: |
136-
export PS2DEV=$PWD/ps2dev
137-
export PATH=$PATH:$PS2DEV/dvp/bin
138-
dvp-as --version
119+
if test -f ./config/ci-print-version.sh; then ./config/ci-print-version.sh; fi
139120
140121
- name: Get short SHA
141122
id: slug

.github/workflows/docker.yml

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,21 @@ on:
1212
- '**.rst'
1313
workflow_dispatch: {}
1414
repository_dispatch:
15-
types: [run_build]
15+
types:
16+
- run_build
1617

1718
jobs:
1819
build:
1920
env:
2021
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
2122
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
22-
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' }}
23+
outputs:
24+
dest-repo: ${{ steps.dest-repo.outputs.DEST_REPO }}
2325
strategy:
2426
matrix:
25-
runs-on: [ubuntu-latest, ubuntu-24.04-arm]
27+
runs-on:
28+
- ubuntu-latest
29+
- ubuntu-24.04-arm
2630
runs-on: ${{ matrix.runs-on }}
2731
timeout-minutes: 180
2832

@@ -38,7 +42,7 @@ jobs:
3842
- name: Use default DOCKER_TAG
3943
if: startsWith(github.ref, 'refs/tags/') != true
4044
run: |
41-
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
45+
printf 'DOCKER_TAG=%s\n' "latest" >> $GITHUB_ENV
4246
4347
- name: Login to DockerHub
4448
uses: docker/login-action@v3
@@ -64,23 +68,27 @@ jobs:
6468
run: |
6569
printf 'DOCKER_TAG_LIST=%s\n' "ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }}" >> $GITHUB_ENV
6670
71+
- name: Prepare additional environment variables from repo
72+
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
73+
6774
- name: Build and Push to container registry
6875
uses: docker/build-push-action@v5
6976
with:
7077
push: true
7178
tags: ${{ env.DOCKER_TAG_LIST }}
7279
build-args: |
73-
BASE_DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ env.BASE_DOCKER_IMAGE_NAME }}:${{ env.DOCKER_TAG }}
74-
BASE_DOCKER_DVP_IMAGE=ghcr.io/${{ github.repository_owner }}/ps2toolchain-dvp:${{ env.DOCKER_TAG }}
75-
BASE_DOCKER_IOP_IMAGE=ghcr.io/${{ github.repository_owner }}/ps2toolchain-iop:${{ env.DOCKER_TAG }}
76-
BASE_DOCKER_EE_IMAGE=ghcr.io/${{ github.repository_owner }}/ps2toolchain-ee:${{ env.DOCKER_TAG }}
80+
BASE_DOCKER_IMAGE
81+
BASE_DOCKER_DVP_IMAGE
82+
BASE_DOCKER_IOP_IMAGE
83+
BASE_DOCKER_EE_IMAGE
7784
7885
- name: Gather information for repository dispatch
7986
id: dest-repo
8087
run: if test -f ./config/repository-dispatch.ini; then cat ./config/repository-dispatch.ini >> $GITHUB_OUTPUT; fi
8188

8289
perform-repository-dispatch:
83-
needs: [build]
90+
needs:
91+
- build
8492
runs-on: ubuntu-latest
8593
container:
8694
image: ubuntu:20.04
@@ -90,9 +98,21 @@ jobs:
9098
DISPATCH_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
9199
strategy:
92100
matrix:
93-
dest-repo: ${{ fromJson(needs.build.outputs.DEST_REPO) }}
101+
dest-repo: ${{ fromJson(needs.build.outputs.dest-repo) }}
94102

95103
steps:
104+
- name: Gather environment variables (normal)
105+
if: github.event_name != 'repository_dispatch'
106+
run: |
107+
printf 'PAYLOAD_REPO_PARENT_NAME=%s\n' "${{ github.repository }}" >> $GITHUB_ENV
108+
printf 'PAYLOAD_REPO_PARENT_SHA=%s\n' "${{ github.sha }}" >> $GITHUB_ENV
109+
110+
- name: Gather environment variables (dispatch)
111+
if: github.event_name == 'repository_dispatch'
112+
run: |
113+
printf 'PAYLOAD_REPO_PARENT_NAME=%s\n' "${{ github.event.client_payload.parent_name }}" >> $GITHUB_ENV
114+
printf 'PAYLOAD_REPO_PARENT_SHA=%s\n' "${{ github.event.client_payload.parent_sha }}" >> $GITHUB_ENV
115+
96116
- name: Send Compile action
97117
run: |
98118
export DISPATCH_ACTION="$(printf 'run_build\n')"
@@ -105,7 +125,7 @@ jobs:
105125
repository: ${{ github.repository_owner }}/${{ matrix.dest-repo }}
106126
token: ${{ secrets.DISPATCH_TOKEN }}
107127
event-type: ${{ env.NEW_DISPATCH_ACTION }}
108-
client-payload: '{"ref": "${{ github.ref }}"}'
128+
client-payload: '{"ref": "${{ github.ref }}", "parent_name": "${{ env.PAYLOAD_REPO_PARENT_NAME }}", "parent_sha": "${{ env.PAYLOAD_REPO_PARENT_SHA }}"}'
109129

110130
- name: Repository Dispatch to specific ${{ matrix.dest-repo }}
111131
uses: peter-evans/repository-dispatch@v3
@@ -114,4 +134,4 @@ jobs:
114134
repository: ${{ matrix.dest-repo }}
115135
token: ${{ secrets.DISPATCH_TOKEN }}
116136
event-type: ${{ env.NEW_DISPATCH_ACTION }}
117-
client-payload: '{"ref": "${{ github.ref }}"}'
137+
client-payload: '{"ref": "${{ github.ref }}", "parent_name": "${{ env.PAYLOAD_REPO_PARENT_NAME }}", "parent_sha": "${{ env.PAYLOAD_REPO_PARENT_SHA }}"}'

config/ci-docker-env.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
BASE_DOCKER_IMAGE=alpine:latest
3+
BASE_DOCKER_DVP_IMAGE=alpine:latest
4+
BASE_DOCKER_IOP_IMAGE=alpine:latest
5+
BASE_DOCKER_EE_IMAGE=alpine:latest

config/ci-print-version.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
export PS2DEV=$PWD/ps2dev
4+
export PATH=$PATH:$PS2DEV/dvp/bin
5+
dvp-as --version

0 commit comments

Comments
 (0)