From c614c5fa73ea613da4e5f584a9084bab6d4398ea Mon Sep 17 00:00:00 2001 From: duhow Date: Sat, 24 Jul 2021 15:02:12 +0200 Subject: [PATCH 01/10] Initial commit for Github Actions --- .github/workflows/build.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..05a2c887 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,20 @@ +on: + pull_request: + push: + branches: + - main + - master + - github-actions + +jobs: + build-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install deps + run: | + sudo apt update + sudo apt install -y libsdl2-image-dev + - name: Build + run: make -C src all + From 3150fbd47d1977f2f2eb6c7db3bab70edf611b5b Mon Sep 17 00:00:00 2001 From: duhow Date: Sat, 24 Jul 2021 15:43:01 +0200 Subject: [PATCH 02/10] Build multi-arch linux with Docker containers --- .github/workflows/build.yaml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 05a2c887..e80e73b7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,13 +8,28 @@ on: jobs: build-linux: + name: Build ${{ matrix.target }} runs-on: ubuntu-latest + container: + image: ${{ matrix.image }} + strategy: + fail-fast: false + matrix: + include: + - image: ubuntu:21.04 + target: x86_64 + - image: arm32v7/ubuntu:21.04 + target: arm-linux-gnueabihf + - image: arm64v8/ubuntu:21.04 + target: aarch64-linux-gnu steps: - uses: actions/checkout@v2 - name: Install deps run: | - sudo apt update - sudo apt install -y libsdl2-image-dev + apt update + apt install -y make gcc libsdl2-image-dev - name: Build - run: make -C src all + run: make -C src -j $(nproc) all + - name: List + run: ls -l From 487621c522bfaa48f73a60baca6cfeacde8b4764 Mon Sep 17 00:00:00 2001 From: duhow Date: Sat, 24 Jul 2021 16:04:44 +0200 Subject: [PATCH 03/10] Download gcc packages --- .github/workflows/build.yaml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e80e73b7..bfee58ab 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,28 +8,33 @@ on: jobs: build-linux: - name: Build ${{ matrix.target }} + name: Build ${{ matrix.name }} runs-on: ubuntu-latest container: - image: ${{ matrix.image }} + image: ubuntu:21.04 strategy: fail-fast: false matrix: + gcc-version: 10 + cc: "" + package: "" include: - - image: ubuntu:21.04 - target: x86_64 - - image: arm32v7/ubuntu:21.04 - target: arm-linux-gnueabihf - - image: arm64v8/ubuntu:21.04 - target: aarch64-linux-gnu + - name: x86_64 + cc: "gcc" + - name: armv7 + package: "-arm-linux-gnueabihf" + cc: "arm-linux-gnueabihf-gcc" + - name: aarch64-linux-gnu + package: "-aarch64-linux-gnu" + cc: "aarch64-linux-gnu-gcc" steps: - uses: actions/checkout@v2 - name: Install deps run: | apt update - apt install -y make gcc libsdl2-image-dev + apt install -y make libsdl2-image-dev gcc-${{ matrix.gcc-version }}${{ matrix.package }} - name: Build - run: make -C src -j $(nproc) all + run: make -C src -j $(nproc) all CC=${{ matrix.cc }}-${{ matrix.gcc-version }} - name: List run: ls -l From 9ce30951c1f60ba0ce6c548a7eb5781b858303ad Mon Sep 17 00:00:00 2001 From: duhow Date: Sat, 24 Jul 2021 16:05:35 +0200 Subject: [PATCH 04/10] Fix workflow and remove docker container --- .github/workflows/build.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bfee58ab..a7fb816e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,16 +10,13 @@ jobs: build-linux: name: Build ${{ matrix.name }} runs-on: ubuntu-latest - container: - image: ubuntu:21.04 strategy: fail-fast: false matrix: - gcc-version: 10 - cc: "" - package: "" + gcc-version: [10] include: - name: x86_64 + package: "" cc: "gcc" - name: armv7 package: "-arm-linux-gnueabihf" @@ -31,8 +28,8 @@ jobs: - uses: actions/checkout@v2 - name: Install deps run: | - apt update - apt install -y make libsdl2-image-dev gcc-${{ matrix.gcc-version }}${{ matrix.package }} + sudo apt update + sudo apt install -y make libsdl2-image-dev gcc-${{ matrix.gcc-version }}${{ matrix.package }} - name: Build run: make -C src -j $(nproc) all CC=${{ matrix.cc }}-${{ matrix.gcc-version }} - name: List From 6d356ca7f2e4330c0e222af288cba824cb72f620 Mon Sep 17 00:00:00 2001 From: duhow Date: Sat, 24 Jul 2021 16:14:53 +0200 Subject: [PATCH 05/10] Set fix version --- .github/workflows/build.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a7fb816e..3780e453 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,7 +13,6 @@ jobs: strategy: fail-fast: false matrix: - gcc-version: [10] include: - name: x86_64 package: "" @@ -29,9 +28,11 @@ jobs: - name: Install deps run: | sudo apt update - sudo apt install -y make libsdl2-image-dev gcc-${{ matrix.gcc-version }}${{ matrix.package }} + sudo apt install -y make libsdl2-image-dev gcc-10${{ matrix.package }} - name: Build - run: make -C src -j $(nproc) all CC=${{ matrix.cc }}-${{ matrix.gcc-version }} + env: + CFLAGS: "-I/usr/include" + run: make -C src -j $(nproc) all CC=${{ matrix.cc }}-10 - name: List run: ls -l From 510404f049716ab525395fcdada8952b699f2bdb Mon Sep 17 00:00:00 2001 From: duhow Date: Sat, 24 Jul 2021 16:20:35 +0200 Subject: [PATCH 06/10] Add library folder --- .github/workflows/build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3780e453..4cbfec38 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,13 +14,13 @@ jobs: fail-fast: false matrix: include: - - name: x86_64 + - name: amd64 package: "" cc: "gcc" - name: armv7 package: "-arm-linux-gnueabihf" cc: "arm-linux-gnueabihf-gcc" - - name: aarch64-linux-gnu + - name: aarch64 package: "-aarch64-linux-gnu" cc: "aarch64-linux-gnu-gcc" steps: @@ -31,8 +31,8 @@ jobs: sudo apt install -y make libsdl2-image-dev gcc-10${{ matrix.package }} - name: Build env: - CFLAGS: "-I/usr/include" - run: make -C src -j $(nproc) all CC=${{ matrix.cc }}-10 + CFLAGS: "-I/usr/include/x86_64-linux-gnu/SDL2" + run: make -C src -j $(nproc) all CC=${{ matrix.cc }}-10 - name: List run: ls -l From 778bbfe4a19d3390f3eed61a7c1c023fb8d454c3 Mon Sep 17 00:00:00 2001 From: duhow Date: Sun, 5 Sep 2021 12:56:22 +0200 Subject: [PATCH 07/10] Attempt fix build --- .github/workflows/build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4cbfec38..d7fdcf6a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,3 +1,5 @@ +name: CI + on: pull_request: push: @@ -31,7 +33,7 @@ jobs: sudo apt install -y make libsdl2-image-dev gcc-10${{ matrix.package }} - name: Build env: - CFLAGS: "-I/usr/include/x86_64-linux-gnu/SDL2" + CFLAGS: "-I/usr/include/x86_64-linux-gnu/SDL2 -I/usr/include/x86_64-linux-gnu" run: make -C src -j $(nproc) all CC=${{ matrix.cc }}-10 - name: List run: ls -l From 7e5ead4a9881f4d03d6ecbd435a22727461532e1 Mon Sep 17 00:00:00 2001 From: duhow Date: Sun, 5 Sep 2021 13:11:41 +0200 Subject: [PATCH 08/10] Add check version workflow --- .github/workflows/build.yaml | 19 ++++++++------- .github/workflows/check-version.yaml | 36 ++++++++++++++++++++++++++++ src/config.h | 2 +- 3 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/check-version.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d7fdcf6a..2b77c9f0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,12 +19,13 @@ jobs: - name: amd64 package: "" cc: "gcc" - - name: armv7 - package: "-arm-linux-gnueabihf" - cc: "arm-linux-gnueabihf-gcc" - - name: aarch64 - package: "-aarch64-linux-gnu" - cc: "aarch64-linux-gnu-gcc" + # TODO FIX arm - cross-compile + #- name: armv7 + # package: "-arm-linux-gnueabihf" + # cc: "arm-linux-gnueabihf-gcc" + #- name: aarch64 + # package: "-aarch64-linux-gnu" + # cc: "aarch64-linux-gnu-gcc" steps: - uses: actions/checkout@v2 - name: Install deps @@ -32,9 +33,9 @@ jobs: sudo apt update sudo apt install -y make libsdl2-image-dev gcc-10${{ matrix.package }} - name: Build - env: - CFLAGS: "-I/usr/include/x86_64-linux-gnu/SDL2 -I/usr/include/x86_64-linux-gnu" + #env: + # CFLAGS: "-I/usr/include/x86_64-linux-gnu/SDL2 -I/usr/include/x86_64-linux-gnu" run: make -C src -j $(nproc) all CC=${{ matrix.cc }}-10 - name: List - run: ls -l + run: ls -l --color diff --git a/.github/workflows/check-version.yaml b/.github/workflows/check-version.yaml new file mode 100644 index 00000000..c0fb5266 --- /dev/null +++ b/.github/workflows/check-version.yaml @@ -0,0 +1,36 @@ +name: Check new version + +on: + push: + branches: + - master + - github-actions + paths: + - 'src/config.h' + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check version + id: config + run: | + VERSION=$(awk '/SDLPOP_VERSION/ {print $3}' src/config.h | head -n1 | tr -d '"') + echo "Version: $VERSION" + echo "::set-output name=version::$VERSION" + - uses: mukunku/tag-exists-action@v1.0.0 + id: checkTag + with: + tag: v${{ steps.config.outputs.version }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Tag new version + if: ${{ steps.checkTag.outputs.exists != 'true' }} + uses: tvdias/github-tagger@v0.0.2 + with: + # NOTE: May need PAT Token instead of Github Token. + repo-token: ${{ secrets.GITHUB_TOKEN }} + tag: v${{ steps.config.outputs.version }} + diff --git a/src/config.h b/src/config.h index d2506294..2497bd27 100644 --- a/src/config.h +++ b/src/config.h @@ -30,7 +30,7 @@ The authors of this program may be contacted at https://forum.princed.org #define POP_MAX_PATH 256 #define POP_MAX_OPTIONS_SIZE 256 -#define SDLPOP_VERSION "1.22" +#define SDLPOP_VERSION "1.23" #define WINDOW_TITLE "Prince of Persia (SDLPoP) v" SDLPOP_VERSION // Enable or disable the SDL hardware accelerated renderer backend From f92c8866a3e4146bd95407a9f6ccec48a8ac8754 Mon Sep 17 00:00:00 2001 From: duhow Date: Sun, 5 Sep 2021 13:13:14 +0200 Subject: [PATCH 09/10] Revert config version --- src/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.h b/src/config.h index 2497bd27..d2506294 100644 --- a/src/config.h +++ b/src/config.h @@ -30,7 +30,7 @@ The authors of this program may be contacted at https://forum.princed.org #define POP_MAX_PATH 256 #define POP_MAX_OPTIONS_SIZE 256 -#define SDLPOP_VERSION "1.23" +#define SDLPOP_VERSION "1.22" #define WINDOW_TITLE "Prince of Persia (SDLPoP) v" SDLPOP_VERSION // Enable or disable the SDL hardware accelerated renderer backend From 7e9f2483d377cbac4303290d9c58310e55bb1bc4 Mon Sep 17 00:00:00 2001 From: duhow Date: Sun, 5 Sep 2021 15:17:23 +0200 Subject: [PATCH 10/10] Use master branch only --- .github/workflows/build.yaml | 2 -- .github/workflows/check-version.yaml | 1 - 2 files changed, 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2b77c9f0..9f29ca02 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,9 +4,7 @@ on: pull_request: push: branches: - - main - master - - github-actions jobs: build-linux: diff --git a/.github/workflows/check-version.yaml b/.github/workflows/check-version.yaml index c0fb5266..e9e10508 100644 --- a/.github/workflows/check-version.yaml +++ b/.github/workflows/check-version.yaml @@ -4,7 +4,6 @@ on: push: branches: - master - - github-actions paths: - 'src/config.h'