Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
32 changes: 30 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ on:
- main

jobs:
test-setup-brioche:
smoke-test-setup-brioche:
strategy:
fail-fast: false
matrix:
runs-on:
- ubuntu-22.04
Expand All @@ -23,7 +24,8 @@ jobs:
- name: Setup Brioche
uses: ./ # Uses an action in the root directory

- name: Verify Brioche installation
- &verify-brioche
name: Verify Brioche installation
run: |
brioche --version
brioche install -r hello_world
Expand All @@ -32,3 +34,29 @@ jobs:
WATERMARK="$(date -uIs)"
sed -i "s/\${WATERMARK}/${WATERMARK}/g" example-project/project.bri
brioche build -p example-project -o output

test-setup-brioche:
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
channel: stable
- runs-on: ubuntu-latest
channel: nightly
- runs-on: ubuntu-latest-arm
channel: stable
- runs-on: ubuntu-latest-arm
channel: nightly
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- runs-on: ubuntu-latest
channel: stable
- runs-on: ubuntu-latest
channel: nightly
- runs-on: ubuntu-latest-arm
channel: stable
- runs-on: ubuntu-latest-arm
channel: nightly
- runs-on: ubuntu-24.04
channel: stable
- runs-on: ubuntu-24.04
channel: nightly
- runs-on: ubuntu-24.04-arm
channel: stable
- runs-on: ubuntu-24.04-arm
channel: nightly

Just found out that GitHub Actions doesn't seem to support ubuntu-latest-arm (and they don't plan to add it). I think that's kinda annoying... so it seems sensible to just use a specific Ubuntu version for each of these jobs (we could keep using ubuntu-latest but to keep it symmetric I'd lean towards keeping all of them pinned together)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I updated it in c4060fa. And I took the opportunity to re-add ubuntu-latest in the matrix of the smoke test

runs-on: ${{ matrix.runs-on }}
continue-on-error: ${{ matrix.runs-on == 'ubuntu-latest-arm' && matrix.channel == 'stable' }} # Brioche stable does not support ARM architecture
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Setup Brioche
uses: ./ # Uses an action in the root directory
with:
channel: ${{ matrix.channel }}

- *verify-brioche
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Brioche
uses: brioche-dev/setup-brioche@v1
with:
version: 'v0.1.5' # Optional, specify a version or use the default (v0.1.5)
version: "v0.1.5" # Optional, specify a version or use the default (latest)
install-dir: '/custom/install/path' # Optional, specify a custom installation path

- name: Verify Brioche installation
Expand All @@ -32,7 +32,8 @@ jobs:

## Inputs

- `version`: (Optional) The version of Brioche to install. Defaults to `v0.1.5` (the latest version).
- `version`: (Optional) The version of Brioche to install. Defaults to `latest`.
- `channel`: (Optional) The channel to install from (stable or nightly).
- `install-dir`: (Optional) The directory where Brioche should be installed. Defaults to `$HOME/.local/bin`.
- `install-apparmor`: (Optional) Enable or disable installation of an AppArmor profile for Brioche. Defaults to `auto`, which will automatically install it if required (e.g. on Ubuntu 24.04).

Expand Down Expand Up @@ -65,7 +66,7 @@ jobs:
- name: Setup Brioche
uses: brioche-dev/setup-brioche@v1
# with:
# version: "v0.1.5" # Optional
# version: "latest" # Optional
Copy link
Member

Choose a reason for hiding this comment

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

Minor tweak to show the separation between version and channel in the README

Suggested change
# version: "latest" # Optional
# version: "v0.1.5" # Optional
# channel: "latest" # Optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kinda done, since it's now removed

# install-dir: "$HOME/custom/install/path" # Optional

- name: Build package
Expand All @@ -84,6 +85,7 @@ This Action uses GitHub's [logging groups](https://docs.github.com/en/actions/us
## Troubleshooting

- Ensure the version specified in the `version` input is valid and available.
- Ensure `version` is not set when `channel=nightly` is specified.
- If Brioche isn't recognized in your shell, make sure the install path is correctly set in your environment.

## License
Expand Down
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ inputs:
version:
description: "Version of Brioche to install"
required: false
default: "v0.1.5"
default: "latest"
channel:
description: "Channel of Brioche to install"
required: false
default: "stable"
install-dir:
description: "Directory where Brioche should be installed"
required: false
Expand All @@ -27,4 +31,5 @@ runs:
env:
install_dir: ${{ inputs.install-dir }}
version: ${{ inputs.version }}
channel: ${{ inputs.channel }}
install_apparmor: ${{ inputs.install-apparmor }}
43 changes: 37 additions & 6 deletions install-brioche.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

LATEST_BRIOCHE_VERSION="v0.1.5"

# Based on the official install script here:
# https://github.com/brioche-dev/brioche.dev/blob/main/public/install.sh

Expand All @@ -14,10 +16,32 @@ validate_inputs() {
echo '::error::$HOME must be set'
exit 1
fi
if [ -z "${install_dir:-}" -o -z "${version:-}" -o -z "${install_apparmor:-}" ]; then
echo '::error::$install_dir, $version, and $install_apparmor must be set'
if [ -z "${install_dir:-}" -o -z "${version:-}" -o -z "${channel:-}" -o -z "${install_apparmor:-}" ]; then
echo '::error::$install_dir, $version, $channel, and $install_apparmor must be set'
exit 1
fi

# Validate channel constraints:
# - Only values `stable`, `nightly` are allowed
# - `version` and `channel=nightly` can't be used together, except when 'version=latest'
case "$channel" in
stable)
# Ensure 'latest' is replaced with the actual latest version
if [ "$version" == "latest" ]; then
version=$LATEST_BRIOCHE_VERSION
fi
;;
nightly)
if [ "$version" != "latest" ]; then
echo "::error::version and channel=nightly can't be used together"
exit 1
fi
;;
*)
echo "::error::channel must be either 'stable' or 'nightly'"
exit 1
;;
esac
}

install_brioche() {
Expand All @@ -33,7 +57,7 @@ install_brioche() {
# Get each referenced env var, and validate each one is not empty
envsubst -v "$install_dir" | while read -r env_var; do
if [ -z "${!env_var:-}" ]; then
echo "::error:env var \$${env_var} is not set (used in \$install_dir)"
echo "::error::env var \$${env_var} is not set (used in \$install_dir)"
exit 1
fi
done
Expand All @@ -43,7 +67,7 @@ install_brioche() {

# Ensure the result is not empty
if [ -z "$install_dir" ]; then
echo '::error:$install_dir expanded to empty string'
echo '::error::$install_dir expanded to empty string'
exit 1
fi

Expand All @@ -53,13 +77,20 @@ install_brioche() {
# Get the OS and architecture-specific config, such as download URL and AppArmor config
case "$OSTYPE" in
linux*)
case "$(uname -m)" in
x86_64)
case "$(uname -m) $channel" in
"x86_64 stable")
brioche_url="https://releases.brioche.dev/$version/x86_64-linux/brioche"
;;
"x86_64 nightly")
brioche_url="https://development-content.brioche.dev/github.com/brioche-dev/brioche/branches/main/x86_64-linux/brioche"
;;
"aarch64 nightly")
brioche_url="https://development-content.brioche.dev/github.com/brioche-dev/brioche/branches/main/aarch64-linux/brioche"
;;
*)
echo "::error::Sorry, Brioche isn't currently supported on your architecture"
echo " Detected architecture: $(uname -m)"
echo " Channel: $channel"
exit 1
;;
esac
Expand Down
Loading