ref: 1a9fc964dfa3f157f35ea0c7e1952d51ec982887
parent: 48248faab01c207613e668f899a942ac182070bc
author: Robert Lewicki <[email protected]>
date: Tue Oct 25 04:39:19 EDT 2022
#1082 Add cache check for external repositories used during testing (#1100) Co-authored-by: Rangi <[email protected]> Co-authored-by: Eldred Habert <[email protected]>
--- a/.github/workflows/testing.yml
+++ b/.github/workflows/testing.yml
@@ -55,6 +55,17 @@
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 @@
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 @@
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: |
--- /dev/null
+++ b/test/fetch-test-deps.sh
@@ -1,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
--- a/test/run-tests.sh
+++ b/test/run-tests.sh
@@ -25,20 +25,16 @@
# 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
+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
- pushd ${1##*/}
- git checkout -f $3
- if [ -f ../patches/${1##*/}.patch ]; then
- git apply --ignore-whitespace ../patches/${1##*/}.patch
- 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 ''