diff options
author | Seth Barberee <seth.barberee@gmail.com> | 2021-01-28 10:01:56 -0600 |
---|---|---|
committer | Seth Barberee <seth.barberee@gmail.com> | 2021-01-28 10:01:56 -0600 |
commit | 9bd9b71d1e87b0e52e6e04b402bcff7ed48ee386 (patch) | |
tree | 71ae6a81b345b7b6b6a426bbc51d086d781a447a /.github | |
parent | cb77386b65b0a78c16ccd2dfd3d329aaf502ac2e (diff) |
inital try at GithubCI
Diffstat (limited to '.github')
-rwxr-xr-x | .github/calcrom/webhook.sh | 16 | ||||
-rw-r--r-- | .github/workflows/build.yml | 45 |
2 files changed, 61 insertions, 0 deletions
diff --git a/.github/calcrom/webhook.sh b/.github/calcrom/webhook.sh new file mode 100755 index 0000000..86da74c --- /dev/null +++ b/.github/calcrom/webhook.sh @@ -0,0 +1,16 @@ +#!/bin/bash -ex + +# Only run this script if it's the master branch build. +if [[ "$TRAVIS_BRANCH" != "master" || "$TRAVIS_PULL_REQUEST" != "false" ]]; then + exit 0 +fi + +build_name=$1 +map_file=$build_name.map +if [ ! -f $map_file ]; then + echo "$map_file does not exist!" + exit 1 +fi + +output=$(perl $(dirname "$0")/calcrom.pl $build_name.map | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') +curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST $CALCROM_DISCORD_WEBHOOK_URL diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..745e814 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: GithubCI + +on: + push: + branches: [ master ] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install xdelta + run: | + apt-get update -y + apt-get install -y xdelta + + - name: Fetch repo + uses: actions/checkout@master + + - name: Load and setup agbcc + run: | + git clone https://github.com/luckytyphlosion/agbcc.git -b new_layout_with_libs + cd agbcc && make -j${nproc} && make install prefix=$GITHUB_WORKSPACE + + - name: Build tools and baserom + run: | + cd $GITHUB_WORKSPACE + make tools + head -c 33554432 /dev/zero > tmp.bin + xdelta3 -d -s tmp.bin baserom.xdelta baserom.gba + rm tmp.bin + + - name: Build via Makefile + run: | + make -j${nproc} compare + + # only run OK when pushed to master + - name: Run OK webhook + shell: bash + #if: ${{ github.event_name == 'push' }} + env: + CALCROM_DISCORD_WEBHOOK_USERNAME: ${{ secrets.CALCROM_DISCORD_WEBHOOK_USERNAME }} + CALCROM_DISCORD_WEBHOOK_AVATAR_URL: ${{ secrets.CALCROM_DISCORD_WEBHOOK_AVATAR_URL }} + CALCROM_DISCORD_WEBHOOK_URL: ${{ secrets.CALCROM_DISCORD_WEBHOOK_URL }} + run: sh .github/calcrom/webhook.sh pmd-red |