diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index bed596dc..a7438326 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -55,6 +55,17 @@ jobs: with: name: rgbds-canary-${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.buildsys }} path: bins + - name: Check test dependency repositories cache + id: test-deps-cache + uses: actions/cache@v3 + with: + path: test + key: ${{ hashFiles('test/fetch-test-deps.sh') }} + - if: ${{ steps.test-deps-cache.outputs.cache-hit != 'true' }} + name: Fetch test dependency repositories + continue-on-error: true + run: | + test/fetch-test-deps.sh - name: Test shell: bash run: | @@ -116,6 +127,18 @@ jobs: with: name: rgbds-canary-win${{ matrix.bits }} path: bins + - name: Check test dependency repositories cache + id: test-deps-cache + uses: actions/cache@v3 + with: + path: test + key: ${{ hashFiles('test/fetch-test-deps.sh') }} + - if: ${{ steps.test-deps-cache.outputs.cache-hit != 'true' }} + name: Fetch test dependency repositories + shell: bash + continue-on-error: true + run: | + test/fetch-test-deps.sh - name: Test shell: bash run: | @@ -198,6 +221,18 @@ jobs: run: | cp bins/* . cp bins/*.dll test/gfx + - name: Check test dependency repositories cache + id: test-deps-cache + uses: actions/cache@v3 + with: + path: test + key: ${{ hashFiles('test/fetch-test-deps.sh') }} + - if: ${{ steps.test-deps-cache.outputs.cache-hit != 'true' }} + name: Fetch test dependency repositories + shell: bash + continue-on-error: true + run: | + test/fetch-test-deps.sh - name: Run tests shell: bash run: | diff --git a/test/fetch-test-deps.sh b/test/fetch-test-deps.sh new file mode 100755 index 00000000..0025d85a --- /dev/null +++ b/test/fetch-test-deps.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")" + +echo "Fetching test dependency repositories" + +fetch_downstream() { # owner/repo shallow-since commit + if [ ! -d ${1##*/} ]; then + git clone https://github.com/$1.git --shallow-since=$2 --single-branch + fi + pushd ${1##*/} + git checkout -f $3 + if [ -f ../patches/${1##*/}.patch ]; then + git apply --ignore-whitespace ../patches/${1##*/}.patch + fi + popd +} + +fetch_downstream pret/pokecrystal 2022-09-29 70a3ec1accb6de1c1c273470af0ddfa2edc1b0a9 +fetch_downstream pret/pokered 2022-09-29 2b52ceb718b55dce038db24d177715ae4281d065 +fetch_downstream AntonioND/ucity 2022-04-20 d8878233da7a6569f09f87b144cb5bf140146a0f diff --git a/test/run-tests.sh b/test/run-tests.sh index a969eadc..79eb3221 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -25,20 +25,16 @@ done # When updating subprojects, change the commit being checked out, and set the `shallow-since` # to the day before, to reduce the amount of refs being transferred and thus speed up CI. -test_downstream() { # owner/repo shallow-since commit make-target - if [ ! -d ${1##*/} ]; then - git clone https://github.com/$1.git --shallow-since=$2 --single-branch - fi - pushd ${1##*/} - git checkout -f $3 - if [ -f ../patches/${1##*/}.patch ]; then - git apply --ignore-whitespace ../patches/${1##*/}.patch +test_downstream() { # owner/repo make-target + if ! pushd ${1##*/}; then + echo >&2 'Please run `fetch-test-deps.sh` before running the test suite' + return 1 fi make clean - make -j4 $4 RGBDS=../../ + make -j4 $2 RGBDS=../../ popd } -test_downstream pret/pokecrystal 2022-09-29 70a3ec1accb6de1c1c273470af0ddfa2edc1b0a9 compare -test_downstream pret/pokered 2022-09-29 2b52ceb718b55dce038db24d177715ae4281d065 compare -test_downstream AntonioND/ucity 2022-04-20 d8878233da7a6569f09f87b144cb5bf140146a0f '' +test_downstream pret/pokecrystal compare +test_downstream pret/pokered compare +test_downstream AntonioND/ucity ''