forked from The-OpenROAD-Project/OpenROAD-flow-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (132 loc) · 4.68 KB
/
github-actions-publish-docker-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Build and publish ORFS images
on:
push:
paths:
- etc/DependencyInstaller.sh
- etc/DockerHelper.sh
- .github/workflows/github-actions-publish-docker-images.yml
- build_openroad.sh
- env.sh
- flow/Makefile
- docker/Dockerfile.dev
- docker/Dockerfile.builder
- tools/codespace/scripts/**
- tools/codespace/Dockerfile-lxqt
pull_request:
paths:
- etc/DependencyInstaller.sh
- etc/DockerHelper.sh
- .github/workflows/github-actions-publish-docker-images.yml
- build_openroad.sh
- env.sh
- flow/Makefile
- docker/Dockerfile.dev
- docker/Dockerfile.builder
- tools/codespace/scripts/**
- tools/codespace/Dockerfile-lxqt
jobs:
buildCodespaceImage:
runs-on: ubuntu-latest
timeout-minutes: 600
steps:
- uses: actions/checkout@v4
- name: Set environment variables
run: echo "IMAGE=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: gha
password: ${{ github.token }}
- name: Build and export codespaces image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ env.IMAGE }}:lxqt
file: tools/codespace/Dockerfile-lxqt
cache-from: type=registry,ref=${{ env.IMAGE }}:lxqtbuildcache
cache-to: type=registry,ref=${{ env.IMAGE }}:lxqtbuildcache
buildDependenciesImage:
strategy:
fail-fast: false
matrix:
os: [["ubuntu20.04", "ubuntu:20.04"], ["ubuntu22.04", "ubuntu:22.04"]]
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Set environment variables
run: |
echo "IMAGE_DEPS=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')-dev/${{ matrix.os[0] }}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request'
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] }}
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", "ubuntu22.04"]
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Set environment variables
run: |
echo "IMAGE=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')/${{ matrix.os }}" >> $GITHUB_ENV
echo "IMAGE_DEPS=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')-dev/${{ matrix.os }}" >> $GITHUB_ENV
echo "NUM_THREADS=$(nproc)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry (GHCR)
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: gha
password: ${{ github.token }}
- name: Build and export ORFS image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ env.IMAGE }}:latest
file: docker/Dockerfile.builder
build-args: |
fromImage=${{ env.IMAGE_DEPS }}
numThreads=${{ env.NUM_THREADS }}
cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE }}:buildcache,mode=max