Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github/workflows: Enable Docker layer caching between builds #5070

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# Ignore the Docker files themselves to avoid that all layers are invalidated if
# the Docker files are changed during development.
# Ignore Docker-related files to avoid the cache being invalidated if the files are changed during development.
.batect/
.dockerignore
Dockerfile*
scripts/docker_*.sh

# Ignore the Jenkinsfile to avoid that all layers are invalidated if the
# Jenkinsfile is changed during development.
# Ignore GitHub configuration to avoid the cache being invalidated if the files are changed during development.
.github/

# Ignore the Jenkinsfile to avoid the cache being invalidated if the file is changed during development.
integrations/jenkins/Jenkinsfile

# Ignore miscellaneous top-level configuration files that do not have an impact on ORT's build.
.codecov.yml
.commitlintrc.yml
.editorconfig
.jitpack.yml
.lift.toml
.mailmap
.ort.yml
mlc_config.json
qodana.yml
renovate.json

# Ignore Git entries.
.git/
.gitignore
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ jobs:
flags: funTest-non-docker
funTest-docker:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
Expand All @@ -148,6 +151,33 @@ jobs:
java-version: 17
- name: Restore Gradle cache entries
uses: gradle/gradle-build-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push the Docker image
uses: docker/build-push-action@v4
with:
build-args: USER_ID=1001
context: .
cache-from: type=registry,ref=ort:buildcache
cache-to: type=registry,ref=ort:buildcache,mode=max
push: true
tags: ort:pr
- name: Build and load the Docker image
uses: docker/build-push-action@v4
with:
build-args: USER_ID=1001
context: .
cache-from: type=registry,ref=ort:buildcache
cache-to: type=registry,ref=ort:buildcache,mode=max
load: true
- name: Build Docker image manually
run: DOCKER_BUILDKIT=1 docker build --build-arg USER_ID=1001 .
- name: Validate Batect wrapper scripts
uses: batect/batect-wrapper-validation-action@v0
- name: Run functional tests that do require external tools
Expand Down