Skip to content

Commit

Permalink
docs: use mise tasks for publishing (#3073)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored Nov 18, 2024
1 parent 8b5d4b8 commit c42e3e3
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
cargo build --all-features
echo "$PWD/target/debug" >> "$GITHUB_PATH"
- run: mise install
- run: npm install
- run: mise x -- bun i
- run: mise run render
- run: mise run lint-fix
- uses: autofix-ci/[email protected]
11 changes: 5 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ on:
push:
paths:
- "docs/**"
- "tasks/docs/**"
branches:
- main
pull_request:
paths:
- "docs/**"
- "tasks/docs/**"
branches:
- main

concurrency:
group: docs-${{ github.head_ref }}
cancel-in-progress: true

env:
MISE_EXPERIMENTAL: 1

jobs:
docs:
if: github.repository == 'jdx/mise'
Expand All @@ -31,9 +30,9 @@ jobs:
with:
install_args: bun
cache: false
- run: mise run docs:build
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: mise run docs:release
- run: bun i
- run: mise run docs:release
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }}
DRY_RUN: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }}
72 changes: 72 additions & 0 deletions .github/workflows/hyperfine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: hyperfine
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.RTX_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
MISE_EXPERIMENTAL: 1

permissions:
pull-requests: write

jobs:
benchmark:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
- run: curl https://mise.run | MISE_INSTALL_PATH="$HOME/bin/mise-release" sh
- run: echo "$HOME/bin" >> "$GITHUB_PATH"
- id: versions
run: |
echo "main=$(git rev-parse --short origin/main)" >> $GITHUB_OUTPUT
echo "release=$(mise-release v | awk '{print $1}')" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: $HOME/bin/mise-${{ steps.versions.outputs.main }}
key: mise-hyperfine-main-${{ steps.versions.outputs.main }}-${{ runner.os }}
- name: build main
run: |
if [ ! -f "$HOME/bin/mise-${{ steps.versions.outputs.main }}" ]; then
git checkout main
cargo build --profile serious && mv target/serious/mise $HOME/bin/mise-${{ steps.versions.outputs.main }}
git checkout -
fi
- run: mv $HOME/bin/mise-release $HOME/bin/mise-${{ steps.versions.outputs.release }}
- run: cp $HOME/bin/mise-${{ steps.versions.outputs.main }} $HOME/bin/mise-main
- run: cargo build --profile serious && mv target/serious/mise $HOME/bin
- run: mise i
- run: |
CMDS=(
"x -- echo"
"env"
"hook-env"
"ls"
)
echo "# Hyperfine Performance" >> comment.md
for cmd in "${CMDS[@]}"; do
mise x hyperfine -- hyperfine -N -w 10 -r 500 --export-markdown out.md --reference "mise-main $cmd" "mise-${{ steps.versions.outputs.release }} $cmd" "mise $cmd"
echo "### \`mise $cmd\`" >> comment.md
cat out.md >> comment.md
done
cat comment.md >> $GITHUB_STEP_SUMMARY
env:
SHELL: zsh
- name: Comment on PR
uses: thollander/actions-comment-pull-request@v3
#if: "startsWith(github.event.pull_request.title, 'perf:') || startsWith(github.event.pull_request.title, 'chore: release')"
with:
file-path: comment.md
comment-tag: hyperfine
2 changes: 1 addition & 1 deletion .github/workflows/release-fig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
shared-key: test-ubuntu-latest
save-if: false
- run: mkdir -p "$HOME/bin" && echo "$HOME/bin" >> "$GITHUB_PATH"
- run: npm i
- run: cargo build --all-features && cp target/debug/mise "$HOME"/bin
- run: mise install
- run: mise x -- bun i
- run: mise run render:fig
- name: Create Autocomplete PR ## Create the autocomplete PR using this action
uses: withfig/push-to-fig-autocomplete-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
shared-key: test-ubuntu-latest
save-if: false
- run: mkdir -p "$HOME/bin" && echo "$HOME/bin" >> "$GITHUB_PATH"
- run: npm i
- run: cargo build --all-features && cp target/debug/mise "$HOME"/bin
- run: mise install
- run: mise x -- bun i
- run: mise run release-plz
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: release
on:
push:
tags: ["v*"]
branches: ["release", "windows", "docs"]
branches: ["release"]
workflow_dispatch:

concurrency:
Expand Down
Binary file added bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ actionlint = "latest"
ripgrep = "latest"
"pipx:toml-sort" = "latest"
"cargo:usage-cli" = {version = "1.3", os = ["linux", "macos"]}
bun = "latest"
#python = { version = "latest", virtualenv = "{{env.HOME}}/.cache/venv" }

[task_config]
Expand Down
2 changes: 1 addition & 1 deletion tasks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ run = "bun run docs:dev"

["docs:setup"]
dir = "docs"
run = "bun i"
run = ["cd .. && bun i", "bun i"]

["docs:build"]
depends = ["docs:setup"]
Expand Down
6 changes: 6 additions & 0 deletions tasks/docs/release
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ set -xeuo pipefail
export AWS_REGION=auto
export AWS_ENDPOINT_URL=https://6e243906ff257b965bcae8025c2fc344.r2.cloudflarestorage.com

if [ "${DRY_RUN:-true}" = "true" ]; then
aws() {
echo "DRY RUN: aws $*"
}
fi

if [ $((RANDOM % 30)) -eq 0 ]; then
# delete old assets only roughly 1/30 times
# deleting old assets can break the site for people currently on it
Expand Down
1 change: 1 addition & 0 deletions tasks/test/coverage
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cargo build -q --all-features
echo "::endgroup::"
echo "::group::mise install"
mise install
mise x -- bun i
echo "::endgroup::"
mise x -- ./e2e/run_all_tests
if [[ "${TEST_TRANCHE:-}" == 0 ]]; then
Expand Down

0 comments on commit c42e3e3

Please sign in to comment.