Skip to content

Commit

Permalink
[#61287] WIP: workflows: Fix caching last build
Browse files Browse the repository at this point in the history
Signed-off-by: Illia Vysochyn <[email protected]>
  • Loading branch information
ivysochyn committed Jul 2, 2024
1 parent 04ddec2 commit 7742c1c
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 65 deletions.
106 changes: 58 additions & 48 deletions .github/workflows/github-actions-publish-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,50 @@ on:
- docker/Dockerfile.builder

jobs:
buildDependenciesImage:
strategy:
fail-fast: false
matrix:
os: [["ubuntu20.04", "ubuntu:20.04"], ["ubuntu22.04", "ubuntu:22.04"]]
runs-on: ubuntu-latest
env:
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
# buildDependenciesImage:
# strategy:
# fail-fast: false
# matrix:
# os: [["ubuntu20.04", "ubuntu:20.04"], ["ubuntu22.04", "ubuntu:22.04"]]
# runs-on: ubuntu-latest
# env:
# 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: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3

- 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: 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: Copy OpenROAD installer
run: cp tools/OpenROAD/etc/DependencyInstaller.sh etc/InstallerOpenROAD.sh
# - name: Copy OpenROAD installer
# run: cp tools/OpenROAD/etc/DependencyInstaller.sh etc/InstallerOpenROAD.sh

- name: Build and export dependencies image
uses: docker/build-push-action@v6
with:
context: etc
push: true
tags: ${{ env.IMAGE_DEPS }}:latest
file: docker/Dockerfile.dev
build-args: |
fromImage=${{ matrix.os[1] }}
numThreads=$(nproc)
cache-from: type=registry,ref=${{ env.IMAGE_DEPS }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE_DEPS }}:buildcache,mode=max
# - name: Build and export dependencies image
# uses: docker/build-push-action@v6
# with:
# context: etc
# push: true
# tags: ${{ env.IMAGE_DEPS }}:latest
# file: docker/Dockerfile.dev
# build-args: |
# fromImage=${{ matrix.os[1] }}
# numThreads=$(nproc)
# cache-from: type=registry,ref=${{ env.IMAGE_DEPS }}:buildcache
# cache-to: type=registry,ref=${{ env.IMAGE_DEPS }}:buildcache,mode=max

buildORFSImage:
needs: buildDependenciesImage
# needs: buildDependenciesImage
strategy:
fail-fast: false
matrix:
Expand All @@ -75,20 +75,30 @@ jobs:
IMAGE: ghcr.io/antmicro/openroad-flow-scripts-test-cache/${{ matrix.os }}
IMAGE_DEPS: ghcr.io/antmicro/openroad-flow-scripts-test-cache-deps/${{ matrix.os }}
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
# - name: Free Disk Space
# uses: jlumbroso/free-disk-space@main
# with:
# tool-cache: false

- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive
# fetch-depth: 1
# submodules: recursive

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Network Setup
run: |
sudo apt-get update
sudo apt-get install -y bridge-utils
sudo pkill docker
sudo iptables -t nat -F
sudo ifconfig docker0 down
sudo brctl delbr docker0
sudo service docker restart
# We don't use the build-push-action here because it hangs
- name: Build ORFS image
run: |
Expand All @@ -101,10 +111,10 @@ jobs:
--file docker/Dockerfile.builder \
.
- name: Test build
run: |
cmd="source ./env.sh && yosys -help && openroad -help && make -C flow ;"
docker run ${{ env.IMAGE }}:latest /bin/bash -c "${cmd}"
# - name: Test build
# run: |
# cmd="source ./env.sh && yosys -help && openroad -help && make -C flow ;"
# docker run ${{ env.IMAGE }}:latest /bin/bash -c "${cmd}"

- name: Login to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request' && github.repository == 'antmicro/OpenROAD-flow-scripts'
Expand Down
34 changes: 17 additions & 17 deletions docker/Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ FROM $fromImage AS openroad-builder-base

ARG numThreads=$(nproc)

COPY . /OpenROAD-flow-scripts
WORKDIR /OpenROAD-flow-scripts
RUN ./build_openroad.sh --no_init --local --threads ${numThreads}

FROM $fromImage AS openroad-flow-scripts-base

COPY . /OpenROAD-flow-scripts

RUN rm -rf /OpenROAD-flow-scripts/tools

COPY --from=openroad-builder-base /OpenROAD-flow-scripts/tools/install /OpenROAD-flow-scripts/tools/install

FROM $fromImage

COPY --from=openroad-flow-scripts-base /OpenROAD-flow-scripts /OpenROAD-flow-scripts
WORKDIR /OpenROAD-flow-scripts
# COPY . /OpenROAD-flow-scripts
# WORKDIR /OpenROAD-flow-scripts
#
# RUN ./build_openroad.sh --no_init --local --threads ${numThreads}
#
# FROM $fromImage AS openroad-flow-scripts-base
#
# COPY . /OpenROAD-flow-scripts
#
# RUN rm -rf /OpenROAD-flow-scripts/tools
#
# COPY --from=openroad-builder-base /OpenROAD-flow-scripts/tools/install /OpenROAD-flow-scripts/tools/install
#
# FROM $fromImage
#
# COPY --from=openroad-flow-scripts-base /OpenROAD-flow-scripts /OpenROAD-flow-scripts
# WORKDIR /OpenROAD-flow-scripts

0 comments on commit 7742c1c

Please sign in to comment.