Skip to content

Commit

Permalink
[ci] Add buildenv files & builder
Browse files Browse the repository at this point in the history
  • Loading branch information
NyaMisty committed Apr 13, 2022
1 parent c52ae38 commit 3a51778
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build AltServer

on:
push:

env:
REGISTRY: ghcr.io

jobs:
build:
strategy:
matrix:
builder: [ghcr.io/nyamisty/altserver_builder_alpine_armv7, ghcr.io/nyamisty/altserver_builder_alpine_aarch64, ghcr.io/nyamisty/altserver_builder_alpine_amd64, ghcr.io/nyamisty/altserver_builder_alpine_i386]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare build
run: mkdir /tmp/build_output
- name: Build
run: |
image=${{ matrix.builder }}
docker pull $image
docker run -v ${PWD}:/workdir -w /workdir $image bash -c 'mkdir build; cd build; make -f ../Makefile -j3'
mv build/AltServer-* /tmp/build_output
git clean -fdX
- name: Upload to github artifact
uses: NyaMisty/upload-artifact-as-is@master
with:
path: /tmp/build_output

release:
runs-on: ubuntu-latest
needs: [build]
name: "release"
steps:
- name: "Create artifact directory"
run: |
mkdir -p build_output
- name: "Download all artifacts"
uses: actions/download-artifact@v2
with:
path: build_output
- name: "Rearrange artifacts"
run: |
find build_output
mkdir -p build_release
mv build_output/*/* build_release
ls build_release
if [ "$(ls -A build_release)" ]; then exit 0; else exit 1; fi
- name: Release
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
files: build_release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

37 changes: 37 additions & 0 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build buildenv Docker

on:
workflow_dispatch:

env:
REGISTRY: ghcr.io

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master # set the branch to merge to
fetch-depth: 0
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
#-
# uses: docker/setup-buildx-action@v1
# id: buildx
# with:
# install: true
-
name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & Push Dockers
run: cd ./buildenv && bash ./build_docker.sh

29 changes: 29 additions & 0 deletions buildenv/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ARG IMAGE=arm64v8/alpine:3.15

FROM $IMAGE

RUN apk add zsh git curl wget g++ clang boost-static ninja boost-dev cmake make sudo bash vim libressl-dev util-linux-dev zlib-dev zlib-static

RUN mkdir /buildenv

WORKDIR /buildenv

RUN curl -JO 'https://developer.apple.com/file/?file=security&agree=Yes' -H 'Referer: https://developer.apple.com/security/' && unzip corecrypto.zip
WORKDIR /buildenv/corecrypto
RUN mkdir build; cd build; CC=clang CXX=clang++ cmake ..;
WORKDIR /buildenv/corecrypto/build
RUN sed -i -E 's|^(all: CMakeFiles\/corecrypto_perf)|#\1|' CMakeFiles/Makefile2; sed -i -E 's|^(all: CMakeFiles\/corecrypto_test)|#\1|' CMakeFiles/Makefile2
RUN make -j6; make install

WORKDIR /buildenv

RUN git clone --recursive https://github.com/microsoft/cpprestsdk;
WORKDIR /buildenv/cpprestsdk
RUN sed -i 's|-Wcast-align||' "./Release/CMakeLists.txt"
RUN mkdir build; cd build; cmake -DBUILD_SHARED_LIBS=0 ..; make -j6; make install

WORKDIR /buildenv/

RUN git clone https://github.com/nih-at/libzip && cd libzip; mkdir build; cd build; cmake -DBUILD_SHARED_LIBS=0 ..; make -j6; make install


11 changes: 11 additions & 0 deletions buildenv/build_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
docker build --build-arg IMAGE=arm32v7/alpine:3.15 -t ghcr.io/nyamisty/altserver_builder_alpine_armv7 .
docker push ghcr.io/nyamisty/altserver_builder_alpine_armv7

docker build --build-arg IMAGE=arm64v8/alpine:3.15 -t ghcr.io/nyamisty/altserver_builder_alpine_aarch64 .
docker push ghcr.io/nyamisty/altserver_builder_alpine_aarch64

docker build --build-arg IMAGE=amd64/alpine:3.15 -t ghcr.io/nyamisty/altserver_builder_alpine_amd64 .
docker push ghcr.io/nyamisty/altserver_builder_alpine_amd64

docker build --build-arg IMAGE=i386/alpine:3.15 -t ghcr.io/nyamisty/altserver_builder_alpine_i386 .
docker push ghcr.io/nyamisty/altserver_builder_alpine_i386

0 comments on commit 3a51778

Please sign in to comment.