Try to make the image cache work #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'build' | |
on: # rebuild any PRs and main branch changes | |
pull_request: | |
push: | |
branches: | |
- main | |
- benchmarking | |
jobs: | |
build-devcontainer: | |
runs-on: ubuntu-latest | |
outputs: | |
imageName: ${{ steps.imageName.outputs.imageName }} | |
steps: | |
- name: Checkout (GitHub) | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: set lower case owner name | |
id: imageName | |
run: | | |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} | |
echo "imageName=ghcr.io/${OWNER,,}/r-compile-server" >>${GITHUB_OUTPUT} | |
env: | |
OWNER: '${{ github.repository_owner }}' | |
- name: Pre-build dev container image | |
uses: devcontainers/[email protected] | |
with: | |
imageName: ghcr.io/${{ env.OWNER_LC }}/r-compile-server | |
cacheFrom: ghcr.io/${{ env.OWNER_LC }}/r-compile-server | |
push: always | |
test: | |
runs-on: ubuntu-latest | |
needs: build-devcontainer | |
steps: | |
- name: Checkout (GitHub) | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# See https://github.com/devcontainers/ci/blob/main/docs/github-action.md | |
- name: Run tests in the dev container task | |
uses: devcontainers/[email protected] | |
with: | |
imageName: ${{ needs.build-devcontainer.outputs.imageName }} | |
cacheFrom: ${{ needs.build-devcontainer.outputs.imageName }} | |
# Change this to be your CI task/script | |
runCmd: cd server; mvn --batch-mode --update-snapshots test | |
verify: | |
runs-on: ubuntu-latest | |
needs: build-devcontainer | |
steps: | |
- name: Checkout (GitHub) | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run linters in the container task | |
uses: devcontainers/[email protected] | |
with: | |
imageName: ${{ needs.build-devcontainer.outputs.imageName }} | |
cacheFrom: ${{ needs.build-devcontainer.outputs.imageName }} | |
runCmd: cd server; mvn --batch-mode --update-snapshots verify |