diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..123014908 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/tas-check/1-get-build-url.sh b/.github/tas-check/1-get-build-url.sh new file mode 100755 index 000000000..dd1fc8c65 --- /dev/null +++ b/.github/tas-check/1-get-build-url.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Waits for Azure to be finished building, and writes the download link to /tmp/everest-pr-tas-check/download-link.txt. +# Parameter: commit SHA + +set -xeo pipefail + +get_build_id() { + curl 'https://dev.azure.com/EverestAPI/Everest/_apis/build/builds?definitions=3&statusFilter=completed' \ + | jq -r ".value | map(select(.sourceVersion == \"${1}\")) | .[].id" +} + +BUILD_ID=`get_build_id "$1"` +while [ "${BUILD_ID}" == "" ]; do + sleep 60 + BUILD_ID=`get_build_id "$1"` +done + +mkdir -p /tmp/everest-pr-tas-check +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 \ No newline at end of file diff --git a/.github/tas-check/2-1-install.sh b/.github/tas-check/2-1-install.sh new file mode 100755 index 000000000..0f5300679 --- /dev/null +++ b/.github/tas-check/2-1-install.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Installs Everest from the branch to test, CelesteTAS and the mod that is going to be TASed. +# Parameters: ID of the mod to be TASed, URL of the TAS files + +set -xeo pipefail + +docker build \ + --build-arg "MAIN_BUILD_URL=`cat /tmp/everest-pr-tas-check/download-link.txt`" \ + --build-arg "TAS_FILES_URL=$2" \ + --build-arg "TAS_TO_RUN=$1" \ + -t celeste . diff --git a/.github/tas-check/2-2-install-inner.sh b/.github/tas-check/2-2-install-inner.sh new file mode 100755 index 000000000..77c26f57b --- /dev/null +++ b/.github/tas-check/2-2-install-inner.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Installs Everest from the branch to test, CelesteTAS and the mod that is going to be TASed. +# Run from within the Docker image, where Celeste is installed at /home/ubuntu/celeste. + +set -xeo pipefail + +# download Everest +cd /home/ubuntu +curl --fail -Lo everest.zip "${MAIN_BUILD_URL}" +unzip everest.zip +rm -v everest.zip + +# copy Everest files to Celeste install +mv -fv main/* celeste/ +rm -rfv main + +# install Everest in headless mode +cd celeste +chmod -v u+x MiniInstaller-linux +./MiniInstaller-linux headless + +# download TAS files +cd .. +curl --fail -Lo t.zip "${TAS_FILES_URL}" +unzip t.zip +rm -v t.zip + +# install CelesteTAS +cd celeste/Mods +curl --fail -Lo CelesteTAS.zip "https://github.com/EverestAPI/CelesteTAS-EverestInterop/releases/download/v3.45.1/CelesteTAS.zip" + +# install the mod that is going to be TASed, downloaded as a bundle zip containing the mod zip +# and all of its dependencies (https://maddie480.ovh/celeste/bundle-download?id=${TAS_TO_RUN}) +# for simplicity's sake, Celeste-Bundle.zip exists but is an empty zip +curl --fail -Lo t.zip "https://celestemodupdater.0x0a.de/pinned-mods/${TAS_TO_RUN}-Bundle.zip" +unzip t.zip +rm -v t.zip \ No newline at end of file diff --git a/.github/tas-check/3-run.sh b/.github/tas-check/3-run.sh new file mode 100755 index 000000000..4439bede2 --- /dev/null +++ b/.github/tas-check/3-run.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Runs the requested TAS and checks the result. +# Parameter: path of the TAS to run + +set -xeo pipefail + +docker run \ + --volume "/tmp/everest-pr-tas-check:/home/ubuntu/tas" \ + --rm \ + --name celeste celeste \ + --sync-check-file "/home/ubuntu/$1" \ + --sync-check-result /home/ubuntu/tas/result.json + +[ "`jq -r '.entries[].status' /tmp/everest-pr-tas-check/result.json`" == "success" ] \ No newline at end of file diff --git a/.github/tas-check/Dockerfile b/.github/tas-check/Dockerfile new file mode 100644 index 000000000..6caf983e9 --- /dev/null +++ b/.github/tas-check/Dockerfile @@ -0,0 +1,5 @@ +FROM max480/everest:vanilla + +ARG MAIN_BUILD_URL TAS_FILES_URL TAS_TO_RUN +COPY 2-2-install-inner.sh /tmp +RUN /tmp/2-2-install-inner.sh && rm /tmp/2-2-install-inner.sh \ No newline at end of file diff --git a/.github/tas-check/run-locally.sh b/.github/tas-check/run-locally.sh new file mode 100755 index 000000000..a21cf42d2 --- /dev/null +++ b/.github/tas-check/run-locally.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Builds and runs the TAS locally, calling the same scripts as the pipeline in order to test them. +# Requires Docker and jq. + +if [ "$1" == "" ] || [ "$2" == "" ]; then + echo "Usage: ./run-locally.sh [Celeste|StrawberryJam2021] [commit SHA]" + exit 1 +fi + +set -xeo pipefail + +case "$1" in + "Celeste") + TAS_URL="https://github.com/VampireFlower/CelesteTAS/archive/60b1680e61e43ec4681d7c9053d249491e0fe905.zip" + TAS_PATH="CelesteTAS-60b1680e61e43ec4681d7c9053d249491e0fe905/0 - 100%.tas" + ;; + + "StrawberryJam2021") + TAS_URL="https://github.com/VampireFlower/StrawberryJamTAS/archive/fc7397c26f4d15468d4a8a3e58e7cc3d62d21223.zip" + TAS_PATH="StrawberryJamTAS-fc7397c26f4d15468d4a8a3e58e7cc3d62d21223/0-SJ All Levels.tas" + ;; + + *) + echo "Unknown TAS: $1" + exit 1 +esac + +cd "`dirname "$0"`" +./1-get-build-url.sh "$2" +./2-1-install.sh "$1" "${TAS_URL}" +./3-run.sh "${TAS_PATH}" diff --git a/.github/workflows/tas-sync-check.yml b/.github/workflows/tas-sync-check.yml new file mode 100644 index 000000000..76f5cb4d4 --- /dev/null +++ b/.github/workflows/tas-sync-check.yml @@ -0,0 +1,39 @@ +name: TAS Sync Check + +on: + pull_request: + branches: [dev] + +jobs: + check: + strategy: + matrix: + tas: + - name: Celeste 100% + mod: Celeste + url: "https://github.com/VampireFlower/CelesteTAS/archive/60b1680e61e43ec4681d7c9053d249491e0fe905.zip" + path: "CelesteTAS-60b1680e61e43ec4681d7c9053d249491e0fe905/0 - 100%.tas" + + - name: Strawberry Jam All Levels + mod: StrawberryJam2021 + url: "https://github.com/VampireFlower/StrawberryJamTAS/archive/fc7397c26f4d15468d4a8a3e58e7cc3d62d21223.zip" + path: "StrawberryJamTAS-fc7397c26f4d15468d4a8a3e58e7cc3d62d21223/0-SJ All Levels.tas" + + runs-on: ubuntu-latest + timeout-minutes: 60 + name: ${{ matrix.tas.name }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Wait for Azure build on commit ${{ github.sha }} + run: cd .github/tas-check && ./1-get-build-url.sh "${{ github.sha }}" + + - name: Install Everest and ${{ matrix.tas.mod }} + run: cd .github/tas-check && ./2-1-install.sh "${{ matrix.tas.mod }}" "${{ matrix.tas.url }}" + + - name: Run TAS at ${{ matrix.tas.path }} + run: cd .github/tas-check && ./3-run.sh "${{ matrix.tas.path }}"