Copy real test inputs into nested CI containers
pr / test (pull_request) Successful in 57s

This commit is contained in:
2026-09-19 16:20:59 +02:00
parent 904f3fffe6
commit c0843af83e
3 changed files with 12 additions and 10 deletions
+2 -7
View File
@@ -16,13 +16,8 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Test - name: Unit and PostgreSQL fencing tests
run: | run: bash scripts/test-fencing.sh
docker run --rm \
-v "$PWD:/app" \
-w /app \
clojure:temurin-21-tools-deps-alpine \
clj -M:test
- name: Generate immutable tags - name: Generate immutable tags
id: tags id: tags
+2
View File
@@ -7,6 +7,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
persist-credentials: false
- name: Unit and PostgreSQL fencing tests - name: Unit and PostgreSQL fencing tests
run: bash scripts/test-fencing.sh run: bash scripts/test-fencing.sh
# No registry, deployment, or production credentials in PR jobs. # No registry, deployment, or production credentials in PR jobs.
+8 -3
View File
@@ -3,7 +3,7 @@
set -euo pipefail set -euo pipefail
name="btcdata-test-${GITHUB_RUN_ID:-$$}-${GITHUB_RUN_ATTEMPT:-1}" name="btcdata-test-${GITHUB_RUN_ID:-$$}-${GITHUB_RUN_ATTEMPT:-1}"
cleanup() { cleanup() {
docker rm -f "$name" >/dev/null 2>&1 || true docker rm -f "${name}-runner" "$name" >/dev/null 2>&1 || true
docker network rm "$name" >/dev/null 2>&1 || true docker network rm "$name" >/dev/null 2>&1 || true
} }
trap cleanup EXIT trap cleanup EXIT
@@ -22,6 +22,11 @@ if [ "$ready" != true ]; then
echo 'Disposable PostgreSQL did not become ready' >&2 echo 'Disposable PostgreSQL did not become ready' >&2
exit 1 exit 1
fi fi
docker run --rm --network "$name" -v "$PWD:/app" -w /app \ # The CI workspace is inside the runner container, not on the Docker host.
# Copy only test inputs; never mount a nonexistent host workspace or copy .env/.git.
docker create --name "${name}-runner" --network "$name" -w /app \
-e "BTCDATA_TEST_JDBC_URL=jdbc:postgresql://$name:5432/postgres?user=postgres" \ -e "BTCDATA_TEST_JDBC_URL=jdbc:postgresql://$name:5432/postgres?user=postgres" \
clojure:temurin-21-tools-deps-alpine clj -M:test clojure:temurin-21-tools-deps-alpine clj -M:test >/dev/null
COPYFILE_DISABLE=1 tar --no-xattrs -cf - deps.edn src resources test env/test | docker cp - "${name}-runner:/app"
docker start --attach "${name}-runner"
exit "$(docker inspect --format '{{.State.ExitCode}}' "${name}-runner")"