Skip to content

Commit 2654371

Browse files
authored
Merge pull request #916 from maddie480/github-tas
Run Celeste TASes on pull requests [ci skip]
2 parents 2291e57 + 630554b commit 2654371

8 files changed

Lines changed: 162 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# Waits for Azure to be finished building, and writes the download link to /tmp/everest-pr-tas-check/download-link.txt.
3+
# Parameter: commit SHA
4+
5+
set -xeo pipefail
6+
7+
get_build_id() {
8+
curl 'https://dev.azure.com/EverestAPI/Everest/_apis/build/builds?definitions=3&statusFilter=completed' \
9+
| jq -r ".value | map(select(.sourceVersion == \"${1}\")) | .[].id"
10+
}
11+
12+
BUILD_ID=`get_build_id "$1"`
13+
while [ "${BUILD_ID}" == "" ]; do
14+
sleep 60
15+
BUILD_ID=`get_build_id "$1"`
16+
done
17+
18+
mkdir -p /tmp/everest-pr-tas-check
19+
echo -n "https://dev.azure.com/EverestAPI/Everest/_apis/build/builds/${BUILD_ID}/artifacts?artifactName=main&api-version=5.0&%24format=zip" > /tmp/everest-pr-tas-check/download-link.txt

.github/tas-check/2-1-install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# Installs Everest from the branch to test, CelesteTAS and the mod that is going to be TASed.
3+
# Parameters: ID of the mod to be TASed, URL of the TAS files
4+
5+
set -xeo pipefail
6+
7+
docker build \
8+
--build-arg "MAIN_BUILD_URL=`cat /tmp/everest-pr-tas-check/download-link.txt`" \
9+
--build-arg "TAS_FILES_URL=$2" \
10+
--build-arg "TAS_TO_RUN=$1" \
11+
-t celeste .
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
# Installs Everest from the branch to test, CelesteTAS and the mod that is going to be TASed.
3+
# Run from within the Docker image, where Celeste is installed at /home/ubuntu/celeste.
4+
5+
set -xeo pipefail
6+
7+
# download Everest
8+
cd /home/ubuntu
9+
curl --fail -Lo everest.zip "${MAIN_BUILD_URL}"
10+
unzip everest.zip
11+
rm -v everest.zip
12+
13+
# copy Everest files to Celeste install
14+
mv -fv main/* celeste/
15+
rm -rfv main
16+
17+
# install Everest in headless mode
18+
cd celeste
19+
chmod -v u+x MiniInstaller-linux
20+
./MiniInstaller-linux headless
21+
22+
# download TAS files
23+
cd ..
24+
curl --fail -Lo t.zip "${TAS_FILES_URL}"
25+
unzip t.zip
26+
rm -v t.zip
27+
28+
# install CelesteTAS
29+
cd celeste/Mods
30+
curl --fail -Lo CelesteTAS.zip "https://github.com/EverestAPI/CelesteTAS-EverestInterop/releases/download/v3.45.1/CelesteTAS.zip"
31+
32+
# install the mod that is going to be TASed, downloaded as a bundle zip containing the mod zip
33+
# and all of its dependencies (https://maddie480.ovh/celeste/bundle-download?id=${TAS_TO_RUN})
34+
# for simplicity's sake, Celeste-Bundle.zip exists but is an empty zip
35+
curl --fail -Lo t.zip "https://celestemodupdater.0x0a.de/pinned-mods/${TAS_TO_RUN}-Bundle.zip"
36+
unzip t.zip
37+
rm -v t.zip

.github/tas-check/3-run.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# Runs the requested TAS and checks the result.
3+
# Parameter: path of the TAS to run
4+
5+
set -xeo pipefail
6+
7+
docker run \
8+
--volume "/tmp/everest-pr-tas-check:/home/ubuntu/tas" \
9+
--rm \
10+
--name celeste celeste \
11+
--sync-check-file "/home/ubuntu/$1" \
12+
--sync-check-result /home/ubuntu/tas/result.json
13+
14+
[ "`jq -r '.entries[].status' /tmp/everest-pr-tas-check/result.json`" == "success" ]

.github/tas-check/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM max480/everest:vanilla
2+
3+
ARG MAIN_BUILD_URL TAS_FILES_URL TAS_TO_RUN
4+
COPY 2-2-install-inner.sh /tmp
5+
RUN /tmp/2-2-install-inner.sh && rm /tmp/2-2-install-inner.sh

.github/tas-check/run-locally.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# Builds and runs the TAS locally, calling the same scripts as the pipeline in order to test them.
3+
# Requires Docker and jq.
4+
5+
if [ "$1" == "" ] || [ "$2" == "" ]; then
6+
echo "Usage: ./run-locally.sh [Celeste|StrawberryJam2021] [commit SHA]"
7+
exit 1
8+
fi
9+
10+
set -xeo pipefail
11+
12+
case "$1" in
13+
"Celeste")
14+
TAS_URL="https://github.com/VampireFlower/CelesteTAS/archive/60b1680e61e43ec4681d7c9053d249491e0fe905.zip"
15+
TAS_PATH="CelesteTAS-60b1680e61e43ec4681d7c9053d249491e0fe905/0 - 100%.tas"
16+
;;
17+
18+
"StrawberryJam2021")
19+
TAS_URL="https://github.com/VampireFlower/StrawberryJamTAS/archive/fc7397c26f4d15468d4a8a3e58e7cc3d62d21223.zip"
20+
TAS_PATH="StrawberryJamTAS-fc7397c26f4d15468d4a8a3e58e7cc3d62d21223/0-SJ All Levels.tas"
21+
;;
22+
23+
*)
24+
echo "Unknown TAS: $1"
25+
exit 1
26+
esac
27+
28+
cd "`dirname "$0"`"
29+
./1-get-build-url.sh "$2"
30+
./2-1-install.sh "$1" "${TAS_URL}"
31+
./3-run.sh "${TAS_PATH}"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: TAS Sync Check
2+
3+
on:
4+
pull_request:
5+
branches: [dev]
6+
7+
jobs:
8+
check:
9+
strategy:
10+
matrix:
11+
tas:
12+
- name: Celeste 100%
13+
mod: Celeste
14+
url: "https://github.com/VampireFlower/CelesteTAS/archive/60b1680e61e43ec4681d7c9053d249491e0fe905.zip"
15+
path: "CelesteTAS-60b1680e61e43ec4681d7c9053d249491e0fe905/0 - 100%.tas"
16+
17+
- name: Strawberry Jam All Levels
18+
mod: StrawberryJam2021
19+
url: "https://github.com/VampireFlower/StrawberryJamTAS/archive/fc7397c26f4d15468d4a8a3e58e7cc3d62d21223.zip"
20+
path: "StrawberryJamTAS-fc7397c26f4d15468d4a8a3e58e7cc3d62d21223/0-SJ All Levels.tas"
21+
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 60
24+
name: ${{ matrix.tas.name }}
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Wait for Azure build on commit ${{ github.sha }}
33+
run: cd .github/tas-check && ./1-get-build-url.sh "${{ github.sha }}"
34+
35+
- name: Install Everest and ${{ matrix.tas.mod }}
36+
run: cd .github/tas-check && ./2-1-install.sh "${{ matrix.tas.mod }}" "${{ matrix.tas.url }}"
37+
38+
- name: Run TAS at ${{ matrix.tas.path }}
39+
run: cd .github/tas-check && ./3-run.sh "${{ matrix.tas.path }}"

0 commit comments

Comments
 (0)