Skip to content

Commit

Permalink
[#61287] WIP: workflows: Refactor ORFS image workflow
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 b80af21 commit 0469400
Showing 1 changed file with 59 additions and 49 deletions.
108 changes: 59 additions & 49 deletions .github/workflows/github-actions-publish-docker-images.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Build and publish ORFS image
name: Build and publish ORFS images
on:
schedule:
- cron: "0 8 * * SUN"
push:
paths:
- 'etc/DependencyInstaller.sh'
Expand All @@ -26,64 +24,70 @@ on:
workflow_dispatch:

jobs:
testInstaller:
# 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: 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: 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
strategy:
fail-fast: false
matrix:
os: [["ubuntu20.04", "ubuntu:20.04"], ["ubuntu22.04", "ubuntu:22.04"]]
os: ["ubuntu20.04", "ubuntu22.04"]
runs-on: ubuntu-latest
env:
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] }}
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: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive

- 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
- 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: 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: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
# We clear docker images as docker buildx driver is isolated
tool-cache: false
- name: Test docker buildx
run: docker buildx build --help

- name: Build ORFS image
uses: docker/build-push-action@v6
Expand All @@ -95,14 +99,21 @@ jobs:
file: docker/Dockerfile.builder
build-args: |
fromImage=${{ env.IMAGE_DEPS }}:latest
numThreads=$(nproc)
cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache

- 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'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: gha
password: ${{ github.token }}

- name: Export ORFS image
uses: docker/build-push-action@v6
with:
Expand All @@ -111,7 +122,6 @@ jobs:
tags: ${{ env.IMAGE }}:latest
file: docker/Dockerfile.builder
build-args: |
fromImage=${{ env.IMAGE_DEPS }}rlatest
numThreads=$(nproc)
fromImage=${{ env.IMAGE_DEPS }}:latest
cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE }}:buildcache,mode=max

0 comments on commit 0469400

Please sign in to comment.