Try parallelizing R version builds
This commit is contained in:
parent
a1f46060fa
commit
225b7da1f7
1 changed files with 47 additions and 20 deletions
67
.github/workflows/test.yml
vendored
67
.github/workflows/test.yml
vendored
|
|
@ -43,15 +43,13 @@ jobs:
|
||||||
r_versions=$(python test/get_r_versions.py ${{ github.event.inputs.r_versions }})
|
r_versions=$(python test/get_r_versions.py ${{ github.event.inputs.r_versions }})
|
||||||
echo "::set-output name=r_versions::$r_versions"
|
echo "::set-output name=r_versions::$r_versions"
|
||||||
|
|
||||||
test:
|
docker-images:
|
||||||
needs: setup-matrix
|
needs: setup-matrix
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform: ${{ fromJson(needs.setup-matrix.outputs.platforms) }}
|
platform: ${{ fromJson(needs.setup-matrix.outputs.platforms) }}
|
||||||
env:
|
|
||||||
R_VERSIONS: ${{ join(fromJson(needs.setup-matrix.outputs.r_versions), ' ') }}
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: ${{ matrix.platform }} (R ${{ join(fromJson(needs.setup-matrix.outputs.r_versions), ', ') }})
|
name: Docker image (${{ matrix.platform }})
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
|
@ -75,23 +73,13 @@ jobs:
|
||||||
# Use docker buildx instead of docker-compose here because cache exporting
|
# Use docker buildx instead of docker-compose here because cache exporting
|
||||||
# does not seem to work as of docker-compose v2.6.0 and buildx v0.8.2, even
|
# does not seem to work as of docker-compose v2.6.0 and buildx v0.8.2, even
|
||||||
# though it works with buildx individually.
|
# though it works with buildx individually.
|
||||||
- name: Build R
|
- name: Build image
|
||||||
run: |
|
run: |
|
||||||
for version in ${{ env.R_VERSIONS }}; do
|
docker buildx build -t r-builds:${{ matrix.platform }} \
|
||||||
docker buildx build -t r-builds:${{ matrix.platform }} \
|
--file builder/Dockerfile.${{ matrix.platform }} \
|
||||||
--file builder/Dockerfile.${{ matrix.platform }} \
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
--cache-to "type=local,dest=/tmp/.buildx-cache-new,mode=max" \
|
||||||
--cache-to "type=local,dest=/tmp/.buildx-cache-new,mode=max" \
|
builder
|
||||||
--load \
|
|
||||||
builder
|
|
||||||
R_VERSION=$version make build-r-${{ matrix.platform }}
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Test R
|
|
||||||
run: |
|
|
||||||
for version in ${{ env.R_VERSIONS }}; do
|
|
||||||
R_VERSION=$version make test-r-${{ matrix.platform }}
|
|
||||||
done
|
|
||||||
|
|
||||||
# Temporary workaround for unbounded GHA cache growth with the local cache mode.
|
# Temporary workaround for unbounded GHA cache growth with the local cache mode.
|
||||||
# https://github.com/docker/build-push-action/issues/252
|
# https://github.com/docker/build-push-action/issues/252
|
||||||
|
|
@ -100,3 +88,42 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/.buildx-cache
|
rm -rf /tmp/.buildx-cache
|
||||||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||||
|
|
||||||
|
test:
|
||||||
|
needs: [setup-matrix, docker-images]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
platform: ${{ fromJson(needs.setup-matrix.outputs.platforms) }}
|
||||||
|
r_version: ${{ fromJson(needs.setup-matrix.outputs.r_versions) }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: ${{ matrix.platform }} (R ${{ matrix.r_version }})
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
|
||||||
|
- name: Restore cached Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ matrix.platform }}-buildx-${{ github.sha }}
|
||||||
|
restore-keys: ${{ matrix.platform }}-buildx-
|
||||||
|
|
||||||
|
- name: Load cached Docker image
|
||||||
|
run: |
|
||||||
|
docker buildx build -t r-builds:${{ matrix.platform }} \
|
||||||
|
--file builder/Dockerfile.${{ matrix.platform }} \
|
||||||
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
|
--load \
|
||||||
|
builder
|
||||||
|
|
||||||
|
- name: Build R
|
||||||
|
run: |
|
||||||
|
R_VERSION=${{ matrix.r_version }} make build-r-${{ matrix.platform }}
|
||||||
|
|
||||||
|
- name: Test R
|
||||||
|
run: |
|
||||||
|
R_VERSION=${{ matrix.r_version }} make test-r-${{ matrix.platform }}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue