ci: faster #922
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: bazel-orfs | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
DOCKER_IMAGE: openroad/flow-ubuntu22.04-builder:latest | |
jobs: | |
lint: | |
name: Lint Bazel files | |
runs-on: ubuntu-22.04 | |
env: | |
DEBIAN_FRONTEND: "noninteractive" | |
steps: | |
- name: Download buildifier | |
run: | | |
wget https://github.com/bazelbuild/buildtools/releases/download/v6.4.0/buildifier-linux-amd64 -O /usr/local/bin/buildifier | |
chmod +x /usr/local/bin/buildifier | |
buildifier -version | |
- name: Checkout bazel-orfs | |
uses: actions/checkout@v4 | |
- name: Check Bazel files | |
run: | | |
buildifier -lint warn -r . | |
test-make-target: | |
name: ${{ matrix.STAGE_TARGET }} | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
STAGE_TARGET: | |
- "//sram:top_mix_cts" | |
- "tag_array_64x184_generate_abstract" | |
- "tag_array_64x184_report" | |
- "lb_32x128_generate_abstract" | |
- "lb_32x128_test_generate_abstract" | |
- "L1MetadataArray_generate_abstract" | |
- "data_2048x8_generate_abstract" | |
- "regfile_128x65_floorplan" | |
- "subpackage:L1MetadataArray_generate_abstract" | |
- "subpackage:tag_array_64x184_generate_abstract" | |
env: | |
DEBIAN_FRONTEND: "noninteractive" | |
steps: | |
- name: Checkout bazel-orfs | |
uses: actions/checkout@v4 | |
- name: query target | |
run: | | |
bazel query ${{ matrix.STAGE_TARGET }} | |
bazel query ${{ matrix.STAGE_TARGET }} --output=build | |
- name: Build report | |
if: ${{ endsWith(matrix.STAGE_TARGET, '_report') }} | |
run: | | |
bazel build --subcommands --verbose_failures --sandbox_debug ${{ matrix.STAGE_TARGET }} | |
- name: Run target | |
if: ${{ !endsWith(matrix.STAGE_TARGET, '_report') }} | |
run: | | |
if [[ ${{ matrix.STAGE_TARGET }} == "lb_32x128_generate_abstract" || ${{ matrix.STAGE_TARGET }} == *"tag_array_64x184_generate_abstract"* ]]; then | |
# this is a mock area abstract, so it is not executable | |
bazel build --subcommands --verbose_failures --sandbox_debug ${{ matrix.STAGE_TARGET }} | |
else | |
bazel run --subcommands --verbose_failures --sandbox_debug ${{ matrix.STAGE_TARGET }} -- `pwd`/build | |
fi | |
test-open-target: | |
name: open ${{ matrix.STAGE_TARGET }} | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
STAGE_TARGET: | |
- "//sram:top_mix" | |
- "tag_array_64x184" | |
- "L1MetadataArray" | |
- "subpackage:L1MetadataArray" | |
- "subpackage:tag_array_64x184" | |
env: | |
DEBIAN_FRONTEND: "noninteractive" | |
steps: | |
- name: Checkout bazel-orfs | |
uses: actions/checkout@v4 | |
- name: Run target | |
run: | | |
set -ex | |
rm -rf ./build/ | |
bazel run ${{ matrix.STAGE_TARGET }}_synth -- `pwd`/build OR_ARGS=-exit open_synth | |
if [[ "${{ matrix.STAGE_TARGET }}" == "L1MetadataArray" || "${{ matrix.STAGE_TARGET }}" == "subpackage:L1MetadataArray" || "${{ matrix.STAGE_TARGET }}" == "//sram:top_mix" ]]; then | |
macro="true" | |
fi | |
if [[ "$macro" == "true" ]]; then | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.lib' | wc -l) -eq 1 ] | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.lef' | wc -l) -eq 1 ] | |
fi | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*/1_.*\.log' | wc -l) -gt 1 ] | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*/2_.*\.log' | wc -l) -eq 0 ] | |
rm -rf ./build/ | |
bazel run ${{ matrix.STAGE_TARGET }}_floorplan -- `pwd`/build OR_ARGS=-exit open_floorplan | |
if [[ "$macro" == "true" ]]; then | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.lib' | wc -l) -eq 1 ] | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.lef' | wc -l) -eq 1 ] | |
fi | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.odb' | wc -l) -eq 1 ] | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.sdc' | wc -l) -eq 1 ] | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*\.v' | wc -l) -eq 0 ] | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*/1_.*\.log' | wc -l) -eq 0 ] | |
[ $(find build ! -regex '.*/\(objects\|external\|test\)/.*' -regex '.*/2_.*\.log' | wc -l) -gt 1 ] | |
test-builds: | |
name: Smoketests | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
env: | |
DEBIAN_FRONTEND: "noninteractive" | |
steps: | |
- name: Checkout bazel-orfs | |
uses: actions/checkout@v4 | |
- name: Smoketests | |
run: | | |
.github/scripts/smoketests.sh | |
test-target-local-clean-setup: | |
name: Local flow - clean setup | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
env: | |
DEBIAN_FRONTEND: "noninteractive" | |
steps: | |
- name: Checkout bazel-orfs | |
uses: actions/checkout@v4 | |
- name: Build local stage targets - tag_array_64x184 | |
env: | |
TARGET: tag_array_64x184 | |
run: .github/scripts/build_local_target.sh | |
- name: Build local stage targets - L1MetadataArray | |
env: | |
TARGET: L1MetadataArray | |
run: .github/scripts/build_local_target.sh | |
# FIXME switch from strings to labels to fix problems with bazel run vs. _deps environment | |
# - name: Build local stage targets - //sram:top_mix | |
# env: | |
# TARGET: //sram:top_mix | |
# run: .github/scripts/build_local_target.sh | |
generate-config: | |
name: Generate configs | |
runs-on: ubuntu-22.04 | |
outputs: | |
docker-tag: ${{ steps.docker-image.outputs.docker-orfs }} | |
steps: | |
- name: Checkout bazel-orfs | |
uses: actions/checkout@v4 | |
- name: Lint Bazel files | |
run: bazel mod tidy && git diff --exit-code | |
- name: Extract Docker tag | |
id: docker-image | |
run: | | |
revision=$(python3 .github/scripts/extract_docker_revision.py MODULE.bazel.lock) | |
echo "docker-orfs=$revision" | tee -a $GITHUB_OUTPUT | |
test-target-local-preinstalled-orfs: | |
name: Local flow - preinstalled orfs | |
runs-on: ubuntu-22.04 | |
needs: generate-config | |
container: | |
image: ${{ fromJSON(needs.generate-config.outputs.docker-tag).image }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
DEBIAN_FRONTEND: "noninteractive" | |
FLOW_HOME: /OpenROAD-flow-scripts/flow | |
steps: | |
- name: orfs setup | |
run: | | |
cd /OpenROAD-flow-scripts | |
echo "OpenROAD-flow-scripts SHA: "$(git rev-parse HEAD) | |
source ./env.sh | |
yosys --version | |
openroad -version | |
- name: Install bazelisk as bazel | |
run: | | |
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64 -O /usr/local/bin/bazel | |
chmod +x /usr/local/bin/bazel | |
- name: Checkout bazel-orfs | |
uses: actions/checkout@v4 | |
- name: Build local stage targets - tag_array_64x184 | |
env: | |
TARGET: tag_array_64x184 | |
run: .github/scripts/build_local_target.sh | |
- name: Build local stage targets - L1MetadataArray | |
env: | |
TARGET: L1MetadataArray | |
run: .github/scripts/build_local_target.sh |