From 2aa9e652629e6fe121b713383f07bca76b6c8743 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 26 Jul 2023 21:42:03 +1000 Subject: [PATCH] Let's give Github Actions a go --- .github/actions/notify_failure/action.yml | 29 ++++++++++++++++++++++ .github/actions/upload_build/action.yml | 19 ++++++++++++++ .github/workflows/build_3ds.yml | 30 +++++++++++++++-------- .github/workflows/build_haiku.yml | 24 ++++++++++-------- .github/workflows/build_psp.yml | 24 ++++++++++-------- .github/workflows/build_wiigc.yml | 30 ++++++++++++++--------- Makefile | 2 +- 7 files changed, 116 insertions(+), 42 deletions(-) create mode 100644 .github/actions/notify_failure/action.yml create mode 100644 .github/actions/upload_build/action.yml diff --git a/.github/actions/notify_failure/action.yml b/.github/actions/notify_failure/action.yml new file mode 100644 index 000000000..d67d0ec28 --- /dev/null +++ b/.github/actions/notify_failure/action.yml @@ -0,0 +1,29 @@ +name: Notify failure +description: Sends a notification that compiling a build has failed +inputs: + BOT_USERNAME: + description: 'Username to use for the discord bot message' + default: 'CC BuildBot' + required: false + type: string + BOT_AVATAR: + description: 'URL to use for the avatar of the discord bot message' + default: 'https://static.classicube.net/img/cc-cube-small.png' + required: false + type: string + NOTIFY_MESSAGE: + description: 'Notification message to send' + required: true + type: string + WEBHOOK_URL: + description: 'Discord webhook URL' + required: true + type: string + +runs: + using: "composite" + steps: + - name: Notify failure + shell: sh + run: | + curl ${{ inputs.WEBHOOK_URL }} -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"username\": \"${{ inputs.BOT_USERNAME }}\", \"avatar_url\": \"${{ inputs.BOT_AVATAR }}\", \"content\": \"${{ inputs.NOTIFY_MESSAGE }}\" }" \ No newline at end of file diff --git a/.github/actions/upload_build/action.yml b/.github/actions/upload_build/action.yml new file mode 100644 index 000000000..36fc2fcbe --- /dev/null +++ b/.github/actions/upload_build/action.yml @@ -0,0 +1,19 @@ +name: Upload binary +description: Uploads a compiled binary +inputs: + SOURCE_FILE: + description: 'Path to file to upload' + required: true + type: string + DEST_NAME: + description: 'Name to use for the uploaded artifact' + required: true + type: string + +runs: + using: "composite" + steps: + - uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.DEST_NAME }} + path: ${{ inputs.SOURCE_FILE }} \ No newline at end of file diff --git a/.github/workflows/build_3ds.yml b/.github/workflows/build_3ds.yml index cd56af832..f050130f0 100644 --- a/.github/workflows/build_3ds.yml +++ b/.github/workflows/build_3ds.yml @@ -6,21 +6,31 @@ concurrency: cancel-in-progress: true jobs: - build: + build-3DS: runs-on: ubuntu-latest container: image: devkitpro/devkitarm:latest steps: - uses: actions/checkout@v3 - - name: Compile + - name: Compile 3DS build + id: compile run: | make 3ds - notify-failure: - runs-on: ubuntu-latest - needs: [build] - if: ${{ always() && (needs.build.result == 'failure') }} - steps: - - name: Notify failure - run: | - curl ${{ secrets.WEBHOOK_URL }} -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"username\": \"CC BuildBot\", \"avatar_url\": \"https://static.classicube.net/img/cc-cube-small.png\", \"content\": \"Failed to compile 3DS build\" }" \ No newline at end of file + - uses: ./.github/actions/notify_failure + if: ${{ always() && steps.compile.outcome == 'failure' }} + with: + NOTIFY_MESSAGE: 'Failed to compile 3DS build' + WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}' + + - uses: ./.github/actions/upload_build + if: ${{ always() && steps.compile.outcome == 'success' }} + with: + SOURCE_FILE: 'ClassiCube-3ds.elf' + DEST_NAME: 'ClassiCube-3ds.elf' + + - uses: ./.github/actions/upload_build + if: ${{ always() && steps.compile.outcome == 'success' }} + with: + SOURCE_FILE: 'ClassiCube-3ds.3dsx' + DEST_NAME: 'ClassiCube-3ds.3dsx' \ No newline at end of file diff --git a/.github/workflows/build_haiku.yml b/.github/workflows/build_haiku.yml index 3dd9b5d08..336f2040e 100644 --- a/.github/workflows/build_haiku.yml +++ b/.github/workflows/build_haiku.yml @@ -6,22 +6,26 @@ concurrency: cancel-in-progress: true jobs: - build: + build-haiku: runs-on: ubuntu-latest container: image: haiku/cross-compiler:x86_64-r1beta4 steps: - uses: actions/checkout@v3 - - name: Compile + - name: Compile haiku build + id: compile run: | cd src x86_64-unknown-haiku-gcc *.c interop_BeOS.cpp -o ClassiCube-haiku -O1 -s -fno-stack-protector -fno-math-errno -Qn -lm -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker - notify-failure: - runs-on: ubuntu-latest - needs: [build] - if: ${{ always() && (needs.build.result == 'failure') }} - steps: - - name: Notify failure - run: | - curl ${{ secrets.WEBHOOK_URL }} -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"username\": \"CC BuildBot\", \"avatar_url\": \"https://static.classicube.net/img/cc-cube-small.png\", \"content\": \"Failed to compile Haiku build\" }" \ No newline at end of file + - uses: ./.github/actions/notify_failure + if: ${{ always() && steps.compile.outcome == 'failure' }} + with: + NOTIFY_MESSAGE: 'Failed to compile Haiku build' + WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}' + + - uses: ./.github/actions/upload_build + if: ${{ always() && steps.compile.outcome == 'success' }} + with: + SOURCE_FILE: 'src/ClassiCube-haiku' + DEST_NAME: 'ClassiCube-haiku' \ No newline at end of file diff --git a/.github/workflows/build_psp.yml b/.github/workflows/build_psp.yml index e975430e2..ff5674e34 100644 --- a/.github/workflows/build_psp.yml +++ b/.github/workflows/build_psp.yml @@ -6,21 +6,25 @@ concurrency: cancel-in-progress: true jobs: - build: + build-PSP: runs-on: ubuntu-latest container: image: pspdev/pspdev:latest steps: - uses: actions/checkout@v3 - - name: Compile + - name: Compile PSP build + id: compile run: | make psp - notify-failure: - runs-on: ubuntu-latest - needs: [build] - if: ${{ always() && (needs.build.result == 'failure') }} - steps: - - name: Notify failure - run: | - curl ${{ secrets.WEBHOOK_URL }} -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"username\": \"CC BuildBot\", \"avatar_url\": \"https://static.classicube.net/img/cc-cube-small.png\", \"content\": \"Failed to compile PSP build\" }" \ No newline at end of file + - uses: ./.github/actions/notify_failure + if: ${{ always() && steps.compile.outcome == 'failure' }} + with: + NOTIFY_MESSAGE: 'Failed to compile PSP build' + WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}' + + - uses: ./.github/actions/upload_build + if: ${{ always() && steps.compile.outcome == 'success' }} + with: + SOURCE_FILE: 'ClassiCube-psp.elf' + DEST_NAME: 'ClassiCube-psp.elf' \ No newline at end of file diff --git a/.github/workflows/build_wiigc.yml b/.github/workflows/build_wiigc.yml index 5756c288b..3a4a2b07a 100644 --- a/.github/workflows/build_wiigc.yml +++ b/.github/workflows/build_wiigc.yml @@ -12,17 +12,25 @@ jobs: image: devkitpro/devkitppc:latest steps: - uses: actions/checkout@v3 - - name: Compile + - name: Compile Wii and GameCube build + id: compile run: | make wii - make clean - make gamecube - notify-failure: - runs-on: ubuntu-latest - needs: [build] - if: ${{ always() && (needs.build.result == 'failure') }} - steps: - - name: Notify failure - run: | - curl ${{ secrets.WEBHOOK_URL }} -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"username\": \"CC BuildBot\", \"avatar_url\": \"https://static.classicube.net/img/cc-cube-small.png\", \"content\": \"Failed to compile Wii/GameCube build\" }" \ No newline at end of file + - uses: ./.github/actions/notify_failure + if: ${{ always() && steps.compile.outcome == 'failure' }} + with: + NOTIFY_MESSAGE: 'Failed to compile Wii/Gamecube build' + WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}' + + - uses: ./.github/actions/upload_build + if: ${{ always() && steps.compile.outcome == 'success' }} + with: + SOURCE_FILE: 'ClassiCube-wii.elf' + DEST_NAME: 'ClassiCube-wii.elf' + + - uses: ./.github/actions/upload_build + if: ${{ always() && steps.compile.outcome == 'success' }} + with: + SOURCE_FILE: 'ClassiCube-wii.dol' + DEST_NAME: 'ClassiCube-wii.dol' \ No newline at end of file diff --git a/Makefile b/Makefile index 29b5f2f72..9bf2387c0 100644 --- a/Makefile +++ b/Makefile @@ -154,7 +154,7 @@ psp: wii: $(MAKE) -f src/Makefile_wii PLAT=wii gamecube: - $(MAKE) -f Makefile_gamecube PLAT=gamecube + $(MAKE) -f src/Makefile_gamecube PLAT=gamecube clean: $(DEL) $(OBJECTS)