Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Schniz authored May 27, 2024
2 parents 602c651 + 121128f commit 7698cc4
Show file tree
Hide file tree
Showing 31 changed files with 684 additions and 199 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-emus-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": minor
---

feat: add remote version sorting and filtering
5 changes: 5 additions & 0 deletions .changeset/poor-otters-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": patch
---

support `x64-musl` arch by adding a `--arch x64-musl` to fnm env
5 changes: 5 additions & 0 deletions .changeset/poor-poets-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": patch
---

make nicer styling in progress bar (add newline, make it unicode)
5 changes: 5 additions & 0 deletions .changeset/rotten-pumpkins-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": patch
---

fix: return default version if canonicalize fails
5 changes: 5 additions & 0 deletions .changeset/show-download-progress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"fnm": minor
---

Show a progress bar when downloading and extracting node
8 changes: 8 additions & 0 deletions .ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set -e
RELEASE="latest"
OS="$(uname -s)"

case "${OS}" in
MINGW* | Win*) OS="Windows" ;;
esac

if [ -d "$HOME/.fnm" ]; then
INSTALL_DIR="$HOME/.fnm"
elif [ -n "$XDG_DATA_HOME" ]; then
Expand Down Expand Up @@ -70,6 +74,9 @@ set_filename() {
elif [ "$OS" = "Darwin" ]; then
USE_HOMEBREW="true"
echo "Downloading fnm using Homebrew..."
elif [ "$OS" = "Windows" ] ; then
FILENAME="fnm-windows"
echo "Downloading the latest fnm binary from GitHub..."
else
echo "OS $OS is not supported."
echo "If you think that's a bug - please file an issue to https://github.com/Schniz/fnm/issues"
Expand Down Expand Up @@ -180,6 +187,7 @@ setup_shell() {
echo ' set PATH "'"$INSTALL_DIR"'" $PATH'
echo ' fnm env | source'

echo '' >>$CONF_FILE
echo '# fnm' >>$CONF_FILE
echo 'set PATH "'"$INSTALL_DIR"'" $PATH' >>$CONF_FILE
echo 'fnm env | source' >>$CONF_FILE
Expand Down
6 changes: 5 additions & 1 deletion .ci/record_screen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ RECORDING_PATH=$DIRECTORY/screen_recording

(rm -rf "$RECORDING_PATH" &> /dev/null || true)

asciinema rec -c "$DIRECTORY/recorded_screen_script.sh" "$RECORDING_PATH"
asciinema rec \
--command "$DIRECTORY/recorded_screen_script.sh" \
--cols 70 \
--rows 17 \
"$RECORDING_PATH"
sed "s@$TEMP_DIR@~@g" "$RECORDING_PATH" | \
svg-term \
--window \
Expand Down
94 changes: 46 additions & 48 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,52 @@ on:
concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:

create_pull_request:
runs-on: ubuntu-latest
steps:
# set up
- uses: actions/checkout@v3

- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable

- uses: Swatinem/rust-cache@v2

- uses: pnpm/action-setup@v2.2.4
with:
run_install: false

# pnpm
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install script dependencies
run: |
sudo apt-get update
sudo apt-get install -y asciinema
- name: Install Node.js project dependencies
run: pnpm install

- name: Create Release Pull Request
uses: changesets/action@v1
with:
version: "pnpm version:prepare"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERM: xterm
# set up
- uses: actions/checkout@v3

- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable

- uses: Swatinem/rust-cache@v2

- uses: pnpm/action-setup@v2.2.4
with:
run_install: false

# pnpm
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "pnpm"

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Asciinema
run: |
pipx install asciinema
- name: Install Node.js project dependencies
run: pnpm install

- name: Create Release Pull Request
uses: changesets/action@v1
with:
version: "pnpm version:prepare"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERM: xterm
151 changes: 77 additions & 74 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ concurrency:
group: ci-${{ github.head_ref }}
cancel-in-progress: true

env:
RUST_VERSION: "1.78"

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
rust-version: ${{env.RUST_VERSION}}
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3
- name: cargo fmt
Expand All @@ -27,7 +30,7 @@ jobs:
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
rust-version: ${{env.RUST_VERSION}}
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3
- name: cargo clippy
Expand All @@ -41,7 +44,7 @@ jobs:
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
rust-version: ${{env.RUST_VERSION}}
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3
- name: Run tests
Expand All @@ -53,7 +56,7 @@ jobs:
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
rust-version: ${{env.RUST_VERSION}}
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3
- name: Build release binary
Expand All @@ -71,7 +74,7 @@ jobs:
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
rust-version: ${{env.RUST_VERSION}}
- uses: Swatinem/rust-cache@v2
- uses: actions/checkout@v3
- name: Build release binary
Expand Down Expand Up @@ -237,7 +240,7 @@ jobs:
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
rust-version: ${{env.RUST_VERSION}}
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
with:
Expand Down Expand Up @@ -278,7 +281,7 @@ jobs:
uses: docker/setup-qemu-action@v2
- uses: hecrj/setup-rust-action@v1
with:
rust-version: stable
rust-version: ${{env.RUST_VERSION}}
- uses: Swatinem/rust-cache@v2
with:
key: arm-binary-${{ matrix.arch }}
Expand Down Expand Up @@ -358,70 +361,70 @@ jobs:
run: |
pnpm run generate-command-docs --check --binary-path=$(which fnm)
run_e2e_benchmarks:
runs-on: ubuntu-latest
name: bench/linux
needs: [build_static_linux_binary]
permissions:
contents: write
pull-requests: write
steps:
- name: install necessary shells
run: sudo apt-get update && sudo apt-get install -y fish zsh bash hyperfine
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: fnm-linux
path: target/release
- name: mark binary as executable
run: chmod +x target/release/fnm
- name: install fnm as binary
run: |
sudo install target/release/fnm /bin
fnm --version
- uses: pnpm/action-setup@v2.2.4
with:
run_install: false
- uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "pnpm"
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm install
- name: Run benchmarks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHOULD_STORE: ${{ toJson(!github.event.pull_request) }}
id: benchmark
run: |
delimiter="$(openssl rand -hex 8)"
echo "markdown<<${delimiter}" >> "${GITHUB_OUTPUT}"
node benchmarks/run.mjs --store=$SHOULD_STORE >> "${GITHUB_OUTPUT}"
echo "${delimiter}" >> "${GITHUB_OUTPUT}"
- name: Create a PR comment
if: ${{ github.event.pull_request }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
## Linux Benchmarks for ${{ github.event.pull_request.head.sha }}
${{ steps.benchmark.outputs.markdown }}
comment_tag: "benchy comment"

- name: Create a commit comment
if: ${{ !github.event.pull_request }}
uses: peter-evans/commit-comment@v2
with:
body: |
## Linux Benchmarks
${{ steps.benchmark.outputs.markdown }}
# TODO: use bnz
# run_e2e_benchmarks:
# runs-on: ubuntu-latest
# name: bench/linux
# needs: [build_static_linux_binary]
# permissions:
# contents: write
# pull-requests: write
# steps:
# - name: install necessary shells
# run: sudo apt-get update && sudo apt-get install -y fish zsh bash hyperfine
# - uses: actions/checkout@v3
# - uses: actions/download-artifact@v3
# with:
# name: fnm-linux
# path: target/release
# - name: mark binary as executable
# run: chmod +x target/release/fnm
# - name: install fnm as binary
# run: |
# sudo install target/release/fnm /bin
# fnm --version
# - uses: pnpm/action-setup@v2.2.4
# with:
# run_install: false
# - uses: actions/setup-node@v3
# with:
# node-version: 18.x
# cache: "pnpm"
# - name: Get pnpm store directory
# id: pnpm-cache
# run: |
# echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
# - uses: actions/cache@v3
# name: Setup pnpm cache
# with:
# path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
# key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
# restore-keys: |
# ${{ runner.os }}-pnpm-store-
# - run: pnpm install
# - name: Run benchmarks
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SHOULD_STORE: ${{ toJson(!github.event.pull_request) }}
# id: benchmark
# run: |
# delimiter="$(openssl rand -hex 8)"
# echo "markdown<<${delimiter}" >> "${GITHUB_OUTPUT}"
# node benchmarks/run.mjs --store=$SHOULD_STORE >> "${GITHUB_OUTPUT}"
# echo "${delimiter}" >> "${GITHUB_OUTPUT}"
# - name: Create a PR comment
# if: ${{ github.event.pull_request }}
# uses: thollander/actions-comment-pull-request@v2
# with:
# message: |
# ## Linux Benchmarks for ${{ github.event.pull_request.head.sha }}
# ${{ steps.benchmark.outputs.markdown }}
# comment_tag: "benchy comment"
#
# - name: Create a commit comment
# if: ${{ !github.event.pull_request }}
# uses: peter-evans/commit-comment@v2
# with:
# body: |
# ## Linux Benchmarks
# ${{ steps.benchmark.outputs.markdown }}
Loading

0 comments on commit 7698cc4

Please sign in to comment.