CI/CD: Implement GitHub Actions and public nightly builds

This commit is contained in:
Jj0YzL5nvJ 2021-12-05 09:00:38 -07:00
parent 32e2734421
commit a056188d84
2 changed files with 268 additions and 2 deletions

252
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,252 @@
name: UI Console
on:
push:
paths-ignore:
- '**/*.md'
- '.{gitattributes,gitignore,travis.yml}'
- 'appveyor.yml,README'
pull_request:
paths-ignore:
- '**/*.md'
- '.{gitattributes,gitignore,travis.yml}'
- 'appveyor.yml,README'
workflow_dispatch:
jobs:
Linux:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
- cc: Clang
name: Linux / ${{ matrix.cc }} / x64 | x86
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Get build dependencies and arrange the environment
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install libsdl1.2-dev libsdl2-dev
sudo apt-get --reinstall -y install gcc-multilib g++-multilib libc6 libc6-dev-i386 libsdl1.2debian:i386 libsdl2-2.0-0:i386
LINK="sudo ln -s -T"
cd /usr/lib/i386-linux-gnu
if ! [[ -f libSDL.so ]]; then ${LINK} libSDL-1.2.so.0.11.4 libSDL.so; fi
if ! [[ -f libSDL2.so ]]; then ${LINK} libSDL2-2.0.so.0.10.0 libSDL2.so; fi
cd /usr/include/SDL2
if ! [[ -f _real_SDL_config.h ]]; then ${LINK} ../x86_64-linux-gnu/SDL2/_real_SDL_config.h _real_SDL_config.h; fi
sudo ldconfig
- name: Build and related stuff
run: |
if [[ "${{ matrix.cc }}" == "GCC" ]]; then
CC="gcc"
CXX="g++"
else
CC="clang"
CXX="clang++"
fi
${CC} --version
echo ""
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
SDL="sdl"
for BITS in 64 32 64 32
do
if [[ "${SDL}" == "sdl" ]]; then MSG="SDL1.2"; else MSG="SDL2"; fi
if [[ ${BITS} -eq 32 ]]; then MSG="x86 / ${MSG}"; else MSG="x64 / ${MSG}"; fi
echo ""
echo ":: ${{ matrix.cc }} ${MSG} ::"
echo ""
make -C projects/unix clean
echo ""
make CC="${CC}" CXX="${CXX}" BITS="${BITS}" SDL_CONFIG="${SDL}-config" -C projects/unix all
echo ""
ls -gG projects/unix/mupen64plus
ldd projects/unix/mupen64plus
if [[ ${BITS} -eq 32 ]]; then SDL="sdl2"; fi
done
MSYS2:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
platform: x64
cross: x86_64
bits: 64
- cc: GCC
platform: x86
cross: i686
bits: 32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.platform }}
runs-on: windows-2019
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW${{ matrix.bits }}
update: true
install: >-
git
make
mingw-w64-${{ matrix.cross }}-gcc
mingw-w64-${{ matrix.cross }}-toolchain
mingw-w64-${{ matrix.cross }}-SDL2
- name: Build and related stuff
run: |
export OPTFLAGS="-O2 -flto"
echo "G_REV=$(git rev-parse --short HEAD)" >> "${GITHUB_ENV}"
CC="gcc"
CXX="g++"
${CC} --version
echo ""
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
echo ""
echo ":: ${{ matrix.cc }} ${{ matrix.platform }} / SDL2 ::"
echo ""
make -C projects/unix clean
echo ""
make CC="${CC}" CXX="${CXX}" BITS="${{ matrix.bits }}" -C projects/unix all
echo ""
ls -gG projects/unix/*.exe
ldd projects/unix/mupen64plus.exe
- name: Copy binaries, dependencies, etc...
run: |
mkdir pkg
if [[ ${{ matrix.bits }} -eq 32 ]]; then LIBGCC="libgcc_s_dw2-1"; else LIBGCC="libgcc_s_seh-1"; fi
for LIB in ${LIBGCC} libwinpthread-1 SDL2
do
echo ":: Copying ${LIB}.dll"
cp "/mingw${{ matrix.bits }}/bin/${LIB}.dll" pkg/
done
if [ -d data ]; then
cd data
for DAT in *
do
if [[ "${DAT}" != "mupen64plus.desktop" ]]; then
echo ":: Copying ${DAT}"
cp -r "${DAT}" ../pkg/
fi
done
fi
cd ../projects/unix/
for BIN in *.exe
do
echo ":: Copying ${BIN}"
cp "${BIN}" ../../pkg/
done
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: mupen64plus-ui-console-msys2-${{ matrix.platform }}-g${{ env.G_REV }}
path: pkg/*
MSVC:
strategy:
fail-fast: false
matrix:
include:
- toolset: v142
platform: x64
- toolset: v141_xp
platform: x86
name: Windows / MSVC ${{ matrix.toolset }} / ${{ matrix.platform }}
runs-on: windows-2019
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v2
- uses: microsoft/setup-msbuild@v1.0.3
# with:
# vs-version: 16.11
- name: Build and related stuff
run: |
for /f "tokens=1" %%R in ('git rev-parse --short HEAD') do set "G_REV=%%R"
echo G_REV=%G_REV%>> "%GITHUB_ENV%"
set "ARCH=${{ matrix.platform }}"
if [%ARCH%] == [x86] set "ARCH=Win32"
echo.
msbuild --version
echo.
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-win32-deps.git ..\mupen64plus-win32-deps
echo.
msbuild projects\msvc\mupen64plus-ui-console.vcxproj /p:Configuration=Release;Platform=%ARCH%;PlatformToolset=${{ matrix.toolset }}
echo.
md backup
copy projects\msvc\%ARCH%\Release\mupen64plus-ui-console.exe backup\
dir backup\*.exe
- name: Copy binaries, dependencies, etc...
run: |
md pkg\icons
cd pkg
xcopy "..\backup" .
xcopy /e "..\data\icons" icons
copy "..\..\mupen64plus-win32-deps\SDL2-2.0.10\lib\${{ matrix.platform }}\*.dll" .
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: mupen64plus-ui-console-msvc-${{ matrix.platform }}-g${{ env.G_REV }}
path: pkg/*
Nightly-build:
runs-on: ubuntu-latest
needs: [MSYS2, MSVC]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: binaries
- name: Get some tools
run: |
sudo apt-get update
sudo apt-get -y install hashdeep
- name: Creating new artifacts and update nightly-build
run: |
mkdir pkg
cd binaries
for BIN in *
do
echo ":: Creating ${BIN}.zip"
cd "${BIN}"
zip -r "../../pkg/${BIN}.zip" *
cd ..
done
cd ../pkg
echo ""
for BIN in *.zip
do
ls -gG ${BIN}
tigerdeep -l ${BIN} >> ${BIN:0:22}.tiger.txt
sha256sum ${BIN} >> ${BIN:0:22}.sha256.txt
sha512sum ${BIN} >> ${BIN:0:22}.sha512.txt
done
echo ""
echo "TIGER:"
cat *.tiger.txt
echo ""
echo "SHA256:"
cat *.sha256.txt
echo ""
echo "SHA512:"
cat *.sha512.txt
echo ""
git tag -f nightly-build
git push -f origin nightly-build
- name: Nightly-build
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: false
tag: nightly-build
artifacts: pkg/*

View file

@ -132,8 +132,22 @@ ifeq ($(ARCH_DETECTED), 64BITS_32)
ifeq ($(OS), FREEBSD)
$(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
endif
ifneq ($(OS), OSX)
ifeq ($(OS), MINGW)
CFLAGS += -march=i686
LDFLAGS += -Wl,-m,i386pe
else
CFLAGS += -m32
LDFLAGS += -Wl,-m,elf_i386
endif
endif
endif
ifeq ($(ARCH_DETECTED), 64BITS)
ifeq ($(OS), MINGW)
CFLAGS += -march=x86-64
LDFLAGS += -Wl,-m,i386pep
endif
endif
# set mupen64plus core API header path