#1082 Add cache check for external repositories used during testing (#1100)

Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>
Co-authored-by: Eldred Habert <eldredhabert0@gmail.com>
This commit is contained in:
Robert Lewicki
2022-10-25 08:39:19 +02:00
committed by GitHub
parent 48248faab0
commit 1a9fc964df
3 changed files with 66 additions and 12 deletions

View File

@@ -55,6 +55,17 @@ jobs:
with: with:
name: rgbds-canary-${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.buildsys }} name: rgbds-canary-${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.buildsys }}
path: bins 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 - name: Test
shell: bash shell: bash
run: | run: |
@@ -116,6 +127,18 @@ jobs:
with: with:
name: rgbds-canary-win${{ matrix.bits }} name: rgbds-canary-win${{ matrix.bits }}
path: bins 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 - name: Test
shell: bash shell: bash
run: | run: |
@@ -198,6 +221,18 @@ jobs:
run: | run: |
cp bins/* . cp bins/* .
cp bins/*.dll test/gfx 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 - name: Run tests
shell: bash shell: bash
run: | run: |

23
test/fetch-test-deps.sh Executable file
View File

@@ -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

View File

@@ -25,20 +25,16 @@ done
# When updating subprojects, change the commit being checked out, and set the `shallow-since` # 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. # 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 test_downstream() { # owner/repo make-target
if [ ! -d ${1##*/} ]; then if ! pushd ${1##*/}; then
git clone https://github.com/$1.git --shallow-since=$2 --single-branch echo >&2 'Please run `fetch-test-deps.sh` before running the test suite'
fi return 1
pushd ${1##*/}
git checkout -f $3
if [ -f ../patches/${1##*/}.patch ]; then
git apply --ignore-whitespace ../patches/${1##*/}.patch
fi fi
make clean make clean
make -j4 $4 RGBDS=../../ make -j4 $2 RGBDS=../../
popd popd
} }
test_downstream pret/pokecrystal 2022-09-29 70a3ec1accb6de1c1c273470af0ddfa2edc1b0a9 compare test_downstream pret/pokecrystal compare
test_downstream pret/pokered 2022-09-29 2b52ceb718b55dce038db24d177715ae4281d065 compare test_downstream pret/pokered compare
test_downstream AntonioND/ucity 2022-04-20 d8878233da7a6569f09f87b144cb5bf140146a0f '' test_downstream AntonioND/ucity ''