Switch from Travis CI to GitHub Actions

This commit is contained in:
Rangi 2021-06-19 21:52:15 -04:00
parent f59f1bdb88
commit 72f3234e03
6 changed files with 82 additions and 65 deletions

13
.github/webhook.sh vendored Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
set -e
# Report unnamed symbols
content="$(tools/unnamed.py -r . pokecrystal.sym | grep -v -e '^lib/mobile/' -e '^mobile/' | head)"
curl -H 'Content-Type: application/json' -X POST "$DISCORD_WEBHOOK_URL" -d@- << EOF
{
"username": "OK",
"avatar_url": "https://i.imgur.com/38BQHdd.png",
"content": "\`\`\`$(echo "$content" | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')\`\`\`"
}
EOF

66
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,66 @@
name: CI
on:
push:
branches: [ master ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Checkout rgbds
uses: actions/checkout@master
with:
path: rgbds
ref: v0.5.1
repository: gbdev/rgbds
- name: Install rgbds
working-directory: rgbds
run: |
sudo make install
- name: Remove rgbds
run: |
rm -rf rgbds
- name: Compare
run: |
make DEBUG=1 -j$(nproc) compare
if ! git diff-index --quiet HEAD --; then
echo 'Uncommitted changes detected:'
git diff-index HEAD --
return 1
fi
- name: Discord webhook
if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }}
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
.github/webhook.sh
- name: Checkout symbols
if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }}
uses: actions/checkout@master
with:
path: symbols
ref: symbols
- name: Move symbols
if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }}
run: |
cp -v *.sym symbols/
- name: Update symbols
if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }}
uses: EndBug/add-and-commit@v7
with:
branch: symbols
cwd: "./symbols"
add: "*.sym"
message: ${{ github.event.commits[0].message }}

View File

@ -1,35 +0,0 @@
language: c
os:
- linux
- osx
install:
- |-
( cd
if [ "$TRAVIS_OS_NAME" = osx ]; then
HOMEBREW_NO_AUTO_UPDATE=1 brew install bison
export PATH="/usr/local/opt/bison/bin:$PATH"
fi
git clone -b v0.5.1 --depth=1 https://github.com/gbdev/rgbds
sudo make -C rgbds install
rm -rf rgbds
)
before_script:
- |-
function check_status() {
if ! git diff-index --quiet --ignore-submodules=all HEAD --; then
echo 'Uncommitted changes detected:';
git diff-index HEAD --;
return 1;
fi;
}
script:
- make DEBUG=1 -j2 compare
- check_status
after_success:
- |-
if [ "$TRAVIS_BRANCH" = master -a "$TRAVIS_PULL_REQUEST" = false -a "$TRAVIS_OS_NAME" = linux ]; then
./.travis/webhook.sh
if [ -n "$GITHUB_API_KEY" ]; then
./.travis/upload_symbols.sh
fi
fi

View File

@ -1,12 +0,0 @@
#!/bin/sh
set -e
commit_message=$(git log -1 --pretty=%B)
git clone -b symbols https://github.com/pret/pokecrystal symbols
cd symbols
cp ../*.sym .
git add *.sym
git -c user.name='travis' -c user.email='travis@travis-ci.org' commit -m "$commit_message"
git push -f -q https://pokepret:$GITHUB_API_KEY@github.com/pret/pokecrystal symbols &>/dev/null

View File

@ -1,15 +0,0 @@
#!/bin/sh
set -e
root="$(readlink -e "$(dirname "$0")/..")"
# Report unnamed symbols
content="$("$root/tools/unnamed.py" -r "$root" "$root/pokecrystal.sym" | grep -v -e '^lib/mobile/' -e '^mobile/' | head)"
curl -H 'Content-Type: application/json' -X POST "$POKECRYSTAL_DISCORD_WEBHOOK_URL" -d@- << EOF
{
"username": "$POKECRYSTAL_DISCORD_WEBHOOK_USERNAME",
"avatar_url": "$POKECRYSTAL_DISCORD_WEBHOOK_AVATAR_URL",
"content": "\`\`\`$(echo "$content" | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')\`\`\`"
}
EOF

View File

@ -1,4 +1,4 @@
# Pokémon Crystal [![Build Status][travis-badge]][travis] # Pokémon Crystal [![Build Status][ci-badge]][ci]
This is a disassembly of Pokémon Crystal. This is a disassembly of Pokémon Crystal.
@ -45,5 +45,5 @@ Other disassembly projects:
[tutorials]: https://github.com/pret/pokecrystal/wiki/Tutorials [tutorials]: https://github.com/pret/pokecrystal/wiki/Tutorials
[discord]: https://discord.gg/d5dubZ3 [discord]: https://discord.gg/d5dubZ3
[irc]: https://kiwiirc.com/client/irc.freenode.net/?#pret [irc]: https://kiwiirc.com/client/irc.freenode.net/?#pret
[travis]: https://travis-ci.org/pret/pokecrystal [ci]: https://github.com/pret/pokecrystal/actions
[travis-badge]: https://travis-ci.org/pret/pokecrystal.svg?branch=master [ci-badge]: https://github.com/pret/pokecrystal/actions/workflows/main.yml/badge.svg