Merge pull request #40 from fpiesche/master

Move github workflow to using Docker to build
This commit is contained in:
Andrey K 2020-11-10 11:43:06 +03:00 committed by GitHub
commit b96e73cd0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 77 additions and 55 deletions

View file

@ -1,41 +0,0 @@
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
uses: textbook/git-checkout-submodule-action@master
with:
remote: true
- name: Setup enviroment
run: |
sudo apt-get install bsdtar
wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb
sudo dpkg -i devkitpro-pacman.deb
sudo dkp-pacman --noconfirm -Syu
sudo dkp-pacman --noconfirm -S devkitA64 switch-tools libnx switch-ffmpeg switch-glad switch-glfw switch-jansson switch-libdrm_nouveau switch-libexpat switch-libopus switch-libvpx switch-mbedtls switch-mesa switch-zlib switch-ffmpeg switch-pkg-config devkitpro-pkgbuild-helpers
- name: Build libcurl 7.69.1-1
run: |
wget https://github.com/devkitPro/pacman-packages/raw/1582ad85914b14497fae32a9fe9074c0374f99f7/switch/curl/PKGBUILD
dkp-makepkg
sudo cp -r pkg/switch-curl/opt/devkitpro/portlibs/switch/* /opt/devkitpro/portlibs/switch
- name: Build
run: |
export DEVKITPRO=/opt/devkitpro
export DEVKITA64=/opt/devkitpro/devkitA64
make -j NIGHTLY_BUILD=`git rev-parse --short "$GITHUB_SHA"`
- name: Upload moonlight.nro
uses: actions/upload-artifact@v1
with:
name: moonlight
path: moonlight.nro

36
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,36 @@
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
container:
image: docker://florianpiesche/moonlight-nx-build:latest
env:
# Set this to empty to skip building libcurl 7.69.1-1
LIBCURL_PKGBUILD_URL: https://github.com/devkitPro/pacman-packages/raw/1582ad85914b14497fae32a9fe9074c0374f99f7/switch/curl/PKGBUILD
# As pkgbuild needs to run unprivileged, this defines the user it will be run as
LIBCURL_BUILD_USER: build
steps:
- name: Check out repository
uses: actions/checkout@master
with:
submodules: recursive
- name: Run build
run: ./build.sh
- name: Upload moonlight.nro
uses: actions/upload-artifact@master
with:
name: moonlight
path: moonlight.nro

14
Dockerfile Normal file
View file

@ -0,0 +1,14 @@
FROM devkitpro/devkita64
# Add non-privileged build user
RUN useradd -m -s /bin/bash -G sudo build; passwd -d build
# Install fakeroot and updated git
RUN echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list.d/stretch-backports.list &&\
apt-get update &&\
apt-get -t stretch-backports -y install git fakeroot
# Install devkitpro-pkgbuild-helpers
RUN dkp-pacman -S --noconfirm devkitpro-pkgbuild-helpers
ENTRYPOINT ["/bin/bash"]

View file

@ -24,20 +24,12 @@ Moonlight-NX is a port of [Moonlight Game Streaming Project](https://github.com/
11. Minus+Plus - Guide button;
# Build Moonlight-NX
1. Setup [Development Environment](https://switchbrew.org/wiki/Setting_up_Development_Environment "Development Environment");
2. Install deps (`dkp-pacman` for Ubuntu, `pacman` for MacOS):
```
sudo (dkp-)pacman --noconfirm -S devkitA64 switch-tools libnx switch-ffmpeg switch-glad switch-glfw switch-jansson switch-libdrm_nouveau switch-libexpat switch-libopus switch-libvpx switch-mbedtls switch-mesa switch-zlib switch-ffmpeg switch-pkg-config devkitpro-pkgbuild-helpers
```
3. Install libcurl 7.69.1-1 (Please note - latest libcurl 7.69.1-2 currently unsupported! `dkp-makepkg` for Ubuntu, `makepkg` for MacOS. This will overwrite your current libcurl, be careful!):
```
wget https://github.com/devkitPro/pacman-packages/raw/1582ad85914b14497fae32a9fe9074c0374f99f7/switch/curl/PKGBUILD
(dkp-)makepkg
sudo cp -r pkg/switch-curl/opt/devkitpro/portlibs/switch/* /opt/devkitpro/portlibs/switch
```
4. Clone this repo: `git clone --recursive https://github.com/rock88/moonlight-nx.git`;
5. `cd moonlight-nx`;
6. `make`.
1. Build a development environment: `docker build . -t moonlight-nx-build`
2. Run run the development environment: `docker run -it moonlight-nx-build`
3. Clone this repo: `git clone --recursive https://github.com/rock88/moonlight-nx.git`;
4. Set environment variables for the custom libcurl build: `export LIBCURL_PKGBUILD_URL="https://github.com/devkitPro/pacman-packages/raw/1582ad85914b14497fae32a9fe9074c0374f99f7/switch/curl/PKGBUILD"; export LIBCURL_BUILD_USER="build"`
5. Run the build: `cd moonlight-nx; ./build.sh; exit`.
6. Copy the .nro out of the container: `docker cp moonlight-nx-build:moonlight-nx/moonlight.nro .`
# Assets
Icon - [moonlight-stream](https://github.com/moonlight-stream "moonlight-stream") project logo.

21
build.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# Exit with an error code if any of the commands fail
set -e
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
# Compile and deploy custom libcurl if a PKGBUILD url is set
if [[ ! -z $LIBCURL_PKGBUILD_URL ]]; then
curdir=$(pwd)
mkdir switch-libcurl
chown ${LIBCURL_BUILD_USER} switch-libcurl
cd switch-libcurl
wget ${LIBCURL_PKGBUILD_URL}
sudo -u ${LIBCURL_BUILD_USER} dkp-makepkg
cp -r pkg/switch-curl/opt/devkitpro/portlibs/switch/* /opt/devkitpro/portlibs/switch
cd ${curdir}
fi
# Run build
make -j NIGHTLY_BUILD=`git rev-parse --short "$GITHUB_SHA"`