Skip to content

Commit

Permalink
chore: Add debug release symbols in releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin Blackman committed Dec 3, 2023
1 parent 8ade883 commit c8bb275
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
@@ -1,5 +1,5 @@
[build]
rustflags = ["--remap-path-prefix", "$HOME=/home", "--remap-path-prefix", "$PWD=/app"]
rustflags = ["--remap-path-prefix=$HOME=/home", "--remap-path-prefix=$PWD=/app"]

[alias]
xtask = ["run", "-p", "xtask", "--"]
Expand Down
2 changes: 1 addition & 1 deletion .dprint.json
@@ -1,7 +1,7 @@
{
"indentWidth": 2,
"lineWidth": 160,
"includes": ["**/*.{md,toml,yaml,json}"],
"includes": ["**/*.{md,toml,yaml,yml,json}", ".github/*/*.yml"],
"excludes": [".bin/**", ".git/**", "target/**", "dist/**", ".cache/**"],
"plugins": [
"https://github.com/dprint/dprint-plugin-markdown/releases/download/0.14.0/plugin.wasm",
Expand Down
35 changes: 28 additions & 7 deletions .github/workflows/release.yml
Expand Up @@ -20,7 +20,9 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: x86_64-unknown-linux-gnu
path: target/x86_64-unknown-linux-gnu/release/oatmeal
path: |
target/x86_64-unknown-linux-gnu/release/oatmeal
target/x86_64-unknown-linux-gnu/release/oatmeal.dwp
linux-arm:
runs-on: ubuntu-latest
Expand All @@ -47,7 +49,9 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: aarch64-unknown-linux-gnu
path: target/aarch64-unknown-linux-gnu/release/oatmeal
path: |
target/aarch64-unknown-linux-gnu/release/oatmeal
target/aarch64-unknown-linux-gnu/release/oatmeal.dwp
macos-amd:
runs-on: macos-latest
Expand All @@ -62,12 +66,19 @@ jobs:
with:
cache-directories: ".bin"
- name: Build
run: cargo build --release --target x86_64-apple-darwin
run: |
cargo build --release --target x86_64-apple-darwin
cd target/x86_64-apple-darwin/release/
cp -r "$(readlink oatmeal.dSYM)" symbols
rm oatmeal.dSYM
mv symbols oatmeal.dSYM
- name: Upload
uses: actions/upload-artifact@v2
with:
name: x86_64-apple-darwin
path: target/x86_64-apple-darwin/release/oatmeal
path: |
target/x86_64-apple-darwin/release/oatmeal
target/x86_64-apple-darwin/release/oatmeal.dSYM
macos-arm:
runs-on: macos-latest
Expand All @@ -89,11 +100,17 @@ jobs:
rustup target add aarch64-apple-darwin
cargo install cargo-run-bin
cargo zigbuild --release --target aarch64-apple-darwin
cd target/aarch64-apple-darwin/release
cp -r "$(readlink oatmeal.dSYM)" symbols
rm oatmeal.dSYM
mv symbols oatmeal.dSYM
- name: Upload
uses: actions/upload-artifact@v2
with:
name: aarch64-apple-darwin
path: target/aarch64-apple-darwin/release/oatmeal
path: |
target/aarch64-apple-darwin/release/oatmeal
target/aarch64-apple-darwin/release/oatmeal.dSYM
windows-amd:
runs-on: windows-latest
Expand All @@ -114,7 +131,9 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: x86_64-pc-windows-msvc
path: target/x86_64-pc-windows-msvc/release/oatmeal.exe
path: |
target/x86_64-pc-windows-msvc/release/oatmeal.exe
target/x86_64-pc-windows-msvc/release/oatmeal.pdb
windows-arm:
runs-on: windows-latest
Expand All @@ -136,4 +155,6 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: aarch64-pc-windows-msvc
path: target/aarch64-pc-windows-msvc/release/oatmeal.exe
path: |
target/aarch64-pc-windows-msvc/release/oatmeal.exe
target/aarch64-pc-windows-msvc/release/oatmeal.pdb
42 changes: 21 additions & 21 deletions .goreleaser.yml
Expand Up @@ -16,8 +16,8 @@ snapshot:
name_template: "{{ .Tag }}-next"
archives:
- format_overrides:
- goos: windows
format: zip
- goos: windows
format: zip
files:
- completions/*
- LICENSE
Expand All @@ -42,12 +42,12 @@ brews:
fish_completion.install "completions/oatmeal.fish"
scoops:
- repository:
owner: dustinblackman
name: scoop-bucket
homepage: https://github.com/dustinblackman/oatmeal
description: Terminal UI to chat with large language models (LLM) using backends such as Ollama, and direct integrations with your favourite editor like Neovim!
license: MIT
- repository:
owner: dustinblackman
name: scoop-bucket
homepage: https://github.com/dustinblackman/oatmeal
description: Terminal UI to chat with large language models (LLM) using backends such as Ollama, and direct integrations with your favourite editor like Neovim!
license: MIT

nfpms:
- homepage: https://github.com/dustinblackman/oatmeal
Expand All @@ -67,7 +67,7 @@ nfpms:
file_info:
mode: 0644
- src: ./completions/oatmeal.zsh
dst: /usr/share/zsh/vendor-completions/_oatmeal
dst: /usr/share/zsh/vendor-completions/_oatmeal
file_info:
mode: 0644
- src: ./LICENSE
Expand All @@ -91,20 +91,20 @@ aurs:
private_key: "{{ .Env.AUR_KEY }}"
git_url: "ssh://aur@aur.archlinux.org/oatmeal-bin.git"
package: |-
# bin
install -Dm755 "./oatmeal" "${pkgdir}/usr/bin/oatmeal"
# bin
install -Dm755 "./oatmeal" "${pkgdir}/usr/bin/oatmeal"
# license
install -Dm644 "./LICENSE" "${pkgdir}/usr/share/licenses/oatmeal/LICENSE"
install -Dm644 "./THIRDPARTY.html" "${pkgdir}/usr/share/licenses/oatmeal/THIRDPARTY.html"
# license
install -Dm644 "./LICENSE" "${pkgdir}/usr/share/licenses/oatmeal/LICENSE"
install -Dm644 "./THIRDPARTY.html" "${pkgdir}/usr/share/licenses/oatmeal/THIRDPARTY.html"
# completions
mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"
install -Dm644 "./completions/oatmeal.bash" "${pkgdir}/usr/share/bash-completion/completions/oatmeal"
install -Dm644 "./completions/oatmeal.zsh" "${pkgdir}/usr/share/zsh/site-functions/_oatmeal"
install -Dm644 "./completions/oatmeal.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/oatmeal.fish"
# completions
mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"
install -Dm644 "./completions/oatmeal.bash" "${pkgdir}/usr/share/bash-completion/completions/oatmeal"
install -Dm644 "./completions/oatmeal.zsh" "${pkgdir}/usr/share/zsh/site-functions/_oatmeal"
install -Dm644 "./completions/oatmeal.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/oatmeal.fish"
changelog:
use: github-native
63 changes: 4 additions & 59 deletions Cargo.toml
Expand Up @@ -93,6 +93,8 @@ git-cliff = { version = "1.3.1" }

[profile.release]
lto = true
debug = "limited"
split-debuginfo = "packed"

[profile.dev.package]
insta.opt-level = 3
Expand Down Expand Up @@ -124,19 +126,6 @@ dev-install = '''set -e
sudo mv ./target/release/oatmeal /usr/local/bin/
'''

goreleaser = '''set -e
export OM_VERSION=$(cat Cargo.toml | grep version | head -n1 | awk -F '"' '{print $2}')
cargo cmd build-completions
AUR_KEY=$(cat ~/.ssh/aur) cargo gha goreleaser --clean
cargo bin git-cliff --latest --strip header | cargo bin dprint fmt --stdin md | cargo gha gh release edit "v$OM_VERSION" --notes-file -
cargo publish --no-verify
tools/apt.sh "$OM_VERSION" "$(realpath dist)"
tools/nur.sh "$OM_VERSION" "$(realpath dist)"
tools/yum.sh "$OM_VERSION" "$(realpath dist)"
tools/choco.sh "$OM_VERSION" "$(realpath dist)"
'''

lint = '''set -e
cargo cmd setup-nightly
cargo +oatmeal-nightly fmt -- --check
Expand All @@ -160,52 +149,8 @@ setup-nightly = '''
rustup toolchain link oatmeal-nightly "$(rustup toolchain list -v | grep $NIGHTLY | grep '^nightly-' | awk '{print $2}')"
'''

release = '''set -e
docker ps >/dev/null || (echo "Docker is not running" && exit 1)
cargo gha goreleaser check
cargo check
cargo cmd lint
cargo cmd test
cargo cmd thirdparty
export OM_VERSION=$(cat Cargo.toml | grep version | head -n1 | awk -F '"' '{print $2}')
cargo bin git-cliff -o CHANGELOG.md --tag "v$OM_VERSION"
cargo bin dprint fmt
git add .
git commit -m "feat: Release v$OM_VERSION"
git tag -a "v$OM_VERSION" -m "v$OM_VERSION"
cargo build
cargo xtask update-readme
cargo bin dprint fmt
git add .
git commit --amend -m "feat: Release v$OM_VERSION"
git tag -d "v$OM_VERSION"
git tag -a "v$OM_VERSION" -m "v$OM_VERSION"
git push
git push --tags
gh workflow run release.yml --ref main
sleep 5
while true; do
res=$(cargo gha gh run list -R dustinblackman/oatmeal -w build --json conclusion,databaseId | jq -rc '.[0]')
echo "Status: $res"
if (echo "$res" | grep -q "success"); then
break
fi
sleep 30
done;
rm -rf dist-gh
mkdir dist-gh
export GH_RUN_ID=$(cargo gha gh run list -R dustinblackman/oatmeal -w build --json databaseId | jq -rc '.[0].databaseId')
cargo gha gh run download -D dist-gh $GH_RUN_ID
fd -t f . './dist-gh' | xargs -L1 chmod +x
cargo cmd goreleaser
release = '''
./tools/release.sh
'''

insta = '''set -e
Expand Down
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -31,6 +31,7 @@
- [Adding syntax highlighting for a language](#adding-syntax-highlighting-for-a-language)
- [FAQ](#faq)
- [Why Oatmeal?](#why-oatmeal)
- [Report an issue](#report-an-issue)
- [License](#license)

## Overview
Expand Down Expand Up @@ -297,6 +298,18 @@ Syntax highlighting language selection is a tad manual where several languages m

I was eating a bowl of oatmeal when I wrote the first commit :shrug:. (They don't let me name things at work anymore...)

### Report an issue

On each Oatmeal release there is a separate download to helps in reporting issues to really drill down in to what the
problem is! If you've run in to a problem, I'd really help appreciate solving it.

1. Head over to [releases](https://github.com/dustinblackman/oatmeal/releases) and download the DEBUG package for your
system and version of Oatmeal you're using.
2. Extract the contents of the archive next to your oatmeal binary. You can find it on your system by running something
equivalent to `which oatmeal`.
3. Run your command with the arguments provided in the error message.
4. Copy/paste the output and [open an issue](https://github.com/dustinblackman/oatmeal/issues/new).

## License

[MIT](./LICENSE)
9 changes: 7 additions & 2 deletions src/main.rs
Expand Up @@ -49,8 +49,13 @@ fn handle_error(err: Error) {
if backtrace.to_string() == "disabled backtrace" {
let args = env::args().collect::<Vec<String>>().join(" ");
eprintln!(
"\nTo report a bug, please rerun your command with the following to print stack traces:"
);
"\nIf you could spare a moment, please head over to the docs to report this issue!"
);
eprintln!(
"\nhttps://github.com/dustinblackman/oatmeal/blob/v{}/README.md#report-an-issue",
env!("CARGO_PKG_VERSION")
);
eprintln!("\nAfterward debugging is setup, you can rerun your command with the following:");
eprintln!("\nRUST_BACKTRACE=1 {args}");
} else {
eprintln!("\n{}", backtrace);
Expand Down
78 changes: 78 additions & 0 deletions tools/release.sh
@@ -0,0 +1,78 @@
#!/usr/bin/env bash

set -e

PROGDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
cd "$PROGDIR/.."

# Check everything is clear for release, generate third party file.
docker ps >/dev/null || (echo "Docker is not running" && exit 1)
cargo gha goreleaser check
cargo check
cargo cmd lint
cargo cmd test
cargo cmd thirdparty

# Update change log.
export OM_VERSION=$(cat Cargo.toml | grep version | head -n1 | awk -F '"' '{print $2}')
cargo bin git-cliff -o CHANGELOG.md --tag "v$OM_VERSION"
cargo bin dprint fmt

# Add release commit
git add .
git commit -m "feat: Release v$OM_VERSION"
git tag -a "v$OM_VERSION" -m "v$OM_VERSION"

# Update readme, build completions.
cargo build
cargo cmd build-completions
cargo xtask update-readme
cargo bin dprint fmt

# Override release commit with updated readme.
git add .
git commit --amend -m "feat: Release v$OM_VERSION"
git tag -d "v$OM_VERSION"
git tag -a "v$OM_VERSION" -m "v$OM_VERSION"
git push
git push --tags
sleep 2

# Trigger binary builds, wait for completion.
gh workflow run release.yml --ref main
sleep 5
while true; do
res=$(cargo gha gh run list -R dustinblackman/oatmeal -w build --json conclusion,databaseId | jq -rc '.[0]')
echo "Status: $res"
if (echo "$res" | grep -q "success"); then
break
fi
sleep 30
done

# Download binary builds and debug symbols.
rm -rf dist-gh
mkdir dist-gh
export GH_RUN_ID=$(cargo gha gh run list -R dustinblackman/oatmeal -w build --json databaseId | jq -rc '.[0].databaseId')
cargo gha gh run download -D dist-gh "$GH_RUN_ID"
fd -t f . './dist-gh' | grep -v -i -E '(dwp|dSYM|pdb)' | xargs -L1 chmod +x

# Archive and upload debug packages
tar --strip-components=2 -czf "dist/oatmeal-DEBUG-${OM_VERSION}_darwin_arm64.tar.gz" dist-gh/aarch64-apple-darwin/oatmeal.dSYM
tar --strip-components=2 -czf "dist/oatmeal-DEBUG-${OM_VERSION}_windows_arm64.tar.gz" dist-gh/aarch64-pc-windows-msvc/oatmeal.pdb
tar --strip-components=2 -czf "dist/oatmeal-DEBUG-${OM_VERSION}_linux_arm64.tar.gz" dist-gh/aarch64-unknown-linux-gnu/oatmeal.dwp
tar --strip-components=2 -czf "dist/oatmeal-DEBUG-${OM_VERSION}_darwin_amd64.tar.gz" dist-gh/x86_64-apple-darwin/oatmeal.dSYM
tar --strip-components=2 -czf "dist/oatmeal-DEBUG-${OM_VERSION}_windows_amd64.tar.gz" dist-gh/x86_64-pc-windows-msvc/oatmeal.pdb
tar --strip-components=2 -czf "dist/oatmeal-DEBUG-${OM_VERSION}_linux_amd64.tar.gz" dist-gh/x86_64-unknown-linux-gnu/oatmeal.dwp
ls dist | grep DEBUG | while read f; do cargo gha gh release upload "v$OM_VERSION" "dist/$f"; done

# Release to Github
AUR_KEY=$(cat ~/.ssh/aur) cargo gha goreleaser --clean
cargo bin git-cliff --latest --strip header | cargo bin dprint fmt --stdin md | cargo gha gh release edit "v$OM_VERSION" --notes-file -

# Release to package managers not supported by GoReleaser.
cargo publish --no-verify
tools/apt.sh "$OM_VERSION" "$(realpath dist)"
tools/nur.sh "$OM_VERSION" "$(realpath dist)"
tools/yum.sh "$OM_VERSION" "$(realpath dist)"
tools/choco.sh "$OM_VERSION" "$(realpath dist)"

0 comments on commit c8bb275

Please sign in to comment.