From 02a23cd4159120296b2937845353fbe96298c415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Israelson?= <57065102+israpps@users.noreply.github.com> Date: Sat, 11 Nov 2023 20:42:10 -0300 Subject: [PATCH 1/4] add continous integration --- .github/workflows/compile.yml | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/compile.yml diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml new file mode 100644 index 0000000..733ba19 --- /dev/null +++ b/.github/workflows/compile.yml @@ -0,0 +1,60 @@ +name: CI + +on: + push: + paths: + - 'engine/**' + - 'demo/**' + - '**.cpp' + - '.github/workflows/compile.yml' + workflow_dispatch: + inputs: + make_args: + description: pass extra make argumments to Program compilation + repository_dispatch: + types: [run_build] + +jobs: + build: + runs-on: ubuntu-latest + container: h4570/tyra + steps: + - name: install deps + run: | + apt-get update + apt install -y git make wget + + - name: Workaround permission issue + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - name: Checkout + uses: actions/checkout@v3 + + - name: Compile tyra + run: | + make clean all ${{ github.event.inputs.make_args }} -C engine + + - name: Compile tyra demo + run: | + make clean all -C demo + + - name: Get short SHA + id: slug + run: | + echo "SHA8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV + + - name: Get branch + if: github.ref != 'refs/heads/main' + id: brnch + run: | + echo "BRANCH=$(echo -${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + + - name: Upload artifacts + if: ${{ success() }} + uses: actions/upload-artifact@v3 + with: + name: tyra-${{ env.SHA8 }}${{ env.BRANCH }} + path: | + engine/bin + demo/bin From caa0fd4db3c9d66bccd95dd175a74c728f7db8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Sobczy=C5=84ski?= <32263891+h4570@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:27:38 +0100 Subject: [PATCH 2/4] refactor github actions --- .github/workflows/compile.yml | 60 --------------- .github/workflows/master-build.yml | 74 +++++++++++++++++++ .github/workflows/pr-build-check.yml | 72 ++++++++++++++++++ .../{check-format.yml => pr-format-check.yml} | 2 +- 4 files changed, 147 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/compile.yml create mode 100644 .github/workflows/master-build.yml create mode 100644 .github/workflows/pr-build-check.yml rename .github/workflows/{check-format.yml => pr-format-check.yml} (96%) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml deleted file mode 100644 index 733ba19..0000000 --- a/.github/workflows/compile.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: CI - -on: - push: - paths: - - 'engine/**' - - 'demo/**' - - '**.cpp' - - '.github/workflows/compile.yml' - workflow_dispatch: - inputs: - make_args: - description: pass extra make argumments to Program compilation - repository_dispatch: - types: [run_build] - -jobs: - build: - runs-on: ubuntu-latest - container: h4570/tyra - steps: - - name: install deps - run: | - apt-get update - apt install -y git make wget - - - name: Workaround permission issue - run: | - git config --global --add safe.directory "$GITHUB_WORKSPACE" - - - name: Checkout - uses: actions/checkout@v3 - - - name: Compile tyra - run: | - make clean all ${{ github.event.inputs.make_args }} -C engine - - - name: Compile tyra demo - run: | - make clean all -C demo - - - name: Get short SHA - id: slug - run: | - echo "SHA8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV - - - name: Get branch - if: github.ref != 'refs/heads/main' - id: brnch - run: | - echo "BRANCH=$(echo -${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV - - - name: Upload artifacts - if: ${{ success() }} - uses: actions/upload-artifact@v3 - with: - name: tyra-${{ env.SHA8 }}${{ env.BRANCH }} - path: | - engine/bin - demo/bin diff --git a/.github/workflows/master-build.yml b/.github/workflows/master-build.yml new file mode 100644 index 0000000..8ed840d --- /dev/null +++ b/.github/workflows/master-build.yml @@ -0,0 +1,74 @@ +name: Official build + +on: + push: + branches: [ master ] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + container: h4570/tyra + steps: + - name: Install dependencies + run: | + apt-get update + apt install -y git make wget + + - name: Set git safe directory + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - name: Checkout + uses: actions/checkout@v3 + + - name: Get short SHA + id: slug + run: | + echo "SHA8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV + + - name: Compile engine + run: | + make clean all -C engine + + - name: Compile tutorials + run: | + make clean all -C tutorials/01-hello + make clean all -C tutorials/02-sprite + make clean all -C tutorials/03-minecraft + make clean all -C tutorials/04-de_dust2 + make clean all -C tutorials/05-animation + make clean all -C tutorials/06-audio + make clean all -C tutorials/07-lighting + make clean all -C tutorials/08-skybox-debug + make clean all -C tutorials/09-manual-mode + make clean all -C tutorials/10-sprite-sheet + + - name: Compile demo + run: | + make clean all -C demo + + - name: Upload tutorials + if: ${{ success() }} + uses: actions/upload-artifact@v3 + with: + name: binaries-${{ env.SHA8 }}-${{ env.BRANCH }} + path: | + tutorials/01-hello/bin + tutorials/02-sprite/bin + tutorials/03-minecraft/bin + tutorials/04-de_dust2/bin + tutorials/05-animation/bin + tutorials/06-audio/bin + tutorials/07-lighting/bin + tutorials/08-skybox-debug/bin + tutorials/09-manual-mode/bin + tutorials/10-sprite-sheet/bin + + - name: Upload demo + if: ${{ success() }} + uses: actions/upload-artifact@v3 + with: + name: tyra-${{ env.SHA8 }} + path: | + demo/bin \ No newline at end of file diff --git a/.github/workflows/pr-build-check.yml b/.github/workflows/pr-build-check.yml new file mode 100644 index 0000000..f54641b --- /dev/null +++ b/.github/workflows/pr-build-check.yml @@ -0,0 +1,72 @@ +name: PR build check + +on: + pull_request: + branches: [ master ] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + container: h4570/tyra + steps: + - name: Install dependencies + run: | + apt-get update + apt install -y git make wget + + - name: Set git safe directory + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - name: Checkout + uses: actions/checkout@v3 + + - name: Compile engine + run: | + make clean all -C engine + + - name: Compile tutorials + run: | + make clean all -C tutorials/01-hello + make clean all -C tutorials/02-sprite + make clean all -C tutorials/03-minecraft + make clean all -C tutorials/04-de_dust2 + make clean all -C tutorials/05-animation + make clean all -C tutorials/06-audio + make clean all -C tutorials/07-lighting + make clean all -C tutorials/08-skybox-debug + make clean all -C tutorials/09-manual-mode + make clean all -C tutorials/10-sprite-sheet + + - name: Compile demo + run: | + make clean all -C demo + + - name: Get short SHA + id: slug + run: | + echo "SHA8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV + + - name: Get branch + id: branch + run: | + echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + + - name: Upload build artifacts + if: ${{ success() }} + uses: actions/upload-artifact@v3 + with: + name: binaries-${{ env.SHA8 }}-${{ env.BRANCH }} + path: | + tutorials/01-hello/bin + tutorials/02-sprite/bin + tutorials/03-minecraft/bin + tutorials/04-de_dust2/bin + tutorials/05-animation/bin + tutorials/06-audio/bin + tutorials/07-lighting/bin + tutorials/08-skybox-debug/bin + tutorials/09-manual-mode/bin + tutorials/10-sprite-sheet/bin + demo/bin diff --git a/.github/workflows/check-format.yml b/.github/workflows/pr-format-check.yml similarity index 96% rename from .github/workflows/check-format.yml rename to .github/workflows/pr-format-check.yml index 819d623..86e4c62 100644 --- a/.github/workflows/check-format.yml +++ b/.github/workflows/pr-format-check.yml @@ -1,5 +1,5 @@ #This is a modified version of the clang format check used on Open-PS2-Loader -name: CI-cpp-check +name: PR C++ format check on: push: From b84bd990594a9dacc0d66231904553ccf4ae5170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Sobczy=C5=84ski?= <32263891+h4570@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:29:46 +0100 Subject: [PATCH 3/4] fix job name --- .github/workflows/pr-format-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-format-check.yml b/.github/workflows/pr-format-check.yml index 86e4c62..075e80d 100644 --- a/.github/workflows/pr-format-check.yml +++ b/.github/workflows/pr-format-check.yml @@ -23,6 +23,7 @@ on: jobs: check-format: + name: Check clang format runs-on: ubuntu-latest steps: From 39a962c59bbeda0451238654860e6f5055dac2ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Sobczy=C5=84ski?= <32263891+h4570@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:53:35 +0100 Subject: [PATCH 4/4] github actions bugfixes --- .github/workflows/master-build.yml | 2 +- .github/workflows/pr-build-check.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/master-build.yml b/.github/workflows/master-build.yml index 8ed840d..ec78334 100644 --- a/.github/workflows/master-build.yml +++ b/.github/workflows/master-build.yml @@ -52,7 +52,7 @@ jobs: if: ${{ success() }} uses: actions/upload-artifact@v3 with: - name: binaries-${{ env.SHA8 }}-${{ env.BRANCH }} + name: binaries-${{ env.SHA8 }} path: | tutorials/01-hello/bin tutorials/02-sprite/bin diff --git a/.github/workflows/pr-build-check.yml b/.github/workflows/pr-build-check.yml index f54641b..cadc80e 100644 --- a/.github/workflows/pr-build-check.yml +++ b/.github/workflows/pr-build-check.yml @@ -51,7 +51,8 @@ jobs: - name: Get branch id: branch run: | - echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/refs\///g' | sed 's/\//_/g') + echo "BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV - name: Upload build artifacts if: ${{ success() }}