Skip to content

Commit

Permalink
[#61287] WIP: workflows: Build and push dependency image
Browse files Browse the repository at this point in the history
Signed-off-by: Illia Vysochyn <[email protected]>
  • Loading branch information
ivysochyn committed Jul 1, 2024
1 parent 6139784 commit ea6698d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
42 changes: 29 additions & 13 deletions .github/workflows/github-actions-cron-test-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu20.04", "ubuntu22.04", "centos7"]
os: [["ubuntu20.04", "ubuntu:20.04"], ["ubuntu22.04", "ubuntu:22.04"], ["centos7", "centos:centos7"]]
runs-on: ubuntu-latest
env:
IMAGE: ghcr.io/antmicro/openroad-flow-scripts
IMAGE: ghcr.io/antmicro/openroad-flow-scripts-test-cache
IMAGE_DEPS: ghcr.io/antmicro/openroad-flow-scripts-test-cache-deps
steps:
- name: Check out repository code
uses: actions/checkout@v3
Expand All @@ -45,32 +46,47 @@ jobs:
sudo ifconfig docker0 down
sudo brctl delbr docker0
sudo service docker restart
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run installer
run: |
./etc/DockerHelper.sh create -target=dev -os=${{ matrix.os }}
./etc/DockerHelper.sh create -target=dev -os=${{ matrix.os[0] }}
docker images
- name: Build project
run: |
./etc/DockerHelper.sh create -target=builder -os=${{ matrix.os }}
docker images
./etc/DockerHelper.sh create -target=builder -os=${{ matrix.os[0] }}
docker images
- name: Test build
run: |
cmd="source ./env.sh ; yosys -help ; openroad -help ; make -C flow ;"
if [[ ${{ matrix.os }} == "centos7" ]]; then
cmd="source /opt/rh/devtoolset-8/enable; ${cmd}"
cmd="source /opt/rh/llvm-toolset-7.0/enable; ${cmd}"
cmd="source /opt/rh/rh-python38/enable; ${cmd}"
cmd="source ./env.sh && yosys -help && openroad -help && make -C flow ;"
if [[ ${{ matrix.os[0] }} == "centos7" ]]; then
cmd="source /opt/rh/devtoolset-8/enable && ${cmd}"
cmd="source /opt/rh/llvm-toolset-7.0/enable && ${cmd}"
cmd="source /opt/rh/rh-python38/enable && ${cmd}"
fi
docker run openroad/flow-${{ matrix.os }}-builder /bin/bash -c "${cmd}"
docker run openroad/flow-${{ matrix.os[0] }}-builder /bin/bash -c "${cmd}"
- name: Tag the image
run: |
docker tag openroad/flow-${{ matrix.os }}-builder ${{ env.IMAGE }}/${{ matrix.os }}
docker tag openroad/flow-${{ matrix.os[0] }}-builder ${{ env.IMAGE }}/${{ matrix.os[0] }}
- name: Login to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request' && github.repository == 'antmicro/OpenROAD-flow-scripts'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: gha
password: ${{ github.token }}

- name: Build and export the dependencies image
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ env.IMAGE_DEPS }}/${{ matrix.os[0] }}
context: etc
file: docker/Dockerfile.dev
build-args: fromImage=${{ matrix.os[1] }}
cache-from: type=registry,ref=${{ env.IMAGE_DEPS }}/${{ matrix.os[0] }}
cache-to: type=registry,ref=${{ env.IMAGE_DEPS }}/${{ matrix.os[0] }},mode=max
- name: Push container image to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request' && github.repository == 'antmicro/OpenROAD-flow-scripts'
run: docker push ${{ env.IMAGE }}/${{ matrix.os }}
run: |
docker push ${{ env.IMAGE }}/${{ matrix.os[0] }}
2 changes: 1 addition & 1 deletion etc/DockerHelper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ _setup() {
"builder" )
fromImage="${FROM_IMAGE_OVERRIDE:-"${org}/flow-${os}-dev"}:${imageTag}"
context="."
buildArgs="--build-arg numThreads=${numThreads}"
buildArgs="--build-arg numThreads=${numThreads} --build-context ${fromImage}=docker-image://${fromImage}"
cacheArgs=""
if [[ "${useCache}" == "yes" ]]; then
cacheArgs="--cache-from type=registry,ref=ghcr.io/antmicro/openroad-flow-scripts-test-cache/${os}"
Expand Down

0 comments on commit ea6698d

Please sign in to comment.