Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for bzlmod #27

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

name: CI

on:
pull_request:
branches: ["*"]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y $(find . -name apt-requirements.txt | xargs sed -e "s/#.*//g")
jwnrt marked this conversation as resolved.
Show resolved Hide resolved
- name: Build firmware
run: |
bazel build :hyperdebug-firmware

26 changes: 16 additions & 10 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

name: Create Release

on:
workflow_dispatch:
inputs:
Expand All @@ -8,25 +13,26 @@ on:

jobs:
release:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y $(find . -name apt-requirements.txt | xargs sed -e "s/#.*//g")
- name: Build
- name: Create tag
run: |
git tag ${{ inputs.release_tag }}
bazel build --stamp :release
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't necessarily have a strong opinion but I can see an advantage to using bazel-release in theory: the release process is part of the build and can be done locally easily. Github/Azure flows are always notorioulsy bad for local reproducibility as they get more complicated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense.

I have this PR for adding bzlmod support to bazel-release: lowRISC/bazel-release#5

If that's merged, we could go back to using it.

- name: Test
git tag "${{ inputs.release_tag }}"
git push origin tag "${{ inputs.release_tag }}"
- name: Build firmware
run: |
echo "No tests to run"
# bazel test //...
bazel build --stamp :hyperdebug-firmware
- name: Publish Release
env:
GH_TOKEN: ${{ github.token }}
run: |
bazel run :release -- ${{ inputs.release_tag }}
gh release create "${{ inputs.release_tag }}" \
--title "${{ inputs.release_tag }}"
gh release upload "${{ inputs.release_tag }}" \
"$(bazel cquery --output=files :hyperdebug-firmware)"
8 changes: 0 additions & 8 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

package(default_visibility = ["//visibility:public"])

load("@lowrisc_bazel_release//release:release.bzl", "release")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

genrule(
Expand All @@ -23,10 +22,3 @@ pkg_tar(
extension = "tar.gz",
package_dir = "hyperdebug",
)

release(
name = "release",
artifacts = {
":hyperdebug-firmware": "Hyperdebug Firmware",
},
)
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,3 @@ patterned after the build date: `YYYYMMDD_RR`, where:
- `MM` is the month.
- `DD` is the day.
- `RR` is the number of the release on that date, starting at `01`.

To perform a manual release of the firmware, issue the following command:

```
RELEASE_TAG="YYYYMMDD_RR"
bazel run :release -- ${RELEASE_TAG}
```

This will build the firmware archive, create a git tag and publish the
release artifacts to github.
5 changes: 0 additions & 5 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ bazel_repos()
load("//third_party/bazel:deps.bzl", "bazel_deps")
bazel_deps()

load("//third_party/lowrisc:repos.bzl", "lowrisc_repos")
lowrisc_repos()
load("//third_party/lowrisc:deps.bzl", "lowrisc_deps")
lowrisc_deps()

load("//third_party/chromium:repos.bzl", "chromium_repos")
chromium_repos()
load("//third_party/chromium:deps.bzl", "chromium_deps")
Expand Down
5 changes: 0 additions & 5 deletions third_party/lowrisc/BUILD.bazel

This file was deleted.

10 changes: 0 additions & 10 deletions third_party/lowrisc/deps.bzl

This file was deleted.

15 changes: 0 additions & 15 deletions third_party/lowrisc/repos.bzl

This file was deleted.