-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from CExA-project/feature/improve-ci
Improve CI
- Loading branch information
Showing
8 changed files
with
122 additions
and
63 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Check if Docker images have changed. In that case, proposes images suffix and | ||
# tag. | ||
|
||
name: Check Docker files | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
event_name: | ||
description: "Event name of the calling workflow" | ||
required: true | ||
type: string | ||
|
||
outputs: | ||
docker_files_have_changed: | ||
description: "True if any Docker file was modified" | ||
value: ${{ jobs.check_docker_files.outputs.docker_files_have_changed }} | ||
image_suffix: | ||
description: "Suffix of the images" | ||
value: ${{ jobs.check_docker_files.outputs.image_suffix }} | ||
image_tag: | ||
description: "Tag of the images" | ||
value: ${{ jobs.check_docker_files.outputs.image_tag }} | ||
|
||
jobs: | ||
check_docker_files: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
# true if any Docker file was modified in the PR (PR mode) or since last pushed commit (push mode) | ||
docker_files_have_changed: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' }} | ||
# use "pr" as image name suffix if on PR mode and if any Docker file was modified, otherwise use "main"; | ||
# this is intended to avoid a PR to alter Docker images for other PRs or for the main branch | ||
image_suffix: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && inputs.event_name == 'pull_request' && 'pr' || 'main' }} | ||
# use "<hash>" as image name tag if on PR mode and if any Docker file was modified, otherwise use "latest"; | ||
# this is intended to distinguish PR images from each other | ||
image_tag: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' && inputs.event_name == 'pull_request' && github.sha || 'latest' }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get changed Docker files | ||
id: get_changed_docker_files | ||
uses: tj-actions/changed-files@v42 | ||
with: | ||
files: docker/**/Dockerfile | ||
|
||
- name: List changed Docker files | ||
if: ${{ steps.get_changed_docker_files.outputs.any_changed == 'true' }} | ||
env: | ||
ALL_CHANGED_FILES: ${{ steps.get_changed_docker_files.outputs.all_changed_files }} | ||
run: | | ||
for file in $ALL_CHANGED_FILES; do | ||
echo "$file was changed" | ||
done |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
# Recreate the base images inconditionnaly on a regural basis. This is to | ||
# ensure that anybody using the Docker files for local development does not | ||
# encounter weird bugs unnoticed by the CI, because the images would be too | ||
# old. | ||
# Recreate the base images inconditionnaly on a regural basis and on push on | ||
# the main branch. This is to ensure that anybody using the Docker files for | ||
# local development does not encounter weird bugs unnoticed by the CI, because | ||
# the images would be too old. | ||
|
||
name: Pre-build base images | ||
|
||
on: | ||
schedule: | ||
- cron: "0 1 2,16 * *" # every 2nd and 16th of the month at 1am UTC | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check_docker_files: | ||
uses: ./.github/workflows/__check_docker_files.yaml | ||
|
||
with: | ||
event_name: ${{ github.event_name }} | ||
|
||
build_base: | ||
needs: check_docker_files | ||
|
||
# run inconditionnaly on schedule mode or if Docker files changed on other modes | ||
if: ${{ github.event_name == 'schedule' || needs.check_docker_files.outputs.docker_files_have_changed == 'true' }} | ||
|
||
uses: ./.github/workflows/__build_base.yaml |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ARG BASE=rocm/dev-ubuntu-20.04:5.4 | ||
ARG BASE=rocm/dev-ubuntu-20.04 | ||
FROM $BASE | ||
|
||
ARG ADDITIONAL_PACKAGES | ||
|