Skip to content

Commit

Permalink
Change Versioning Strategy (#2153)
Browse files Browse the repository at this point in the history
~ 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
  • Loading branch information
donn authored Sep 22, 2024
1 parent 1aee096 commit 6d20d41
Show file tree
Hide file tree
Showing 28 changed files with 68 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .github/actions/docker_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ runs:
run: docker save -o /tmp/image-${{ inputs.arch }}.tar ${{ env.OPENLANE_IMAGE_NAME }}-${{ inputs.arch }}

- name: Upload Docker Image
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: docker-image-${{ inputs.arch }}
path: /tmp/image-${{ inputs.arch }}.tar
46 changes: 14 additions & 32 deletions .github/scripts/generate_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,25 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import datetime
import subprocess
import os
import re
from gh import gh

new_tag = "NO_NEW_TAG"

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

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

latest_tag = None
latest_tag_commit = None
commits_with_tags = gh.openlane.tags
tags = [tag for _, tag in commits_with_tags]
for tag in commits_with_tags:
commit, name = tag
latest_tag = name
latest_tag_commit = commit

commit_count = int(
subprocess.check_output(
["git", "rev-list", "--count", "%s..%s" % (latest_tag_commit, "HEAD")]
)
)

if commit_count == 0:
print("No new commits. A tag will not be created.")
else:
now = datetime.datetime.now()

time = now.strftime("%Y.%m.%d")
new_tag = time
release_counter = 0
while new_tag in tags:
release_counter += 1
new_tag = f"{time}r{release_counter}"

print("Naming new tag %s." % new_tag)
for file in os.listdir("scripts"):
match = openlane_tm_rx.match(file)
if match is not None:
tag = match[1]
if tag not in tags:
new_tag = tag
print("Naming new tag %s." % new_tag)
else:
print("No new tag found.")
break

gh.export_env("NEW_TAG", new_tag)
2 changes: 2 additions & 0 deletions .github/scripts/variables_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
OPENLANE_MOUNTED_SCRIPTS_VERSION
OPENLANE_ROOT
OPENLANE_VERSION
OPENLANE_COMMIT
OPENROAD_BIN
PACKAGED_SCRIPT_0
PDKPATH
Expand Down Expand Up @@ -98,6 +99,7 @@
TERM
TERMINAL_OUTPUT
TMP_DIR
TCL8_5_TM_PATH
TRACKS_INFO_FILE_PROCESSED
VCHECK_OUTPUT
VDD_NET
Expand Down
38 changes: 17 additions & 21 deletions .github/workflows/openlane_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
matrix:
pdk: [sky130A, gf180mcuC]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up environment variables
uses: ./.github/actions/set_env_variables
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
tar -cf /tmp/${{ matrix.pdk }}.tar -C $PDK_ROOT/${{ matrix.pdk }} .
- name: Upload PDK Tarball
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pdk-tarball-${{ matrix.pdk }}
path: /tmp/${{ matrix.pdk }}.tar
Expand All @@ -64,7 +64,7 @@ jobs:
design_matrix: ${{ steps.set-matrix.outputs.design_matrix }}
issue_regression_matrix: ${{ steps.set-matrix.outputs.issue_regression_matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Python Dependencies
Expand All @@ -88,7 +88,7 @@ jobs:
name: Docker Build (amd64)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
uses: ./.github/actions/docker_build
with:
Expand All @@ -100,7 +100,7 @@ jobs:
name: Docker Build (arm64v8)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
uses: ./.github/actions/docker_build
with:
Expand All @@ -116,13 +116,13 @@ jobs:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare_test_matrices.outputs.issue_regression_matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

- name: Download Docker Image
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: docker-image-amd64
path: /tmp
Expand All @@ -131,7 +131,7 @@ jobs:
run: docker load --input /tmp/image-amd64.tar

- name: Download PDK Tarball
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: pdk-tarball-sky130A
path: /tmp
Expand All @@ -150,7 +150,7 @@ jobs:

- name: Upload Logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_${{ matrix.test }}_logs
path: ./test_logs
Expand All @@ -164,15 +164,15 @@ jobs:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare_test_matrices.outputs.design_matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

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

- name: Download Docker Image (amd64)
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: docker-image-amd64
path: /tmp
Expand All @@ -181,7 +181,7 @@ jobs:
run: docker load --input /tmp/image-amd64.tar

- name: Download PDK Tarball
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: pdk-tarball-${{ matrix.design.pdk }}
path: /tmp
Expand Down Expand Up @@ -216,7 +216,7 @@ jobs:
- name: Upload Run Tarball
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.ESCAPED_DESIGN_NAME }}-${{ matrix.design.pdk }}
path: ./reproducible.tar.gz
Expand All @@ -236,21 +236,21 @@ jobs:
export PUSHING=$(ruby -e 'if ("${{ github.event_name }}" != "pull_request" && "${{ secrets.DOCKERHUB_USER }}" != ""); print(1) else print(0) end')
echo "PUSHING=$PUSHING" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Download Docker Image (amd64)
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: docker-image-amd64
path: /tmp

- name: Download Docker Image (arm64v8)
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: docker-image-arm64v8
path: /tmp
Expand All @@ -270,10 +270,6 @@ jobs:
with:
name: pdk-tarball

- name: Write Main Branch
run: |
echo "MAIN_BRANCH=${{ vars.MAIN_BRANCH }}" >> $GITHUB_ENV
- name: Write Hash
run: |
echo "GIT_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
Expand All @@ -286,7 +282,7 @@ jobs:
done
- name: Create Tag (If scheduled or dispatched)
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && env.BRANCH_NAME == env.MAIN_BRANCH }}
if: ${{ env.PUSHING == '1' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && (env.BRANCH_NAME == vars.MAIN_BRANCH || env.BRANCH_NAME == 'superstable') }}
run: cd ${GITHUB_WORKSPACE}/ && python3 ${GITHUB_WORKSPACE}/.github/scripts/generate_tag.py

- name: Tag Commit (If scheduled or dispatched)
Expand Down
1 change: 1 addition & 0 deletions docker/openlane/Dockerfile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ FROM ${RUN_BASE_IMAGE}
ENV OPENLANE_ROOT=/openlane
ENV OPENROAD_BIN openroad

ENV TCL8_5_TM_PATH=${OPENLANE_ROOT}/scripts
ENV OPENROAD=/build/
ENV PATH=$OPENLANE_ROOT:$OPENLANE_ROOT/scripts:$OPENROAD/bin:$OPENROAD/bin/Linux-x86_64:$OPENROAD/pdn/scripts:$PATH
ENV LD_LIBRARY_PATH=$OPENROAD/lib:$OPENROAD/lib/Linux-x86_64:$LD_LIBRARY_PATH
Expand Down
2 changes: 1 addition & 1 deletion docs/source/getting_started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ This is a typical structure for a design folder:
│   ├── config.json
│   ├── logs
│   ├── openlane.log
│   ├── OPENLANE_VERSION
│   ├── OPENLANE_COMMIT
│   ├── PDK_SOURCES
│   ├── reports
│   ├── results
Expand Down
2 changes: 1 addition & 1 deletion docs/source/reference/openlane_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This page describes the list of commands available in OpenLane, their functional

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

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

## General Commands

Expand Down
14 changes: 7 additions & 7 deletions flow.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if { [file exists $::env(OPENLANE_ROOT)/install/env.tcl ] } {
if { ! [info exists ::env(OPENROAD_BIN) ] } {
set ::env(OPENROAD_BIN) openroad
}
lappend ::auto_path "$::env(OPENLANE_ROOT)/scripts/"
set ::env(TCL8_5_TM_PATH) "$::env(OPENLANE_ROOT)/scripts:$::env(TCL8_5_TM_PATH)"
package require openlane; # provides the utils as well

proc run_placement_step {args} {
Expand Down Expand Up @@ -376,23 +376,23 @@ set flags {-interactive -it -drc -lvs -synth_explore -run_hooks}

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

if {[catch {exec cat $::env(OPENLANE_ROOT)/install/installed_version} ::env(OPENLANE_VERSION)]} {
if {[catch {exec cat /git_version} ::env(OPENLANE_VERSION)]} {
if {[catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_VERSION)]} {
set ::env(OPENLANE_VERSION) "UNKNOWN"
if {[catch {exec cat $::env(OPENLANE_ROOT)/install/installed_version} ::env(OPENLANE_COMMIT)]} {
if {[catch {exec cat /git_version} ::env(OPENLANE_COMMIT)]} {
if {[catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_COMMIT)]} {
set ::env(OPENLANE_COMMIT) "UNKNOWN"
}
}
}

if { [file isdirectory $::env(OPENLANE_ROOT)/.git] } {
if {![catch {exec git --git-dir $::env(OPENLANE_ROOT)/.git rev-parse HEAD} ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)]} {
if { $::env(OPENLANE_VERSION) == $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)} {
if { $::env(OPENLANE_COMMIT) == $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)} {
unset ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)
}
}
}

puts "OpenLane $::env(OPENLANE_VERSION)"
puts "OpenLane v[package version openlane] ($::env(OPENLANE_COMMIT))"
if { [info exists ::env(OPENLANE_MOUNTED_SCRIPTS_VERSION)] } {
puts "(with mounted scripts from $::env(OPENLANE_MOUNTED_SCRIPTS_VERSION))"
}
Expand Down
17 changes: 17 additions & 0 deletions scripts/openlane-1.0.0.tm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set scripts_dir [ file dirname [ file normalize [ info script ] ] ]
foreach file [glob "$scripts_dir/tcl_commands/*.tcl"] {
source $file
}
8 changes: 5 additions & 3 deletions scripts/tcl_commands/refresh.tcl → scripts/openlane_utils-1.0.0.tm
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Efabless Corporation
# Copyright 2024 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -11,5 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

pkg_mkIndex .
set scripts_dir [ file dirname [ file normalize [ info script ] ] ]
foreach file [glob "$scripts_dir/utils/*.tcl"] {
source $file
}
6 changes: 2 additions & 4 deletions scripts/tcl_commands/all.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,8 @@ proc prep {args} {
file copy -force $::env(PDK_ROOT)/$::env(PDK)/SOURCES $::env(RUN_DIR)/PDK_SOURCES
}

if { [info exists ::env(OPENLANE_VERSION) ] } {
try_exec echo "OpenLane $::env(OPENLANE_VERSION)" > $::env(RUN_DIR)/OPENLANE_VERSION
if { [info exists ::env(OPENLANE_COMMIT) ] } {
try_exec echo "OpenLane $::env(OPENLANE_COMMIT)" > $::env(RUN_DIR)/OPENLANE_COMMIT
}

if { [info exists ::env(EXTRA_GDS_FILES)] } {
Expand Down Expand Up @@ -1318,5 +1318,3 @@ proc run_post_run_hooks {} {
puts_verbose "No post-run hook found, skipping..."
}
}

package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/checkers.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -376,5 +376,3 @@ proc quit_on_unconnected_pdn_nodes {args} {
throw_error
}
}

package provide openlane 0.9
3 changes: 0 additions & 3 deletions scripts/tcl_commands/cts.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,3 @@ proc run_resizer_timing {args} {
puts_info "Skipping Placement Resizer Timing Optimizations."
}
}


package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/cvc_rv.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,3 @@ proc run_erc {args} {
proc run_lef_cvc {args} {
handle_deprecated_command run_erc
}

package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/floorplan.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -507,5 +507,3 @@ proc run_floorplan {args} {

run_power_grid_generation
}

package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/init_design.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,3 @@ if { \[file exists \$filename\] == 1} {

puts_info "Finished populating:\n$config_path \nPlease modify CLOCK_PORT, CLOCK_PERIOD and add your advanced settings to $config_path"
}

package provide openlane 0.9
2 changes: 0 additions & 2 deletions scripts/tcl_commands/klayout.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,3 @@ proc open_in_klayout {args} {
--lym $::env(KLAYOUT_DEF_LAYER_MAP)\
$arg_values(-layout)
}

package provide openlane 0.9
Loading

0 comments on commit 6d20d41

Please sign in to comment.