-
Notifications
You must be signed in to change notification settings - Fork 58
Add a CI job to build a docker image with the compiler installed #798
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
Open
arichardson
wants to merge
6
commits into
dev
Choose a base branch
from
github-action-docker-image
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+103
−0
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
19277fd
Add a CI job to build a docker image with the compiler installed
arichardson 3db0bdc
CI: Add github-action-docker-image branch to push trigger
arichardson 3e6b2b3
Free up disk space to allow building docker image
arichardson 6d8ee60
CI: Add LLVM regression tests and JUnit XML reporting to build-docker…
arichardson ee9b944
ci: print free space to debug runner failures
arichardson 641dbf6
Add missing permissions
arichardson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,102 @@ | ||
| name: Build and Package | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: [ "main", "dev", "github-action-docker-image" ] | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will drop the second commit adding this branch before merging. |
||
|
|
||
| jobs: | ||
| build_docker_image: | ||
| name: Build Docker Image for CI | ||
| if: github.repository_owner == 'CTSRD-CHERI' | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| checks: write | ||
arichardson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y ninja-build cmake build-essential lld | ||
|
|
||
| - name: ccache | ||
arichardson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| uses: hendrikmuhs/[email protected] | ||
|
|
||
| - name: Configure CMake | ||
| run: | | ||
| # Build a minimal version of LLVM with features we do not need disabled | ||
| cmake -G Ninja -S llvm -B build \ | ||
| -DLLVM_ENABLE_ASSERTIONS=TRUE \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_INSTALL_PREFIX=/usr/local \ | ||
| -DLLVM_ENABLE_PROJECTS="clang;lld" \ | ||
| -DLLVM_TARGETS_TO_BUILD="all" \ | ||
| -DLLVM_CCACHE_BUILD=TRUE \ | ||
| -DLLVM_ENABLE_LLD=TRUE \ | ||
| -DCLANG_ENABLE_STATIC_ANALYZER=FALSE -DCLANG_ENABLE_ARCMT=FALSE -DLLVM_ENABLE_Z3_SOLVER=FALSE \ | ||
| -DLLVM_TOOL_LLVM_MCA_BUILD=FALSE -DLLVM_TOOL_LLVM_EXEGESIS_BUILD=FALSE -DLLVM_TOOL_LLVM_RC_BUILD=FALSE \ | ||
| -DLLVM_LIT_ARGS="-v --xunit-xml-output=test-results.xml" | ||
|
|
||
| - name: Build | ||
| run: | | ||
| df -h | ||
| cmake --build build | ||
| df -h | ||
|
|
||
| - name: Run Tests | ||
| run: | | ||
| cmake --build build --target check-all | ||
| df -h | ||
|
|
||
| - name: Publish Test Results | ||
| uses: EnricoMi/publish-unit-test-result-action@v2 | ||
| if: always() | ||
| with: | ||
| files: build/test-results.xml | ||
|
|
||
| - name: Install | ||
| run: | | ||
| DESTDIR=$GITHUB_WORKSPACE/install cmake --install build | ||
| df -h | ||
|
|
||
| - name: Create Dockerfile | ||
| run: | | ||
| cat <<EOF > Dockerfile | ||
| FROM ubuntu:24.04 | ||
| COPY --chown=root install/usr/local /usr/local | ||
| EOF | ||
|
|
||
| - name: Prepare Docker Metadata | ||
| run: | | ||
| IMAGE_ID=ghcr.io/${{ github.repository }} | ||
| # Change all uppercase to lowercase | ||
| IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
| # Sanitize branch name for use as a docker tag (replace / with -) | ||
| TAG_NAME=$(echo "${{ github.ref_name }}" | tr '/' '-') | ||
| echo "IMAGE_ID=$IMAGE_ID" >> $GITHUB_ENV | ||
| echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | ||
|
|
||
| - name: Build Docker Image | ||
| run: | | ||
| # Free up disk space so that the docker build can succeed | ||
| rm -rf build | ||
| df -h | ||
| echo "Building $IMAGE_ID:$TAG_NAME" | ||
arichardson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| docker build -t $IMAGE_ID:$TAG_NAME . | ||
| df -h | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Push Docker Image | ||
| run: | | ||
| echo "Pushing $IMAGE_ID:$TAG_NAME" | ||
| docker push $IMAGE_ID:$TAG_NAME | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.