Skip to content

Commit 9ea1d1e

Browse files
committed
rules_verilog 0.0.1
1 parent 8c84868 commit 9ea1d1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2623
-1
lines changed

.bazelrc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
###############################################################################
2+
## Bazel Configuration Flags
3+
##
4+
## `.bazelrc` is a Bazel configuration file.
5+
## https://bazel.build/docs/best-practices#bazelrc-file
6+
###############################################################################
7+
8+
# https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config
9+
common --enable_platform_specific_config
10+
11+
# Enable the only currently supported report type
12+
# https://bazel.build/reference/command-line-reference#flag--combined_report
13+
coverage --combined_report=lcov
14+
15+
# Avoid fully cached builds reporting no coverage and failing CI
16+
# https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs
17+
coverage --experimental_fetch_all_coverage_outputs
18+
19+
# https://github.com/bazelbuild/bazel/issues/8195
20+
build --incompatible_disallow_empty_glob=true
21+
22+
# https://github.com/bazelbuild/bazel/issues/12821
23+
build --nolegacy_external_runfiles
24+
25+
# Disable legacy __init__.py behavior which is known to conflict with
26+
# modern python versions (3.9+)
27+
build --incompatible_default_to_explicit_init_py
28+
29+
# https://github.com/bazelbuild/bazel/issues/23043.
30+
build --incompatible_autoload_externally=
31+
32+
###############################################################################
33+
## Configuration Flags
34+
###############################################################################
35+
36+
# Enable black for all targets in the workspace
37+
build:verilator_lint --aspects=//verilator:verilator_lint_aspect.bzl%verilator_lint_aspect
38+
build:verilator_lint --output_groups=+verilator_lint_checks
39+
40+
test --config=verilator_lint
41+
42+
###############################################################################
43+
## Custom user flags
44+
##
45+
## This should always be the last thing in the `.bazelrc` file to ensure
46+
## consistent behavior when setting flags in that file as `.bazelrc` files are
47+
## evaluated top to bottom.
48+
###############################################################################
49+
50+
try-import %workspace%/user.bazelrc

.clang-format

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
BasedOnStyle: Google
3+
IndentWidth: 4
4+
...

.github/github.bazelrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Bazel settings for use in Github CI
2+
3+
# Always display the flags being used
4+
common --announce_rc
5+
6+
# Show errors in CI
7+
test --test_output=errors
8+
9+
# Show more information about failures
10+
build --verbose_failures
11+
12+
# UI for cleaner CI output
13+
common --color=no
14+
common --show_timestamps

.github/release_notes.template

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# {version}
2+
3+
## Setup
4+
```python
5+
bazel_dep(name = "rules_verilog", version = "{version}")
6+
```
7+
8+
Additional documentation can be found at: https://github.com/periareon/rules_verilog

.github/workflows/ci.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
merge_group:
8+
pull_request:
9+
types:
10+
- opened
11+
- synchronize
12+
13+
env:
14+
BAZEL_STARTUP_FLAGS: --bazelrc=${{ github.workspace }}/.github/github.bazelrc
15+
16+
jobs:
17+
ci:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- os: macos-latest
24+
- os: ubuntu-24.04
25+
# - os: windows-2022
26+
steps:
27+
# Checkout the code
28+
- uses: actions/checkout@v4
29+
- uses: bazel-contrib/setup-bazel@0.14.0
30+
with:
31+
bazelisk-cache: true
32+
disk-cache: ${{ github.workflow }}
33+
repository-cache: true
34+
35+
- name: Setup Bazelrc (Windows)
36+
run: |
37+
echo "TEMP=$env:RUNNER_TEMP" >> "$env:GITHUB_ENV"
38+
echo "TMP=$env:RUNNER_TEMP" >> "$env:GITHUB_ENV"
39+
echo "startup --output_user_root=D:/bzl" > ./user.bazelrc
40+
if: startswith(runner.os, 'Windows')
41+
- name: Setup Bazelrc
42+
run: |
43+
echo "common --keep_going" >> ./user.bazelrc
44+
45+
# Build and Test the code
46+
- name: Test (Unix)
47+
run: bazel ${BAZEL_STARTUP_FLAGS[@]} test //...
48+
if: startswith(runner.os, 'Windows') != true
49+
- name: Test (Windows)
50+
run: bazel $env:BAZEL_STARTUP_FLAGS test //...
51+
if: startswith(runner.os, 'Windows')
52+
53+
ci-format:
54+
runs-on: ubuntu-24.04
55+
steps:
56+
# Checkout the code
57+
- uses: actions/checkout@v4
58+
- uses: bazel-contrib/setup-bazel@0.14.0
59+
with:
60+
bazelisk-cache: true
61+
disk-cache: ${{ github.workflow }}
62+
repository-cache: true
63+
64+
- uses: DoozyX/clang-format-lint-action@v0.14
65+
with:
66+
source: "."
67+
extensions: "h,c,cc"
68+
clangFormatVersion: 14
69+
70+
- name: Buildifier
71+
run: |
72+
wget "https://github.com/bazelbuild/buildtools/releases/download/v${BUILDIFIER_VERSION}/buildifier-linux-amd64" -O buildifier
73+
chmod +x ./buildifier
74+
./buildifier -lint=warn -mode=check -warnings=all -r ${{ github.workspace }}
75+
rm ./buildifier
76+
env:
77+
BUILDIFIER_VERSION: 8.2.0
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
3+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
4+
5+
name: compile_requirements
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
target:
11+
description: "The py_reqs_compiler target to run"
12+
default: "//python/3rdparty:requirements.update"
13+
14+
jobs:
15+
build:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- os: linux_x86_64
21+
runs-on: ubuntu-latest
22+
- os: linux_aarch64
23+
runs-on: ubuntu-24.04-arm
24+
- os: macos_aarch64
25+
runs-on: macos-latest
26+
- os: windows_x86_64
27+
runs-on: windows-latest
28+
29+
runs-on: ${{ matrix.runs-on }}
30+
name: ${{ matrix.os }}
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Compile requirements
34+
if: runner.os == 'Windows'
35+
run: |
36+
bazel run "$env:TARGET" "--" "--upgrade" "--verbose"
37+
env:
38+
TARGET: ${{ github.event.inputs.target }}
39+
- name: Compile requirements
40+
if: runner.os != 'Windows'
41+
run: |
42+
bazel run "${TARGET}" "--" "--upgrade" "--verbose"
43+
env:
44+
TARGET: ${{ github.event.inputs.target }}
45+
- name: Display results
46+
shell: bash
47+
run: |
48+
set -e
49+
echo "<details>" >> "${GITHUB_STEP_SUMMARY}"
50+
echo "" >> "${GITHUB_STEP_SUMMARY}"
51+
echo '```' >> "${GITHUB_STEP_SUMMARY}"
52+
cat "python/3rdparty/requirements_${{ matrix.os }}.txt" >> "${GITHUB_STEP_SUMMARY}"
53+
echo '```' >> "${GITHUB_STEP_SUMMARY}"
54+
echo "" >> "${GITHUB_STEP_SUMMARY}"
55+
echo "</details>" >> "${GITHUB_STEP_SUMMARY}"

.github/workflows/docs.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
docs:
10+
name: Docs
11+
permissions:
12+
contents: write
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@master
16+
- name: Run tests
17+
run: bazel run --compilation_mode=opt --stamp //docs:publish_book
18+
- name: Deploy to GitHub Pages
19+
uses: JamesIves/github-pages-deploy-action@4.1.7
20+
with:
21+
branch: gh-pages # The branch the action should deploy to.
22+
folder: docs/book # The folder the action should deploy.

.github/workflows/release.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# ---
2+
# name: Release
3+
# on:
4+
# workflow_dispatch:
5+
# push:
6+
# branches:
7+
# - main
8+
# paths:
9+
# # Only trigger for new releases
10+
# - "version.bzl"
11+
12+
# defaults:
13+
# run:
14+
# shell: bash
15+
16+
# env:
17+
# BAZEL_STARTUP_FLAGS: --bazelrc=${{ github.workspace }}/.github/github.bazelrc
18+
19+
# jobs:
20+
# release:
21+
# if: ${{ github.repository_owner == 'periareon' }}
22+
# permissions:
23+
# contents: write
24+
# actions: write
25+
# attestations: write
26+
# runs-on: ubuntu-latest
27+
# steps:
28+
# - uses: actions/checkout@v2
29+
# with:
30+
# ref: main
31+
# - name: Detect the current version
32+
# run: |
33+
# version="$(grep 'VERSION =' ./version.bzl | sed 's/VERSION = "//' | sed 's/"//')"
34+
# echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV
35+
# # Ensure this does not exclude the module used for the .bcr presubmit job.
36+
# - name: Create release artifact
37+
# run: |
38+
# tar -czf ${{ github.workspace }}/.github/rules_verilog.tar.gz --exclude=".git" --exclude=".github" -C ${{ github.workspace }} .
39+
# sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_verilog.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)"
40+
# echo "ARCHIVE_SHA256_BASE64=${sha256_base64}" >> "${GITHUB_ENV}"
41+
# - name: Generate release notes
42+
# run: |
43+
# # Generate the release notes
44+
# sed 's/{version}/${{env.RELEASE_VERSION}}/g' ${{ github.workspace }}/.github/release_notes.template \
45+
# | sed 's#{sha256_base64}#${{ env.ARCHIVE_SHA256_BASE64 }}#g' \
46+
# > ${{ github.workspace }}/.github/release_notes.txt
47+
# - name: Release
48+
# uses: softprops/action-gh-release@v1
49+
# id: rules_release
50+
# with:
51+
# generate_release_notes: true
52+
# tag_name: ${{ env.RELEASE_VERSION }}
53+
# body_path: ${{ github.workspace }}/.github/release_notes.txt
54+
# target_commitish: ${{ github.base_ref }}
55+
# - name: "Upload the rules archive"
56+
# uses: actions/upload-release-asset@v1
57+
# env:
58+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
# with:
60+
# upload_url: ${{ steps.rules_release.outputs.upload_url }}
61+
# asset_name: rules_verilog-${{ env.RELEASE_VERSION }}.tar.gz
62+
# asset_path: ${{ github.workspace }}/.github/rules_verilog.tar.gz
63+
# asset_content_type: application/gzip

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Git Ignore patterns
2+
3+
/.vscode
4+
/bazel-*
5+
user.bazelrc

BUILD.bazel

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
exports_files([
2+
"MODULE.bazel",
3+
"version.bzl",
4+
])

0 commit comments

Comments
 (0)