Skip to content

Commit c527620

Browse files
committed
Merge branch 'master' into secure-check_antennas_metrics
Signed-off-by: Eder Monteiro <[email protected]>
2 parents 57d7829 + 5449b9e commit c527620

File tree

8 files changed

+203
-21
lines changed

8 files changed

+203
-21
lines changed

.github/workflows/github-actions-cron-test-installer.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ jobs:
4545
sudo service docker restart
4646
- name: Run installer
4747
run: |
48-
./etc/DockerHelper.sh create -target=dev -os=${{ matrix.os }}
48+
./etc/DockerHelper.sh create -target=dev -os=${{ matrix.os }} -tag=latest
4949
- name: Build project
5050
run: |
51-
./etc/DockerHelper.sh create -target=builder -os=${{ matrix.os }}
51+
./etc/DockerHelper.sh create -target=builder -os=${{ matrix.os }} -tag=latest
5252
- name: Test build
5353
run: |
5454
cmd="source ./env.sh ; yosys -help ; openroad -help ; make -C flow ;"
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Build and publish ORFS images
2+
on:
3+
push:
4+
paths:
5+
- etc/DependencyInstaller.sh
6+
- etc/DockerHelper.sh
7+
- .github/workflows/github-actions-publish-docker-images.yml
8+
- build_openroad.sh
9+
- env.sh
10+
- flow/Makefile
11+
- docker/Dockerfile.dev
12+
- docker/Dockerfile.builder
13+
pull_request:
14+
paths:
15+
- etc/DependencyInstaller.sh
16+
- etc/DockerHelper.sh
17+
- .github/workflows/github-actions-publish-docker-images.yml
18+
- build_openroad.sh
19+
- env.sh
20+
- flow/Makefile
21+
- docker/Dockerfile.dev
22+
- docker/Dockerfile.builder
23+
24+
jobs:
25+
buildDependenciesImage:
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
os: [["ubuntu20.04", "ubuntu:20.04"], ["ubuntu22.04", "ubuntu:22.04"]]
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Check out repository code
33+
uses: actions/checkout@v3
34+
with:
35+
fetch-depth: 1
36+
submodules: recursive
37+
38+
- name: Set environment variables
39+
run: |
40+
echo "IMAGE_DEPS=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')-dev/${{ matrix.os[0] }}" >> $GITHUB_ENV
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Login to GitHub Container Registry (GHCR)
46+
if: github.event_name != 'pull_request'
47+
uses: docker/login-action@v2
48+
with:
49+
registry: ghcr.io
50+
username: gha
51+
password: ${{ github.token }}
52+
53+
- name: Copy OpenROAD installer
54+
run: cp tools/OpenROAD/etc/DependencyInstaller.sh etc/InstallerOpenROAD.sh
55+
56+
- name: Build and export dependencies image
57+
uses: docker/build-push-action@v6
58+
with:
59+
context: etc
60+
push: true
61+
tags: ${{ env.IMAGE_DEPS }}:latest
62+
file: docker/Dockerfile.dev
63+
build-args: |
64+
fromImage=${{ matrix.os[1] }}
65+
numThreads=$(nproc)
66+
cache-from: type=registry,ref=${{ env.IMAGE_DEPS }}:buildcache
67+
cache-to: type=registry,ref=${{ env.IMAGE_DEPS }}:buildcache,mode=max
68+
69+
buildORFSImage:
70+
needs: buildDependenciesImage
71+
strategy:
72+
fail-fast: false
73+
matrix:
74+
os: ["ubuntu20.04", "ubuntu22.04"]
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: Free Disk Space
78+
uses: jlumbroso/free-disk-space@main
79+
with:
80+
tool-cache: false
81+
82+
- name: Check out repository code
83+
uses: actions/checkout@v3
84+
with:
85+
fetch-depth: 1
86+
submodules: recursive
87+
88+
- name: Set environment variables
89+
run: |
90+
echo "IMAGE=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')/${{ matrix.os }}" >> $GITHUB_ENV
91+
echo "IMAGE_DEPS=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')-dev/${{ matrix.os }}" >> $GITHUB_ENV
92+
93+
- name: Set up Docker Buildx
94+
uses: docker/setup-buildx-action@v3
95+
96+
# We don't use the build-push-action here because it hangs
97+
- name: Build ORFS image
98+
run: |
99+
docker buildx build \
100+
--load \
101+
--build-arg fromImage=${{ env.IMAGE_DEPS }}:latest \
102+
--build-arg numThreads=$(nproc) \
103+
--cache-from type=registry,ref=${{ env.IMAGE }}:buildcache \
104+
--tag ${{ env.IMAGE }}:latest \
105+
--file docker/Dockerfile.builder \
106+
.
107+
108+
- name: Test build
109+
run: |
110+
cmd="source ./env.sh && yosys -help && openroad -help && make -C flow ;"
111+
docker run ${{ env.IMAGE }}:latest /bin/bash -c "${cmd}"
112+
113+
- name: Login to GitHub Container Registry (GHCR)
114+
if: github.event_name != 'pull_request'
115+
uses: docker/login-action@v2
116+
with:
117+
registry: ghcr.io
118+
username: gha
119+
password: ${{ github.token }}
120+
121+
- name: Export ORFS image
122+
run: |
123+
docker buildx build \
124+
--build-arg fromImage=${{ env.IMAGE_DEPS }}:latest \
125+
--build-arg numThreads=$(nproc) \
126+
--cache-from type=registry,ref=${{ env.IMAGE }}:buildcache \
127+
--cache-to type=registry,ref=${{ env.IMAGE }}:buildcache,mode=max \
128+
--tag ${{ env.IMAGE }}:latest \
129+
--file docker/Dockerfile.builder \
130+
--push \
131+
.

build_openroad.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ OPENROAD_APP_BRANCH="master"
2020
INSTALL_PATH="$(pwd)/tools/install"
2121

2222
YOSYS_USER_ARGS=""
23-
YOSYS_ARGS="CONFIG=gcc"
23+
YOSYS_ARGS="CONFIG=clang ENABLE_NDEBUG=1"
2424

2525
OPENROAD_APP_USER_ARGS=""
2626
OPENROAD_APP_ARGS=""

docker/Dockerfile.builder

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,24 @@
44
# instead use etc/DockerHelper.sh
55
ARG fromImage=openroad/flow-ubuntu22.04-dev:latest
66

7-
FROM $fromImage
7+
FROM $fromImage AS openroad-builder-base
88

99
ARG numThreads=$(nproc)
1010

1111
COPY . /OpenROAD-flow-scripts
1212
WORKDIR /OpenROAD-flow-scripts
1313
1414
RUN ./build_openroad.sh --no_init --local --threads ${numThreads}
15+
16+
FROM $fromImage AS openroad-flow-scripts-base
17+
18+
COPY . /OpenROAD-flow-scripts
19+
20+
RUN rm -rf /OpenROAD-flow-scripts/tools /OpenROAD-flow-scripts/.git
21+
22+
COPY --from=openroad-builder-base /OpenROAD-flow-scripts/tools/install /OpenROAD-flow-scripts/tools/install
23+
24+
FROM $fromImage
25+
26+
COPY --from=openroad-flow-scripts-base /OpenROAD-flow-scripts /OpenROAD-flow-scripts
27+
WORKDIR /OpenROAD-flow-scripts

docker/Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ COPY InstallerOpenROAD.sh \
1515
ARG options=""
1616

1717
RUN ./DependencyInstaller.sh $options \
18-
&& rm -rf /tmp/installer
18+
&& rm -rf /tmp/installer /tmp/* /var/tmp/* /var/lib/apt/lists/*
1919

2020
ARG fromImage
2121

etc/DependencyInstaller.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ _installCommon() {
3030
fi
3131
local pkgs="pandas numpy firebase_admin click pyyaml"
3232
if [[ $(id -u) == 0 ]]; then
33-
pip3 install -U $pkgs
33+
pip3 install --no-cache-dir -U $pkgs
3434
else
35-
pip3 install --user -U $pkgs
35+
pip3 install --no-cache-dir --user -U $pkgs
3636
fi
3737
}
3838

@@ -70,7 +70,7 @@ _installUbuntuCleanUp() {
7070
_installUbuntuPackages() {
7171
export DEBIAN_FRONTEND="noninteractive"
7272
apt-get -y update
73-
apt-get -y install \
73+
apt-get -y install --no-install-recommends \
7474
libqt5multimediawidgets5 \
7575
libqt5svg5-dev \
7676
libqt5xmlpatterns5-dev \

etc/DockerHelper.sh

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,19 @@ usage: $0 [CMD] [OPTIONS]
2020
push Push the docker image to Docker Hub
2121
2222
OPTIONS:
23-
-os=OS_NAME Choose beween ubuntu20.04 and ubuntu22.04 (default).
24-
-target=TARGET Choose target fo the Docker image:
23+
-os=OS_NAME Choose between ubuntu20.04 and ubuntu22.04 (default).
24+
-target=TARGET Choose target for the Docker image:
2525
'dev': os + packages to compile app
2626
'builder': os + packages to compile app +
2727
copy source code and build app
28-
-threads Max number of threads to use if compiling.
28+
-threads=N Max number of threads to use if compiling.
2929
Default = \$(nproc)
30+
-tag=TAG Use as the image tag. Default is git commit sha.
31+
-username=USERNAME Username to loging at the docker registry.
32+
-password=PASSWORD Password to loging at the docker registry.
3033
-ci Install CI tools in image
34+
-dry-run Do not push images to the repository
3135
-h -help Show this message and exits
32-
-username Docker Username
33-
-password Docker Password
3436
3537
EOF
3638
exit "${1:-1}"
@@ -101,7 +103,11 @@ _push() {
101103
_help
102104
fi
103105

104-
${DOCKER_CMD} login --username "${username}" --password "${password}"
106+
if [[ "${dryRun}" == 1 ]]; then
107+
echo "Skipping docker login"
108+
else
109+
${DOCKER_CMD} login --username "${username}" --password "${password}"
110+
fi
105111

106112
if [[ "${tag}" == "" ]]; then
107113
tag=$(./etc/DockerTag.sh -dev)
@@ -113,7 +119,9 @@ _push() {
113119
./etc/DockerHelper.sh create -os=${os} -target=dev -tag=${tag} -ci \
114120
2>&1 | tee build/create-${os}-dev-${tag}.log
115121

116-
${DOCKER_CMD} push "${org}/flow-${os}-dev:${tag}"
122+
if [[ "${dryRun}" != 1 ]]; then
123+
${DOCKER_CMD} push "${org}/flow-${os}-dev:${tag}"
124+
fi
117125
fi
118126

119127
if [[ "${target}" == "master" ]]; then
@@ -122,8 +130,15 @@ _push() {
122130
./etc/DockerHelper.sh create -os=${os} -target=builder \
123131
2>&1 | tee build/create-${os}-${target}-${tag}.log
124132

125-
${DOCKER_CMD} tag ${org}/flow-${os}-builder:${imageTag} ${org}/orfs:${tag}
126-
${DOCKER_CMD} push ${org}/orfs:${tag}
133+
builderTag=${org}/flow-${os}-builder:${imageTag}
134+
orfsTag=${org}/orfs:${tag}
135+
echo "Renaming docker image: ${builderTag} -> ${orfsTag}"
136+
${DOCKER_CMD} tag ${builderTag} ${orfsTag}
137+
if [[ "${dryRun}" == 1 ]]; then
138+
echo "[DRY-RUN] ${DOCKER_CMD} push ${orfsTag}"
139+
else
140+
${DOCKER_CMD} push ${orfsTag}
141+
fi
127142
fi
128143
}
129144

@@ -156,6 +171,7 @@ target="dev"
156171
numThreads="-1"
157172
tag=""
158173
options=""
174+
dryRun=0
159175

160176
while [ "$#" -gt 0 ]; do
161177
case "${1}" in
@@ -165,6 +181,9 @@ while [ "$#" -gt 0 ]; do
165181
-ci )
166182
options="-ci"
167183
;;
184+
-dry-run )
185+
dryRun=1
186+
;;
168187
-os=* )
169188
os="${1#*=}"
170189
;;

jenkins/public_tests_all.Jenkinsfile

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
1-
@Library('utils@orfs-v2.0.1') _
1+
@Library('utils@orfs-v2.1.0') _
22

3-
node('ubuntu22') {
3+
node {
44

55
properties([copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME)]);
66

77
stage('Checkout') {
8-
checkout scm;
8+
checkout([
9+
$class: 'GitSCM',
10+
branches: [[name: scm.branches[0].name]],
11+
doGenerateSubmoduleConfigurations: false,
12+
extensions: [
13+
[$class: 'CloneOption', noTags: false],
14+
[$class: 'SubmoduleOption', recursiveSubmodules: true]
15+
],
16+
submoduleCfg: [],
17+
userRemoteConfigs: scm.userRemoteConfigs
18+
]);
19+
def description = sh(script: "git log -1 --pretty=%B", returnStdout: true).trim();
20+
if (description.contains('ci') && description.contains('skip')) {
21+
currentBuild.result = 'SKIPPED'; // 'SUCCESS', 'SKIPPED'
22+
return;
23+
}
924
}
1025

1126
def DOCKER_IMAGE;
@@ -19,7 +34,11 @@ node('ubuntu22') {
1934
}
2035

2136
stage('Run Tests') {
22-
runTests(DOCKER_IMAGE, 'pr');
37+
if (env.CHANGE_BRANCH && env.CHANGE_BRANCH.contains('ci-dev')) {
38+
runTests(DOCKER_IMAGE, 'dev');
39+
} else {
40+
runTests(DOCKER_IMAGE, 'pr');
41+
}
2342
}
2443

2544
stage ('Cleanup and Reporting') {

0 commit comments

Comments
 (0)