Skip to content

Commit

Permalink
[#61287] WIP: workflows: Build using buildx action
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 316aa15 commit 927ef33
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 41 deletions.
125 changes: 89 additions & 36 deletions .github/workflows/github-actions-cron-test-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,21 @@ jobs:
matrix:
os: [["ubuntu20.04", "ubuntu:20.04"], ["ubuntu22.04", "ubuntu:22.04"], ["centos7", "centos:centos7"]]
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
env:
IMAGE: ghcr.io/antmicro/openroad-flow-scripts-test-cache
IMAGE_DEPS: ghcr.io/antmicro/openroad-flow-scripts-test-cache-deps
IMAGE: ghcr.io/antmicro/openroad-flow-scripts-test-cache/${{ matrix.os[0] }}
IMAGE_DEPS: ghcr.io/antmicro/openroad-flow-scripts-test-cache-deps/${{ matrix.os[0] }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive

- name: Network Setup
run: |
sudo apt-get update
Expand All @@ -46,17 +52,50 @@ 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[0] }}
docker images
- name: Build project
run: |
docker images
./etc/DockerHelper.sh create -target=builder -os=${{ matrix.os[0] }}
docker images
with:
# network=host driver-opt needed to push to local registry
driver-opts: network=host

- name: Copy OpenROAD installer
run: cp tools/OpenROAD/etc/DependencyInstaller.sh etc/InstallerOpenROAD.sh

- name: Build dependencies image
uses: docker/build-push-action@v6
with:
load: true
tags: ${{ env.IMAGE_DEPS }}:latest
context: etc
push: true
tags: localhost:5000/openroad-flow-${{ matrix.os[0] }}-dev:latest
file: docker/Dockerfile.dev
build-args: |
fromImage=${{ matrix.os[1] }}
numThreads=$(nproc)
cache-from: type=registry,ref=${{ env.IMAGE_DEPS }}:latest

- name: List images 1
run: docker images -a

- name: Build ORFS image
uses: docker/build-push-action@v6
with:
load: true
tags: ${{ env.IMAGE }}
context: .
file: docker/Dockerfile.builder
build-args: |
fromImage=dependency-image
numThreads=$(nproc)
build-contexts: |
dependency-image=docker-image://localhost:5000/openroad-flow-${{ matrix.os[0] }}-dev:latest
cache-from: type=registry,ref=${{ env.IMAGE }}:latest

- name: List images 2
run: docker images -a

- name: Test build
run: |
cmd="source ./env.sh && yosys -help && openroad -help && make -C flow ;"
Expand All @@ -65,28 +104,42 @@ jobs:
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[0] }}-builder /bin/bash -c "${cmd}"
- name: Tag the image
run: |
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[0] }}
docker run ${{ env.IMAGE }} /bin/bash -c "${cmd}"
# - 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: Export dependencies image
# uses: docker/build-push-action@v4
# with:
# push: true
# tags: ${{ env.IMAGE_DEPS }}
# context: etc
# file: docker/Dockerfile.dev
# build-args: |
# fromImage=${{ matrix.os[1] }}
# numThreads=$(nproc)
# build-contexts: |
# ${{ env.IMAGE_DEPS }}=docker-image://${{ env.IMAGE_DEPS }}
# cache-from: type=registry,ref=${{ env.IMAGE_DEPS }}
# cache-to: type=registry,ref=${{ env.IMAGE_DEPS }},mode=max
# - name: Build ORFS image
# uses: docker/build-push-action@v4
# with:
# load: true
# tags: ${{ env.IMAGE }}
# context: .
# file: docker/Dockerfile.builder
# build-args: |
# fromImage=${{ env.IMAGE_DEPS }}
# numThreads=$(nproc)
# build-contexts: |
# ${{ env.IMAGE_DEPS }}=docker-image://${{ env.IMAGE_DEPS }}
# cache-from: type=registry,ref=${{ env.IMAGE }}
# cache-to: type=registry,ref=${{ env.IMAGE }},mode=max
10 changes: 5 additions & 5 deletions docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ WORKDIR /tmp/installer/etc

COPY DependencyInstaller.sh .

COPY InstallerOpenROAD.sh \
/tmp/installer/tools/OpenROAD/etc/DependencyInstaller.sh

RUN ./DependencyInstaller.sh \
&& rm -rf /tmp/installer
# COPY InstallerOpenROAD.sh \
# /tmp/installer/tools/OpenROAD/etc/DependencyInstaller.sh
#
# RUN ./DependencyInstaller.sh \
# && rm -rf /tmp/installer

0 comments on commit 927ef33

Please sign in to comment.