Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
50 changes: 37 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,52 @@ on:
pull_request:

jobs:
install:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Lint
- name: Build Burn
run: |
sh -n install.sh
shellcheck install.sh
- name: Install from source
run: sh install.sh --from-source --no-modify-path --prefix "$RUNNER_TEMP/burn"
- name: Use the toolchain
git clone --depth 1 https://github.com/burnlang/burn "$RUNNER_TEMP/burn"
cargo build --release --manifest-path "$RUNNER_TEMP/burn/Cargo.toml"
mkdir -p "$RUNNER_TEMP/tools"
for tool in burn burni burnc; do ln -sf "$RUNNER_TEMP/burn/target/release/burn" "$RUNNER_TEMP/tools/$tool"; done
echo "$RUNNER_TEMP/tools" >> "$GITHUB_PATH"
- name: Lint
run: shellcheck install.sh tests/e2e.sh
- run: burn fmt --check src/*.bn tests/*.bn
- run: burn check
- run: burn run tests/main.bn
- run: burn build
- name: End-to-end tests
run: BURNUP_BIN="$PWD/build/burnup" sh tests/e2e.sh
- name: End-to-end tests on the interpreter
run: sh tests/e2e.sh

bootstrap:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install from source with install.sh
env:
BURNUP_REPO: ${{ github.workspace }}
BURNUP_REF: ${{ github.sha }}
BURN_HOME: ${{ runner.temp }}/burn-home
run: sh install.sh --from-source --no-modify-path
- name: Use it
env:
BURN_HOME: ${{ runner.temp }}/burn-home
run: |
export PATH="$RUNNER_TEMP/burn/bin:$PATH" BURN_HOME="$RUNNER_TEMP/burn"
export PATH="$BURN_HOME/bin:$PATH"
burnup show
burnup list
burn version
cd "$RUNNER_TEMP"
ash init github.com/ci/hello
cd hello
ash build
./build/hello
ash install
- name: Uninstall
run: |
"$RUNNER_TEMP/burn/bin/burnup" uninstall --prefix "$RUNNER_TEMP/burn"
test ! -e "$RUNNER_TEMP/burn"
burnup self uninstall
test ! -e "$BURN_HOME"
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
push:
tags: ["v*"]

permissions:
contents: write

jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
asset: burnup-linux-x86_64
- os: macos-15-intel
asset: burnup-macos-x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Build Burn
run: |
git clone --depth 1 https://github.com/burnlang/burn "$RUNNER_TEMP/burn"
cargo build --release --manifest-path "$RUNNER_TEMP/burn/Cargo.toml"
- name: Build burnup
run: |
"$RUNNER_TEMP/burn/target/release/burn" build --target native -o "${{ matrix.asset }}"
"./${{ matrix.asset }}" version
- uses: softprops/action-gh-release@v2
with:
files: ${{ matrix.asset }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
106 changes: 73 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,102 @@

# burnup

burnup installs, updates and uninstalls the [Burn](https://github.com/burnlang/burn) toolchain.
burnup installs [Burn](https://github.com/burnlang/burn), keeps it up to date and switches between versions. It is
written in Burn.

```sh
curl -fsSL https://raw.githubusercontent.com/burnlang/burnup/master/install.sh | sh
```

This puts everything into `~/.burn/bin` and adds it to your `PATH`:
This installs burnup, the newest Burn and [ash](https://github.com/burnlang/ash), the package manager, into
`~/.burn` and adds `~/.burn/bin` to your `PATH`.

| Command | What it is |
| --- | --- |
| `burn` | the all-in-one driver: run, build, check, fmt, init, repl, lsp |
| `burni` | the interpreter and REPL |
| `burnc` | the compiler: native executables, JavaScript and bvm bytecode |
| `burnfmt` | the code formatter |
| `burn-lsp` | the language server |
| `bvm` | the Burn virtual machine |
| `ash` | the [package manager](https://github.com/burnlang/ash) |
| `burnup` | this installer |
## Versions

```sh
burnup install 26.1 # a release (26.1 means the newest 26.1.x)
burnup install master # the newest commit, built from source
burnup default 26.1 # use it everywhere
burnup list # installed versions
burnup list --remote # versions that can be installed
burnup update # rebuild branch versions that moved, and update ash
burnup uninstall master
```

A version is a release (`26.1`, `v26.1.0`, `^26.1`), `latest`, a branch such as `master`, or a commit. Releases
are downloaded prebuilt; branches and commits are built from source, which needs Rust.

## Projects

A project can ask for a Burn version in `burn.toml`:

```toml
[package]
name = "github.com/you/app"
burn = "26.1"
```

## Usage
or with a `.burn-version` file in any folder. `burnup pin 26.1` writes one or the other. Inside that folder,
`burn`, `burni`, `burnc` and the other tools run that version, and burnup installs it the first time it is needed.

```sh
burnup update # the newest Burn, ash and burnup
burnup show # installed versions
burnup uninstall # remove Burn, downloaded packages and installed commands
burnup help
burnup show # which version runs here, and why
burnup which burnc # the file that runs
burnup run master burn check # one command with another version
BURN_TOOLCHAIN=26.1 burn run # or choose with an environment variable
```

A prebuilt release is used when one exists for your platform; otherwise Burn is built from source, which needs
`git` and Rust 1.85 or newer (`--install-rust` installs Rust with rustup). ash is built from its Burn source with
the freshly installed compiler. Native executables need a C toolchain (`cc`).
The version is chosen in this order: `BURN_TOOLCHAIN`, then the nearest `burn.toml` with a `burn` key or
`.burn-version`, then the default.

## How it works

```text
~/.burn/
├── bin/ burn, burni, burnc, burnfmt, burn-lsp, bvm: small shims that run the active version
│ ├── ash
│ └── burnup
├── toolchains/
│ ├── v26.1.0/ one folder per version
│ └── master/
├── burnup.toml the default version
├── packages/ packages downloaded by ash
└── env adds bin/ to PATH
```

The shims ask burnup which version to use, which adds a few milliseconds to each command. `burnup link dev
~/burn/dist/burn` adds a local build (for example from `sh scripts/package.sh` in a Burn checkout) as the version
`dev`.

## Setup

| Command | What it does |
| --- | --- |
| `burnup ash` | install or update ash |
| `burnup self update` | update burnup itself |
| `burnup self uninstall` | remove Burn, burnup, ash, downloaded packages and the `PATH` lines |

## Options
Installer options, passed with `sh -s --`:

| Option | Description |
| --- | --- |
| `--prefix <dir>` | install into `<dir>` instead of `~/.burn` |
| `--ref <ref>` | build a specific branch, tag or commit of Burn |
| `--ash-ref <ref>` | build a specific branch, tag or commit of ash |
| `--from-source` | always build from source |
| `--install-rust` | install Rust with rustup when `cargo` is missing |
| `--toolchain <version>` | the Burn version to install first |
| `--from-source` | build Burn and burnup from source |
| `--install-rust` | install Rust with rustup when a source build needs it |
| `--no-ash` | do not install ash |
| `--no-modify-path` | do not touch your shell profile |
| `-q`, `--quiet` | only print errors |

Pass options to the piped script with `sh -s --`:
The installer downloads a prebuilt burnup when there is one for your platform. Otherwise it builds Burn once from
source and compiles burnup with it.

## Development

```sh
curl -fsSL https://raw.githubusercontent.com/burnlang/burnup/master/install.sh | sh -s -- --prefix /opt/burn
burn run tests/main.bn # unit tests
BURNUP_BIN=build/burnup sh tests/e2e.sh # end-to-end tests with local releases
```

Environment variables: `BURN_HOME` (the prefix), `BURN_REPO` and `BURN_REF`, `ASH_REPO` and `ASH_REF`.

`burnup uninstall` deletes the whole prefix only when burnup created it; otherwise it removes just the files it
installed. It also removes the lines it added to your shell profiles.

## License

[GNU General Public License v3.0](LICENSE)
13 changes: 13 additions & 0 deletions burn.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "github.com/burnlang/burnup"
version = "0.2.0"
kind = "app"
target = "native"
main = "src/main.bn"
description = "Installs and switches Burn versions"

[dependencies]

[scripts]
dev = "burni src/main.bn"
test = "burni tests/main.bn && sh tests/e2e.sh"
Loading
Loading