Skip to content

Commit f9939da

Browse files
authored
ci: use docker container instead of remote server (#7)
1 parent c1dc656 commit f9939da

2 files changed

Lines changed: 53 additions & 5 deletions

File tree

.github/workflows/check-standard.yaml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
env:
2929
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3030
R_KEEP_PKG_SOURCE: yes
31-
VALHALLA_URL: ${{ secrets.VALHALLA_URL }}
3231

3332
steps:
3433
- uses: actions/checkout@v4
@@ -41,9 +40,31 @@ jobs:
4140
http-user-agent: ${{ matrix.config.http-user-agent }}
4241
use-public-rspm: true
4342

43+
- name: Start Valhalla (Docker, Berlin)
44+
if: runner.os == 'Linux'
45+
run: |
46+
set -eux
47+
DATA_DIR="${RUNNER_TEMP}/valhalla"
48+
mkdir -p "${DATA_DIR}"
49+
50+
docker run -dt --name valhalla -p 8002:8002 \
51+
-v "${DATA_DIR}:/custom_files" \
52+
-e tile_urls=https://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf \
53+
ghcr.io/valhalla/valhalla-scripted:latest
54+
55+
for i in {1..60}; do
56+
if curl -sf http://localhost:8002/status; then
57+
echo "Valhalla ready"; break
58+
fi
59+
sleep 2
60+
done
61+
shell: bash
62+
4463
- name: Create and populate .Renviron file
4564
run: |
46-
echo VALHALLA_CI="$VALHALLA_URL" >> ~/.Renviron
65+
if [ "${RUNNER_OS}" = "Linux" ]; then
66+
echo 'VALHALLA_CI="http://localhost:8002"' >> ~/.Renviron
67+
fi
4768
shell: bash
4869

4970
- uses: r-lib/actions/setup-r-dependencies@v2
@@ -55,3 +76,8 @@ jobs:
5576
with:
5677
upload-snapshots: true
5778
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
79+
80+
- name: Stop Valhalla
81+
if: runner.os == 'Linux'
82+
run: |
83+
docker rm -f valhalla || true

.github/workflows/test-coverage.yaml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ name: test-coverage
1010

1111
permissions: read-all
1212

13-
1413
jobs:
1514
test-coverage:
1615
runs-on: ubuntu-latest
1716
env:
1817
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
19-
VALHALLA_URL: ${{ secrets.VALHALLA_URL }}
2018

2119
steps:
2220
- uses: actions/checkout@v4
@@ -25,9 +23,28 @@ jobs:
2523
with:
2624
use-public-rspm: true
2725

26+
- name: Start Valhalla (Docker, Berlin)
27+
run: |
28+
set -eux
29+
DATA_DIR="${RUNNER_TEMP}/valhalla"
30+
mkdir -p "${DATA_DIR}"
31+
32+
docker run -dt --name valhalla -p 8002:8002 \
33+
-v "${DATA_DIR}:/custom_files" \
34+
-e tile_urls=https://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf \
35+
ghcr.io/valhalla/valhalla-scripted:latest
36+
37+
for i in {1..60}; do
38+
if curl -sf http://localhost:8002/status; then
39+
echo "Valhalla ready"; break
40+
fi
41+
sleep 2
42+
done
43+
shell: bash
44+
2845
- name: Create and populate .Renviron file
2946
run: |
30-
echo VALHALLA_CI="$VALHALLA_URL" >> ~/.Renviron
47+
echo 'VALHALLA_CI="http://localhost:8002"' >> ~/.Renviron
3148
shell: bash
3249

3350
- uses: r-lib/actions/setup-r-dependencies@v2
@@ -61,3 +78,8 @@ jobs:
6178
with:
6279
name: coverage-test-failures
6380
path: ${{ runner.temp }}/package
81+
82+
- name: Stop Valhalla
83+
if: runner.os == 'Linux'
84+
run: |
85+
docker rm -f valhalla || true

0 commit comments

Comments
 (0)