shithub: rgbds

Download patch

ref: 12ef87986058f1d5343cf53a359e7aa064fbae7c
parent: 3fce9ed9a44eb55cd36b1520740b433a0f11685b
parent: 179e04747499b9ae132b46bab7c41a050ca52f55
author: Eldred Habert <[email protected]>
date: Tue Feb 18 15:04:26 EST 2020

Merge pull request #486 from ISSOtm/actions

Switch CI to GitHub Actions

--- /dev/null
+++ b/.github/actions/install_deps.sh
@@ -1,0 +1,14 @@
+case `echo $1 | cut -d '-' -f 1` in
+	ubuntu)
+		sudo apt-get -qq update
+		sudo apt-get install -yq bison libpng-dev pkg-config
+		;;
+	macos)
+		brew install libpng pkg-config md5sha1sum
+		;;
+	*)
+		echo "WARNING: Cannot install deps for OS '$1'"
+		;;
+esac
+
+yacc --version
--- /dev/null
+++ b/.github/actions/mingw-configure.sh
@@ -1,0 +1,17 @@
+#!/bin/bash
+
+source mingw-env @TRIPLE@
+echo LAST IS: $last
+
+# check if last arg is a path to configure, else use parent
+for last; do true; done
+if test -x "${last}/configure"; then
+  config_path="$last"
+else
+  config_path=".."
+fi
+
+${config_path}/configure \
+  --host=@TRIPLE@ --target=@TRIPLE@ --build="$CHOST" \
+  --prefix=/usr/@TRIPLE@ --libdir=/usr/@TRIPLE@/lib --includedir=/usr/@TRIPLE@/include \
+  --enable-shared --enable-static "$@"
--- /dev/null
+++ b/.github/actions/mingw-env.sh
@@ -1,0 +1,16 @@
+#!/bin/sh
+
+_arch=$1
+
+default_mingw_pp_flags="-D_FORTIFY_SOURCE=2"
+default_mingw_compiler_flags="$default_mingw_pp_flags -O2 -pipe -fno-plt -fexceptions --param=ssp-buffer-size=4"
+default_mingw_linker_flags="-Wl,-O1,--sort-common,--as-needed -fstack-protector"
+
+export CPPFLAGS="${MINGW_CPPFLAGS:-$default_mingw_pp_flags $CPPFLAGS}"
+export CFLAGS="${MINGW_CFLAGS:-$default_mingw_compiler_flags $CFLAGS}"
+export CXXFLAGS="${MINGW_CXXFLAGS:-$default_mingw_compiler_flags $CXXFLAGS}"
+export LDFLAGS="${MINGW_LDFLAGS:-$default_mingw_linker_flags $LDFLAGS}"
+
+mingw_prefix=/usr/${_arch}
+export PKG_CONFIG_SYSROOT_DIR="${mingw_prefix}"
+export PKG_CONFIG_LIBDIR="${mingw_prefix}/lib/pkgconfig:${mingw_prefix}/share/pkgconfig"
--- /dev/null
+++ b/.github/actions/mingw-w64-libpng-dev.sh
@@ -1,0 +1,44 @@
+#!/bin/sh
+
+# This script was written by ISSOtm while looking at Arch Linux's PKGBUILD for
+# the corresponding package. (And its dependencies)
+# https://aur.archlinux.org/packages/mingw-w64-libpng/
+
+set -e
+
+pngver=1.6.37
+_apngver=$pngver
+_arch="$1"
+
+
+## Install mingw-configure and mingw-env (both build dependencies)
+
+install -m 755 .github/actions/mingw-env.sh /usr/bin/mingw-env
+
+sed "s|@TRIPLE@|${_arch}|g" .github/actions/mingw-configure.sh > ${_arch}-configure
+install -m 755 ${_arch}-configure /usr/bin/
+
+
+## Grab sources and check them
+
+wget http://downloads.sourceforge.net/sourceforge/libpng/libpng-$pngver.tar.xz
+wget http://downloads.sourceforge.net/project/apng/libpng/libpng16/libpng-$_apngver-apng.patch.gz
+sha256sum -c .github/actions/mingw-w64-libpng-dev.sha256sums
+
+## Extract sources
+
+tar -xf libpng-$pngver.tar.xz
+gunzip libpng-$_apngver-apng.patch.gz
+
+
+## Start building!
+
+cd libpng-$pngver
+# Patch in apng support
+patch -p0 ../libpng-$_apngver-apng.patch
+
+mkdir -p build-${_arch}
+cd build-${_arch}
+${_arch}-configure LDFLAGS=-static-libgcc
+make
+make install
--- /dev/null
+++ b/.github/actions/mingw-w64-libpng-dev.sha256sums
@@ -1,0 +1,2 @@
+10d9e0cb60e2b387a79b355eb7527c0bee2ed8cbd12cf04417cabc4d6976683c  libpng-1.6.37-apng.patch.gz
+505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca  libpng-1.6.37.tar.xz
--- /dev/null
+++ b/.github/workflows/checkpatch.yml
@@ -1,0 +1,17 @@
+name: "Code style checking"
+on: pull_request
+
+jobs:
+  checkpatch:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set up checkpatch
+        run: |
+          wget 'https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl'
+          chmod +x checkpatch.pl
+          touch const_structs.checkpatch
+          touch spelling.txt
+      - name: Checkpatch
+        run: |
+          make checkpatch CHECKPATCH=./checkpatch.pl
--- /dev/null
+++ b/.github/workflows/testing.yml
@@ -1,0 +1,122 @@
+name: "Regression testing"
+on: push
+
+jobs:
+  unix-testing:
+    strategy:
+      matrix:
+        os: [ubuntu-18.04, ubuntu-16.04, macos-10.15]
+        cc: [gcc, clang]
+        include:
+          - os: ubuntu-18.04
+            cc: gcc
+            target: develop
+    runs-on: ${{ matrix.os }}
+    steps:
+      - uses: actions/checkout@v2
+      - name: Install deps
+        shell: bash
+        run: |
+          ./.github/actions/install_deps.sh ${{ matrix.os }}
+      - name: Build
+        run: |
+          make ${{ matrix.target }} -j Q= CC=${{ matrix.cc }}
+      - name: Install
+        run: |
+          sudo make install -j Q=
+      - name: Package binaries
+        run: |
+          mkdir bins
+          cp rgb{asm,link,fix,gfx} bins
+      - name: Upload binaries
+        uses: actions/upload-artifact@v1
+        with:
+          name: rgbds-canary-${{ matrix.os }}-${{ matrix.cc }}-bins
+          path: bins
+      - name: Test
+        shell: bash
+        run: |
+          test/run-tests.sh
+
+  windows-build:
+    strategy:
+      matrix:
+        bits: [32, 64]
+        os: [ubuntu-latest]
+        include:
+          - bits: 32
+            arch: i686
+            triplet: i686-w64-mingw32
+          - bits: 64
+            arch: x86-64
+            triplet: x86_64-w64-mingw32
+    runs-on: ${{ matrix.os }}
+    env:
+      DIST_DIR: win${{ matrix.bits }}
+    steps:
+      - uses: actions/checkout@v2
+      - name: Install deps
+        shell: bash
+        run: |
+          ./.github/actions/install_deps.sh ${{ matrix.os }}
+      - name: Install MinGW
+        run: |
+          sudo apt-get install gcc-mingw-w64-${{ matrix.arch }} mingw-w64-tools libz-mingw-w64-dev
+      - name: Install libpng dev headers for MinGW
+        run: |
+          sudo ./.github/actions/mingw-w64-libpng-dev.sh ${{ matrix.triplet }}
+      - name: Build Windows binaries
+        run: |
+          make mingw${{ matrix.bits }} -j Q=
+      - name: Package binaries
+        run: |
+          mkdir bins
+          mv rgbasm bins/rgbasm.exe
+          mv rgblink bins/rgblink.exe
+          mv rgbfix bins/rgbfix.exe
+          mv rgbgfx bins/rgbgfx.exe
+          cp /usr/${{ matrix.triplet }}/lib/zlib1.dll bins
+          cp /usr/${{ matrix.triplet }}/bin/libpng16-16.dll bins
+      - name: Upload Windows binaries
+        uses: actions/upload-artifact@v1
+        with:
+          name: bins${{ matrix.bits }}
+          path: bins
+
+  windows-testing:
+    needs: windows-build
+    strategy:
+      matrix:
+        bits: [32, 64]
+        include:
+          - bits: 32
+            rgbgfx_fail: true
+          - bits: 64
+            rgbgfx_fail: false
+    runs-on: windows-2019
+    steps:
+      - uses: actions/checkout@v2
+      - name: Retrieve binaries
+        uses: actions/download-artifact@v1
+        with:
+          name: bins${{ matrix.bits }}
+          path: bins
+      - name: Extract binaries
+        shell: bash
+        run: |
+          cp bins/* .
+      - name: Run tests
+        shell: bash
+        run: |
+          test/run-tests.sh
+        if: matrix.rgbgfx_fail == false
+      - name: Run tests (without RGBGFX)
+        shell: bash
+        run: |
+          pushd test/asm
+          ./test.sh
+          popd
+          pushd test/link
+          ./test.sh
+          popd
+        if: matrix.rgbgfx_fail == true