Skip to content

Commit 6d20d41

Browse files
authored
Change Versioning Strategy (#2153)
~ use tclmodules (`.tm`) files instead of pkgIndex.tcl for openlane and openlane_utils ~ change tagging to use the version from the `.tm` files instead of the day of the release ~ bump github action versions
1 parent 1aee096 commit 6d20d41

28 files changed

+68
-155
lines changed

.github/actions/docker_build/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ runs:
5757
run: docker save -o /tmp/image-${{ inputs.arch }}.tar ${{ env.OPENLANE_IMAGE_NAME }}-${{ inputs.arch }}
5858

5959
- name: Upload Docker Image
60-
uses: actions/upload-artifact@v2
60+
uses: actions/upload-artifact@v4
6161
with:
6262
name: docker-image-${{ inputs.arch }}
6363
path: /tmp/image-${{ inputs.arch }}.tar

.github/scripts/generate_tag.py

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,25 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
import datetime
17-
import subprocess
16+
import os
17+
import re
1818
from gh import gh
1919

2020
new_tag = "NO_NEW_TAG"
2121

22-
print("Getting latest release index…")
22+
tags = [tag for _, tag in gh.openlane.tags]
2323

24-
print("Getting the latest tag…")
24+
openlane_tm_rx = re.compile(r"openlane-(.+?)\.tm")
2525

26-
latest_tag = None
27-
latest_tag_commit = None
28-
commits_with_tags = gh.openlane.tags
29-
tags = [tag for _, tag in commits_with_tags]
30-
for tag in commits_with_tags:
31-
commit, name = tag
32-
latest_tag = name
33-
latest_tag_commit = commit
34-
35-
commit_count = int(
36-
subprocess.check_output(
37-
["git", "rev-list", "--count", "%s..%s" % (latest_tag_commit, "HEAD")]
38-
)
39-
)
40-
41-
if commit_count == 0:
42-
print("No new commits. A tag will not be created.")
43-
else:
44-
now = datetime.datetime.now()
45-
46-
time = now.strftime("%Y.%m.%d")
47-
new_tag = time
48-
release_counter = 0
49-
while new_tag in tags:
50-
release_counter += 1
51-
new_tag = f"{time}r{release_counter}"
52-
53-
print("Naming new tag %s." % new_tag)
26+
for file in os.listdir("scripts"):
27+
match = openlane_tm_rx.match(file)
28+
if match is not None:
29+
tag = match[1]
30+
if tag not in tags:
31+
new_tag = tag
32+
print("Naming new tag %s." % new_tag)
33+
else:
34+
print("No new tag found.")
35+
break
5436

5537
gh.export_env("NEW_TAG", new_tag)

.github/scripts/variables_documentation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
OPENLANE_MOUNTED_SCRIPTS_VERSION
6363
OPENLANE_ROOT
6464
OPENLANE_VERSION
65+
OPENLANE_COMMIT
6566
OPENROAD_BIN
6667
PACKAGED_SCRIPT_0
6768
PDKPATH
@@ -98,6 +99,7 @@
9899
TERM
99100
TERMINAL_OUTPUT
100101
TMP_DIR
102+
TCL8_5_TM_PATH
101103
TRACKS_INFO_FILE_PROCESSED
102104
VCHECK_OUTPUT
103105
VDD_NET

.github/workflows/openlane_ci.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
matrix:
2020
pdk: [sky130A, gf180mcuC]
2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323

2424
- name: Set up environment variables
2525
uses: ./.github/actions/set_env_variables
@@ -53,7 +53,7 @@ jobs:
5353
tar -cf /tmp/${{ matrix.pdk }}.tar -C $PDK_ROOT/${{ matrix.pdk }} .
5454
5555
- name: Upload PDK Tarball
56-
uses: actions/upload-artifact@v3
56+
uses: actions/upload-artifact@v4
5757
with:
5858
name: pdk-tarball-${{ matrix.pdk }}
5959
path: /tmp/${{ matrix.pdk }}.tar
@@ -64,7 +64,7 @@ jobs:
6464
design_matrix: ${{ steps.set-matrix.outputs.design_matrix }}
6565
issue_regression_matrix: ${{ steps.set-matrix.outputs.issue_regression_matrix }}
6666
steps:
67-
- uses: actions/checkout@v3
67+
- uses: actions/checkout@v4
6868
with:
6969
fetch-depth: 0
7070
- name: Python Dependencies
@@ -88,7 +88,7 @@ jobs:
8888
name: Docker Build (amd64)
8989
runs-on: ubuntu-20.04
9090
steps:
91-
- uses: actions/checkout@v3
91+
- uses: actions/checkout@v4
9292
- name: Build
9393
uses: ./.github/actions/docker_build
9494
with:
@@ -100,7 +100,7 @@ jobs:
100100
name: Docker Build (arm64v8)
101101
runs-on: ubuntu-20.04
102102
steps:
103-
- uses: actions/checkout@v3
103+
- uses: actions/checkout@v4
104104
- name: Build
105105
uses: ./.github/actions/docker_build
106106
with:
@@ -116,13 +116,13 @@ jobs:
116116
fail-fast: false
117117
matrix: ${{ fromJSON(needs.prepare_test_matrices.outputs.issue_regression_matrix) }}
118118
steps:
119-
- uses: actions/checkout@v3
119+
- uses: actions/checkout@v4
120120

121121
- name: Set up environment variables
122122
uses: ./.github/actions/set_env_variables
123123

124124
- name: Download Docker Image
125-
uses: actions/download-artifact@v3
125+
uses: actions/download-artifact@v4
126126
with:
127127
name: docker-image-amd64
128128
path: /tmp
@@ -131,7 +131,7 @@ jobs:
131131
run: docker load --input /tmp/image-amd64.tar
132132

133133
- name: Download PDK Tarball
134-
uses: actions/download-artifact@v3
134+
uses: actions/download-artifact@v4
135135
with:
136136
name: pdk-tarball-sky130A
137137
path: /tmp
@@ -150,7 +150,7 @@ jobs:
150150

151151
- name: Upload Logs
152152
if: ${{ always() }}
153-
uses: actions/upload-artifact@v3
153+
uses: actions/upload-artifact@v4
154154
with:
155155
name: test_${{ matrix.test }}_logs
156156
path: ./test_logs
@@ -164,15 +164,15 @@ jobs:
164164
fail-fast: false
165165
matrix: ${{ fromJSON(needs.prepare_test_matrices.outputs.design_matrix) }}
166166
steps:
167-
- uses: actions/checkout@v3
167+
- uses: actions/checkout@v4
168168
with:
169169
submodules: true
170170

171171
- name: Set up environment variables
172172
uses: ./.github/actions/set_env_variables
173173

174174
- name: Download Docker Image (amd64)
175-
uses: actions/download-artifact@v3
175+
uses: actions/download-artifact@v4
176176
with:
177177
name: docker-image-amd64
178178
path: /tmp
@@ -181,7 +181,7 @@ jobs:
181181
run: docker load --input /tmp/image-amd64.tar
182182

183183
- name: Download PDK Tarball
184-
uses: actions/download-artifact@v3
184+
uses: actions/download-artifact@v4
185185
with:
186186
name: pdk-tarball-${{ matrix.design.pdk }}
187187
path: /tmp
@@ -216,7 +216,7 @@ jobs:
216216
217217
- name: Upload Run Tarball
218218
if: ${{ always() }}
219-
uses: actions/upload-artifact@v3
219+
uses: actions/upload-artifact@v4
220220
with:
221221
name: ${{ env.ESCAPED_DESIGN_NAME }}-${{ matrix.design.pdk }}
222222
path: ./reproducible.tar.gz
@@ -236,21 +236,21 @@ jobs:
236236
export PUSHING=$(ruby -e 'if ("${{ github.event_name }}" != "pull_request" && "${{ secrets.DOCKERHUB_USER }}" != ""); print(1) else print(0) end')
237237
echo "PUSHING=$PUSHING" >> $GITHUB_ENV
238238
239-
- uses: actions/checkout@v3
239+
- uses: actions/checkout@v4
240240
with:
241241
fetch-depth: 0
242242

243243
- name: Set up environment variables
244244
uses: ./.github/actions/set_env_variables
245245

246246
- name: Download Docker Image (amd64)
247-
uses: actions/download-artifact@v3
247+
uses: actions/download-artifact@v4
248248
with:
249249
name: docker-image-amd64
250250
path: /tmp
251251

252252
- name: Download Docker Image (arm64v8)
253-
uses: actions/download-artifact@v3
253+
uses: actions/download-artifact@v4
254254
with:
255255
name: docker-image-arm64v8
256256
path: /tmp
@@ -270,10 +270,6 @@ jobs:
270270
with:
271271
name: pdk-tarball
272272

273-
- name: Write Main Branch
274-
run: |
275-
echo "MAIN_BRANCH=${{ vars.MAIN_BRANCH }}" >> $GITHUB_ENV
276-
277273
- name: Write Hash
278274
run: |
279275
echo "GIT_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
@@ -286,7 +282,7 @@ jobs:
286282
done
287283
288284
- name: Create Tag (If scheduled or dispatched)
289-
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.BRANCH_NAME == env.MAIN_BRANCH }}
285+
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && (env.BRANCH_NAME == vars.MAIN_BRANCH || env.BRANCH_NAME == 'superstable') }}
290286
run: cd ${GITHUB_WORKSPACE}/ && python3 ${GITHUB_WORKSPACE}/.github/scripts/generate_tag.py
291287

292288
- name: Tag Commit (If scheduled or dispatched)

docker/openlane/Dockerfile.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ FROM ${RUN_BASE_IMAGE}
2121
ENV OPENLANE_ROOT=/openlane
2222
ENV OPENROAD_BIN openroad
2323

24+
ENV TCL8_5_TM_PATH=${OPENLANE_ROOT}/scripts
2425
ENV OPENROAD=/build/
2526
ENV PATH=$OPENLANE_ROOT:$OPENLANE_ROOT/scripts:$OPENROAD/bin:$OPENROAD/bin/Linux-x86_64:$OPENROAD/pdn/scripts:$PATH
2627
ENV LD_LIBRARY_PATH=$OPENROAD/lib:$OPENROAD/lib/Linux-x86_64:$LD_LIBRARY_PATH

docs/source/getting_started/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ This is a typical structure for a design folder:
8585
│   ├── config.json
8686
│   ├── logs
8787
│   ├── openlane.log
88-
│   ├── OPENLANE_VERSION
88+
│   ├── OPENLANE_COMMIT
8989
│   ├── PDK_SOURCES
9090
│   ├── reports
9191
│   ├── results

docs/source/reference/openlane_commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page describes the list of commands available in OpenLane, their functional
44

55
**NOTE:** You must run the `prep` command before running any of the other commands, in order to have the necessary files and configurations loaded.
66

7-
The following commands are available in the interactive mode: `./flow.tcl -interactive`, or in Tclsh using `% package require openlane 0.9`.
7+
The following commands are available in the interactive mode: `./flow.tcl -interactive`, or in Tclsh using `% package require openlane`.
88

99
## General Commands
1010

flow.tcl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if { [file exists $::env(OPENLANE_ROOT)/install/env.tcl ] } {
2121
if { ! [info exists ::env(OPENROAD_BIN) ] } {
2222
set ::env(OPENROAD_BIN) openroad
2323
}
24-
lappend ::auto_path "$::env(OPENLANE_ROOT)/scripts/"
24+
set ::env(TCL8_5_TM_PATH) "$::env(OPENLANE_ROOT)/scripts:$::env(TCL8_5_TM_PATH)"
2525
package require openlane; # provides the utils as well
2626

2727
proc run_placement_step {args} {
@@ -376,23 +376,23 @@ set flags {-interactive -it -drc -lvs -synth_explore -run_hooks}
376376

377377
parse_key_args "flow.tcl" argv arg_values $options flags_map $flags -no_consume
378378

379-
if {[catch {exec cat $::env(OPENLANE_ROOT)/install/installed_version} ::env(OPENLANE_VERSION)]} {
380-
if {[catch {exec cat /git_version} ::env(OPENLANE_VERSION)]} {
381-
if {[catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_VERSION)]} {
382-
set ::env(OPENLANE_VERSION) "UNKNOWN"
379+
if {[catch {exec cat $::env(OPENLANE_ROOT)/install/installed_version} ::env(OPENLANE_COMMIT)]} {
380+
if {[catch {exec cat /git_version} ::env(OPENLANE_COMMIT)]} {
381+
if {[catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_COMMIT)]} {
382+
set ::env(OPENLANE_COMMIT) "UNKNOWN"
383383
}
384384
}
385385
}
386386

387387
if { [file isdirectory $::env(OPENLANE_ROOT)/.git] } {
388388
if {![catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)]} {
389-
if { $::env(OPENLANE_VERSION) == $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)} {
389+
if { $::env(OPENLANE_COMMIT) == $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)} {
390390
unset ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)
391391
}
392392
}
393393
}
394394

395-
puts "OpenLane $::env(OPENLANE_VERSION)"
395+
puts "OpenLane v[package version openlane] ($::env(OPENLANE_COMMIT))"
396396
if { [info exists ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)] } {
397397
puts "(with mounted scripts from $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION))"
398398
}

scripts/openlane-1.0.0.tm

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2024 Efabless Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
set scripts_dir [ file dirname [ file normalize [ info script ] ] ]
15+
foreach file [glob "$scripts_dir/tcl_commands/*.tcl"] {
16+
source $file
17+
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 Efabless Corporation
1+
# Copyright 2024 Efabless Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -11,5 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
15-
pkg_mkIndex .
14+
set scripts_dir [ file dirname [ file normalize [ info script ] ] ]
15+
foreach file [glob "$scripts_dir/utils/*.tcl"] {
16+
source $file
17+
}

0 commit comments

Comments
 (0)