added ability to do dry runs of releases (#1098)

This commit is contained in:
jdx 2023-12-06 20:41:43 -06:00 committed by GitHub
parent 76ca0cc228
commit b70838c63e
44 changed files with 487 additions and 384 deletions

View File

@ -1,23 +1,23 @@
FROM mcr.microsoft.com/devcontainers/rust:0-1-bullseye
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
WORKDIR /workspaces/cached
# Use another target directory to avoid conflicts with the host target directory
RUN mkdir /workspaces/target
ENV CARGO_TARGET_DIR=/workspaces/target
# Install rust tools
RUN rustup component add clippy llvm-tools rustfmt
RUN cargo install cargo-insta cargo-llvm-cov
# Install dependencies
RUN export DEBIAN_FRONTEND=noninteractive \
RUN mkdir /workspaces/target \
# Install rust tools
&& rustup component add clippy llvm-tools rustfmt \
&& cargo install cargo-insta cargo-llvm-cov \
# Install dependencies
&& export DEBIAN_FRONTEND=noninteractive \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get update \
&& apt-get -y install --no-install-recommends \
# shells, direnv, shellcheck
bash fish zsh direnv nodejs shellcheck \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# shfmt
&& curl -sS https://webi.sh/shfmt | sh \
# just

18
.github/actionlint.yaml vendored Normal file
View File

@ -0,0 +1,18 @@
self-hosted-runner:
# Labels of self-hosted runner in array of strings.
labels:
- buildjet-32vcpu-ubuntu-2204-arm
- buildjet-16vcpu-ubuntu-2204-arm
- buildjet-8vcpu-ubuntu-2204-arm
- buildjet-4vcpu-ubuntu-2204-arm
- buildjet-2vcpu-ubuntu-2204-arm
- buildjet-32vcpu-ubuntu-2204
- buildjet-16vcpu-ubuntu-2204
- buildjet-8vcpu-ubuntu-2204
- buildjet-4vcpu-ubuntu-2204
- buildjet-2vcpu-ubuntu-2204
# Configuration variables in array of strings defined in your repository or
# organization. `null` means disabling configuration variables check.
# Empty array means no configuration variable is allowed.
config-variables: null

View File

@ -1 +1,5 @@
enabled: true
restylers:
- "!shellharden"
- "!prettier-markdown"
- "*"

View File

@ -6,6 +6,10 @@ on:
branches: ["main", "release/*"]
workflow_dispatch:
concurrency:
group: release
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
@ -13,51 +17,72 @@ env:
jobs:
build-tarball:
name: build-tarball-${{matrix.name}}
runs-on: ${{matrix.os}}
runs-on: ${{matrix.runs-on}}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
- os: ubuntu
name: linux-x64
target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04
runs-on: buildjet-4vcpu-ubuntu-2204
- os: ubuntu
name: linux-x64-musl
target: aarch64-unknown-linux-musl
- os: ubuntu-22.04
target: x86_64-unknown-linux-musl
runs-on: buildjet-4vcpu-ubuntu-2204
- os: ubuntu
name: linux-arm64
target: aarch64-unknown-linux-gnu
- os: ubuntu-22.04
runs-on: buildjet-4vcpu-ubuntu-2204
- os: ubuntu
name: linux-arm64-musl
target: aarch64-unknown-linux-musl
- os: ubuntu-22.04
runs-on: buildjet-4vcpu-ubuntu-2204
- os: ubuntu
name: linux-armv7
target: armv7-unknown-linux-gnueabi
- os: ubuntu-22.04
runs-on: buildjet-4vcpu-ubuntu-2204
- os: ubuntu
name: linux-armv7-musl
target: armv7-unknown-linux-musleabi
- os: ubuntu-22.04
runs-on: buildjet-4vcpu-ubuntu-2204
- os: ubuntu
name: linux-armv6
target: arm-unknown-linux-gnueabi
- os: ubuntu-22.04
runs-on: buildjet-4vcpu-ubuntu-2204
- os: ubuntu
name: linux-armv6-musl
target: arm-unknown-linux-musleabi
- os: macos-12
runs-on: buildjet-4vcpu-ubuntu-2204
- os: macos
name: macos-x64
target: x86_64-apple-darwin
- os: macos-12
runs-on: macos-12
- os: macos
name: macos-arm64
target: aarch64-apple-darwin
runs-on: macos-12
# - os: macos
# name: macos
# target: universal2-apple-darwin
# runs-on: macos-12
steps:
- uses: actions/checkout@v4
- if: matrix.os == 'macos-12'
run: rustup target add ${{matrix.target}}
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- if: matrix.target == 'universal2-apple-darwin'
run: |
brew install zig
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
cargo install cargo-zigbuild
- run: rustup target add ${{matrix.target}}
if: matrix.target != 'universal2-apple-darwin'
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
with:
shared-key: "build-tarball-${{matrix.name}}"
- if: matrix.os == 'ubuntu-22.04'
shared-key: build-tarball-${{matrix.name}}
cache-provider: buildjet
- if: matrix.os == 'ubuntu'
uses: taiki-e/install-action@cross
- run: scripts/setup-zipsign.sh
env:
@ -71,7 +96,7 @@ jobs:
dist/rtx-*.tar.gz
if-no-files-found: error
e2e-linux:
runs-on: ubuntu-22.04
runs-on: buildjet-16vcpu-ubuntu-2204
#container: ghcr.io/jdx/rtx:github-actions
needs: [build-tarball]
timeout-minutes: 30
@ -83,8 +108,8 @@ jobs:
with:
name: tarball-x86_64-unknown-linux-gnu
path: dist
- run: tar -C "$HOME" -xvJf dist/rtx-$(./scripts/get-version.sh)-linux-x64.tar.xz
- run: echo "$HOME/rtx/bin" >> $GITHUB_PATH
- run: tar -C "$HOME" -xvJf "dist/rtx-$(./scripts/get-version.sh)-linux-x64.tar.xz"
- run: echo "$HOME/rtx/bin" >> "$GITHUB_PATH"
- run: rtx -v
- name: Run e2e tests
uses: nick-fields/retry@v2
@ -143,8 +168,7 @@ jobs:
path: dist/deb
if-no-files-found: error
release:
runs-on: ubuntu-22.04
if: startsWith(github.event.ref, 'refs/tags/v')
runs-on: buildjet-4vcpu-ubuntu-2204
#container: ghcr.io/jdx/rtx:github-actions
timeout-minutes: 10
permissions:
@ -154,6 +178,8 @@ jobs:
- build-tarball
- rpm
- deb
env:
DRY_RUN: ${{ startsWith(github.event.ref, 'refs/tags/v') && '0' || '1' }}
steps:
- uses: actions/checkout@v4
with:
@ -168,18 +194,12 @@ jobs:
sudo apt-get update
sudo apt-get install fd-find
mkdir -p "$HOME/.local/bin"
ln -s $(which fdfind) "$HOME/.local/bin/fd"
echo "$HOME/.local/bin" >> $GITHUB_PATH
ln -s "$(which fdfind)" "$HOME/.local/bin/fd"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- name: Set AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.RTX_SSH_KEY }}
@ -199,6 +219,7 @@ jobs:
CLOUDFLARE_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }}
CLOUDFLARE_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }}
- name: homebrew-tap push
if: startsWith(github.event.ref, 'refs/tags/v')
run: git push
working-directory: homebrew-tap
- name: GitHub Release Assets
@ -231,6 +252,7 @@ jobs:
formula: rtx
bump-alpine:
runs-on: ubuntu-22.04
if: startsWith(github.event.ref, 'refs/tags/v')
container: ghcr.io/jdx/rtx:alpine
timeout-minutes: 30
needs: [release]

View File

@ -3,59 +3,60 @@ name: rtx
on:
push:
tags: ["v*"]
branches: ["main", "release/*"]
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RTX_TRUSTED_CONFIG_PATHS: ${{ github.workspace }}
jobs:
unit:
runs-on: ubuntu-22.04
container: ghcr.io/jdx/rtx:github-actions
runs-on: buildjet-8vcpu-ubuntu-2204
#container: ghcr.io/jdx/rtx:github-actions
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- uses: Swatinem/rust-cache@v2
with:
save-if: false
# - uses: taiki-e/install-action@v2
# with:
# tool: nextest,just,cargo-deny,cargo-msrv,cargo-machete
# - name: Install direnv/shfmt
# run: sudo apt-get update; sudo apt-get install direnv shfmt
shared-key: unit
save-if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
cache-provider: buildjet
- uses: taiki-e/install-action@v2
with:
tool: nextest,just,cargo-deny,cargo-msrv,cargo-machete
- name: Install direnv/shfmt
run: sudo apt-get update; sudo apt-get install direnv shfmt
- run: pnpm i -g markdown-magic prettier markdownlint-cli
- run: cargo nextest run --all-features
env:
RUST_BACKTRACE: "1"
- run: just lint
- run: cargo deny check
- run: cargo msrv verify
- run: cargo machete --with-metadata
lint-fix:
runs-on: ubuntu-22.04
timeout-minutes: 10
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
shared-key: test
save-if: false
- run: sudo apt-get update; sudo apt-get install shfmt shellcheck
- uses: taiki-e/install-action@just
- run: just lint-fix
- uses: EndBug/add-and-commit@v9
- run: just render-all lint-fix
- if: github.event_name == 'pull_request'
uses: EndBug/add-and-commit@v9
with:
push: true
author_name: rtx[bot]
author_email: 123107610+rtx-vm@users.noreply.github.com
- run: just lint
coverage:
name: coverage-${{matrix.tranche}}
#container: ghcr.io/jdx/rtx:github-actions
runs-on: ubuntu-latest
runs-on: buildjet-4vcpu-ubuntu-2204
timeout-minutes: 30
strategy:
fail-fast: false
@ -63,14 +64,19 @@ jobs:
tranche: [0, 1, 2, 3]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: rustup toolchain install nightly --component llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
shared-key: test
shared-key: coverage
cache-provider: buildjet
save-if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
cache-all-crates: true
- uses: taiki-e/install-action@cargo-llvm-cov
- run: sudo apt-get update; sudo apt-get install zsh fish direnv shfmt
- run: npm i -g markdown-magic
- run: pnpm i -g markdown-magic
- uses: taiki-e/install-action@just
- uses: nick-fields/retry@v2
env:

View File

@ -100,7 +100,7 @@ jobs:
# dist/rtx-v1.16.0-linux-x64.tar.xz
# x86_64-unknown-linux-gnu-v1.16.0-linux-x64.tar.xz
- run: tar -C "$HOME" -xvJf dist/rtx-*-linux-x64.tar.xz
- run: echo "$HOME/rtx/bin" >> $GITHUB_PATH
- run: echo "$HOME/rtx/bin" >> "$GITHUB_PATH"
- run: rtx -v
- name: ${{matrix.command}}
uses: nick-fields/retry@v2
@ -178,7 +178,7 @@ jobs:
name: tarball-x86_64-unknown-linux-gnu
path: dist
- run: tar -C "$HOME" -xvJf dist/rtx-*-linux-x64.tar.xz
- run: echo "$HOME/rtx/bin" >> $GITHUB_PATH
- run: echo "$HOME/rtx/bin" >> "$GITHUB_PATH"
- name: rtx install ${{matrix.plugins}}@latest
uses: nick-fields/retry@v2
with:

5
.hadolint.yaml Normal file
View File

@ -0,0 +1,5 @@
ignored:
- DL3008
- DL3018
- DL3028
- DL3041

View File

@ -21,6 +21,7 @@
<excludeFolder url="file://$MODULE_DIR$/.cargo/registry" />
<excludeFolder url="file://$MODULE_DIR$/packaging/alpine/src" />
<excludeFolder url="file://$MODULE_DIR$/asdf-plugins" />
<excludeFolder url="file://$MODULE_DIR$/megalinter-reports" />
<excludePattern pattern="*.log" />
</content>
<orderEntry type="inheritedJdk" />

View File

@ -0,0 +1,7 @@
{
"ignorePatterns": [
{
"pattern": "^https://crates.io"
}
]
}

6
.markdownlint.json Normal file
View File

@ -0,0 +1,6 @@
{
"MD013": false,
"MD033": false,
"MD040": false,
"MD041": false
}

1
.markdownlintignore Normal file
View File

@ -0,0 +1 @@
target/

View File

@ -15,7 +15,12 @@ DISABLE:
- SPELL
DISABLE_LINTERS:
- COPYPASTE_JSCPD
- REPOSITORY_GRYPE
- REPOSITORY_CHECKOV
- REPOSITORY_DEVSKIM
- REPOSITORY_KICS
- REPOSITORY_TRIVY
PRE_COMMANDS:
- command: apk add --no-cache zlib-dev zlib-static openssl-dev libffi-dev
@ -25,4 +30,4 @@ SHOW_ELAPSED_TIME: true
#FILEIO_REPORTER: false
FILTER_REGEX_EXCLUDE: "(completions/|target/)"
JSON_JSONLINT_FILTER_REGEX_EXCLUDE: '(\.vscode/)'
JSON_JSONLINT_FILTER_REGEX_EXCLUDE: '(\.devcontainer/)'

View File

@ -31,7 +31,7 @@ rtx uses [python-build](https://github.com/pyenv/pyenv/tree/master/plugins/pytho
## Configuration
`python-build` already has a [handful of settings](https://github.com/pyenv/pyenv/tree/master/plugins/python-build), in
additional to that `rtx-python` has a few extra configuration variables:
additional to that python in rtx has a few extra configuration variables:
- `RTX_PYENV_REPO` [string]: the default is `https://github.com/pyenv/pyenv.git`
- `RTX_PYTHON_PATCH_URL` [string]: A url to a patch file to pass to python-build.
@ -40,7 +40,7 @@ additional to that `rtx-python` has a few extra configuration variables:
## Default Python packages
rtx-python can automatically install a default set of Python packages with pip right after installing a Python version. To enable this feature, provide a `$HOME/.default-python-packages` file that lists one package per line, for example:
rtx can automatically install a default set of Python packages with pip right after installing a Python version. To enable this feature, provide a `$HOME/.default-python-packages` file that lists one package per line, for example:
```text
ansible

56
e2e/assert.sh Normal file → Executable file
View File

@ -1,44 +1,44 @@
#!/usr/bin/env bash
assert() {
local actual
actual="$(bash -c "$1")"
if [[ "$actual" != "$2" ]]; then
echo "Expected '$2' but got '$actual'"
exit 1
fi
local actual
actual="$(bash -c "$1")"
if [[ "$actual" != "$2" ]]; then
echo "Expected '$2' but got '$actual'"
exit 1
fi
}
assert_contains() {
local actual
actual="$(bash -c "$1")"
if [[ "$actual" != *"$2"* ]]; then
echo "Expected '$2' to be in '$actual'"
exit 1
fi
local actual
actual="$(bash -c "$1")"
if [[ "$actual" != *"$2"* ]]; then
echo "Expected '$2' to be in '$actual'"
exit 1
fi
}
assert_not_contains() {
local actual
actual="$(bash -c "$1")"
if [[ "$actual" == *"$2"* ]]; then
echo "Expected '$2' to not be in '$actual'"
exit 1
fi
local actual
actual="$(bash -c "$1")"
if [[ "$actual" == *"$2"* ]]; then
echo "Expected '$2' to not be in '$actual'"
exit 1
fi
}
assert_fail() {
if bash -c "$1" 2>&1; then
echo "Expected failure but succeeded"
exit 1
fi
if bash -c "$1" 2>&1; then
echo "Expected failure but succeeded"
exit 1
fi
}
assert_matches() {
local actual
actual="$(bash -c "$1")"
if [[ ! "$actual" =~ $2 ]]; then
echo "Expected '$2' to match '$actual'"
exit 1
fi
local actual
actual="$(bash -c "$1")"
if [[ ! "$actual" =~ $2 ]]; then
echo "Expected '$2' to match '$actual'"
exit 1
fi
}

View File

@ -8,12 +8,13 @@ rm -rf "$RTX_DATA_DIR/cache/poetry"
export POETRY_HOME=".poetry"
eval "$(rtx activate bash)"
rtx i python
rtx i python && _rtx_hook
rtx i poetry && _rtx_hook
assert "poetry --version" "Poetry (version 1.7.1)"
python3 -V
poetry install && _rtx_hook
rtx i poetry -f && _rtx_hook
poetry env info
assert "$(poetry env info -e) --version" "Python 3.12.0"
assert "echo \$VIRTUAL_ENV" "$(poetry env info -p)"

View File

@ -62,7 +62,7 @@ test-coverage:
./e2e/run_all_tests
if [[ "${TEST_TRANCHE:-}" == 0 ]]; then
rtx trust
just pre-commit
just render-help render-completions render-mangen
rtx implode
elif [[ "${TEST_TRANCHE:-}" == 1 ]]; then
rtx trust
@ -88,6 +88,8 @@ lint:
shellcheck -x {{ scripts }}
shfmt -d {{ scripts }}
just --unstable --fmt --check
prettier -c $(git ls-files '*.yml' '*.yaml')
markdownlint .
# runs linters but makes fixes when possible
lint-fix:
@ -96,6 +98,10 @@ lint-fix:
shellcheck -x {{ scripts }}
shfmt -w {{ scripts }}
just --unstable --fmt
prettier -w $(git ls-files '*.yml' '*.yaml')
markdownlint --fix .
render-all: render-help render-completions render-mangen
# regenerate README.md
render-help: build
@ -114,7 +120,7 @@ render-mangen: build
NO_COLOR=1 rtx render-mangen
# called by lefthook precommit hook
pre-commit: render-help render-completions render-mangen lint
pre-commit: render-all lint
git add README.md
git add completions
git add man

View File

@ -1,10 +1,11 @@
FROM alpine:edge
RUN apk add --no-cache sudo build-base alpine-sdk bash direnv glab atools
RUN apk fix
RUN adduser -D packager
RUN addgroup packager abuild
RUN echo "packager ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN mkdir -p /__w && chown packager:packager /__w && chmod 777 /__w
RUN apk add --no-cache sudo build-base alpine-sdk bash direnv glab atools \
&& apk fix \
&& adduser -D packager \
&& addgroup packager abuild \
&& echo "packager ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& mkdir -p /__w && chown packager:packager /__w && chmod 777 /__w
#USER packager
#WORKDIR /home/packager

View File

@ -2,9 +2,10 @@ FROM ubuntu:22.04
LABEL maintainer="jdx"
RUN apt-get update \
&& apt-get install -y \
&& apt-get install --no-install-recommends -y \
build-essential \
ruby \
&& apt-get clean
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN gem install fpm

View File

@ -1,8 +1,9 @@
#!/bin/sh
set -e
# shellcheck disable=SC2185
# shellcheck disable=SC2086
# shellcheck disable=SC2044
# shellcheck disable=SC2066
# shellcheck disable=SC2086
# shellcheck disable=SC2185
do_hash() {
HASH_NAME=$1

View File

@ -7,9 +7,11 @@ ENV RUSTUP_HOME="/root/.rustup"
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt-get update \
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
&& apt-get install -y --no-install-recommends \
autoconf \
bash \
build-essential \
@ -48,11 +50,14 @@ RUN apt-get update \
zsh \
&& ln -s /usr/bin/{fdfind,fd} \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update && apt-get install -y nodejs \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update && apt-get install -y --no-install-recommends nodejs \
&& node -v \
&& npm i -g markdown-magic \
&& npm i -g \
markdown-magic \
markdownlint-cli \
prettier \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash \
&& rustup install stable && rustup default stable \
@ -68,6 +73,7 @@ RUN apt-get update \
just \
zipsign \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rustc -vV \
&& cargo -V \
&& node -v \

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Rtx < Formula
desc "Multi-language runtime manager"
homepage "https://github.com/jdx/rtx"
@ -29,9 +31,9 @@ class Rtx < Formula
def install
bin.install "bin/rtx"
man1.install "man/man1/rtx.1"
generate_completions_from_executable(bin/"rtx", "completion")
generate_completions_from_executable(bin / "rtx", "completion")
lib.mkpath
touch lib/".disable-self-update"
touch lib / ".disable-self-update"
end
test do

View File

@ -1,6 +1,7 @@
FROM fedora:38
LABEL maintainer="jdx"
RUN dnf install -y rpm-build rpm-sign ruby ruby-devel gcc
RUN gem install fpm
RUN dnf install -y createrepo
RUN dnf install -y rpm-build rpm-sign ruby ruby-devel gcc \
&& gem install fpm \
&& dnf install -y createrepo \
&& dnf clean all

View File

@ -8,29 +8,29 @@ touch rtx/lib/.disable-self-update
tar -xvJf "dist/rtx-$RTX_VERSION-linux-x64.tar.xz"
fpm -s dir -t deb \
--name rtx \
--license MIT \
--version "${RTX_VERSION#v*}" \
--architecture amd64 \
--description "Polyglot runtime manager" \
--url "https://github.com/jdx/rtx" \
--maintainer "Jeff Dickey @jdx" \
rtx/bin/rtx=/usr/bin/rtx \
rtx/lib/.disable-self-update=/usr/lib/rtx/.disable-self-update \
rtx/man/man1/rtx.1=/usr/share/man/man1/rtx.1
--name rtx \
--license MIT \
--version "${RTX_VERSION#v*}" \
--architecture amd64 \
--description "Polyglot runtime manager" \
--url "https://github.com/jdx/rtx" \
--maintainer "Jeff Dickey @jdx" \
rtx/bin/rtx=/usr/bin/rtx \
rtx/lib/.disable-self-update=/usr/lib/rtx/.disable-self-update \
rtx/man/man1/rtx.1=/usr/share/man/man1/rtx.1
tar -xvJf "dist/rtx-$RTX_VERSION-linux-arm64.tar.xz"
fpm -s dir -t deb \
--name rtx \
--license MIT \
--version "${RTX_VERSION#v*}" \
--architecture arm64 \
--description "Polyglot runtime manager" \
--url "https://github.com/jdx/rtx" \
--maintainer "Jeff Dickey @jdx" \
rtx/bin/rtx=/usr/bin/rtx \
rtx/lib/.disable-self-update=/usr/lib/rtx/.disable-self-update \
rtx/man/man1/rtx.1=/usr/share/man/man1/rtx.1
--name rtx \
--license MIT \
--version "${RTX_VERSION#v*}" \
--architecture arm64 \
--description "Polyglot runtime manager" \
--url "https://github.com/jdx/rtx" \
--maintainer "Jeff Dickey @jdx" \
rtx/bin/rtx=/usr/bin/rtx \
rtx/lib/.disable-self-update=/usr/lib/rtx/.disable-self-update \
rtx/man/man1/rtx.1=/usr/share/man/man1/rtx.1
mkdir -p dist/deb/pool/main
cp -v ./*.deb dist/deb/pool/main

View File

@ -8,29 +8,29 @@ touch rtx/lib/.disable-self-update
tar -xvJf "dist/rtx-$RTX_VERSION-linux-x64.tar.xz"
fpm -s dir -t rpm \
--name rtx \
--license MIT \
--version "${RTX_VERSION#v*}" \
--architecture x86_64 \
--description "Polyglot runtime manager" \
--url "https://github.com/jdx/rtx" \
--maintainer "Jeff Dickey @jdx" \
rtx/bin/rtx=/usr/bin/rtx \
rtx/lib/.disable-self-update=/usr/lib/rtx/.disable-self-update \
rtx/man/man1/rtx.1=/usr/share/man/man1/rtx.1
--name rtx \
--license MIT \
--version "${RTX_VERSION#v*}" \
--architecture x86_64 \
--description "Polyglot runtime manager" \
--url "https://github.com/jdx/rtx" \
--maintainer "Jeff Dickey @jdx" \
rtx/bin/rtx=/usr/bin/rtx \
rtx/lib/.disable-self-update=/usr/lib/rtx/.disable-self-update \
rtx/man/man1/rtx.1=/usr/share/man/man1/rtx.1
tar -xvJf "dist/rtx-$RTX_VERSION-linux-arm64.tar.xz"
fpm -s dir -t rpm \
--name rtx \
--license MIT \
--version "${RTX_VERSION#v*}" \
--architecture aarch64 \
--description "Polyglot runtime manager" \
--url "https://github.com/jdx/rtx" \
--maintainer "Jeff Dickey @jdx" \
rtx/bin/rtx=/usr/bin/rtx \
rtx/lib/.disable-self-update=/usr/lib/rtx/.disable-self-update \
rtx/man/man1/rtx.1=/usr/share/man/man1/rtx.1
--name rtx \
--license MIT \
--version "${RTX_VERSION#v*}" \
--architecture aarch64 \
--description "Polyglot runtime manager" \
--url "https://github.com/jdx/rtx" \
--maintainer "Jeff Dickey @jdx" \
rtx/bin/rtx=/usr/bin/rtx \
rtx/lib/.disable-self-update=/usr/lib/rtx/.disable-self-update \
rtx/man/man1/rtx.1=/usr/share/man/man1/rtx.1
cat <<EOF >~/.rpmmacros
%_signature gpg

View File

@ -2,72 +2,75 @@
set -euo pipefail
error() {
echo "$@" >&2
exit 1
echo "$@" >&2
exit 1
}
NAME="$1"
shift
for arg in "$@"; do
if [ "${next_target:-}" = 1 ]; then
next_target=
TARGET="$arg"
continue
fi
case "$arg" in
--target)
next_target=1
;;
*) ;;
if [ "${next_target:-}" = 1 ]; then
next_target=
TARGET="$arg"
continue
fi
case "$arg" in
--target)
next_target=1
;;
*) ;;
esac
esac
done
RUST_TRIPLE=${TARGET:-$(rustc -vV | grep ^host: | cut -d ' ' -f2)}
#region os/arch
get_os() {
case "$RUST_TRIPLE" in
*-apple-darwin*)
echo "macos"
;;
*-linux-*)
echo "linux"
;;
*)
error "unsupported OS: $RUST_TRIPLE"
;;
esac
case "$RUST_TRIPLE" in
*-apple-darwin*)
echo "macos"
;;
*-linux-*)
echo "linux"
;;
*)
error "unsupported OS: $RUST_TRIPLE"
;;
esac
}
get_arch() {
case "$RUST_TRIPLE" in
aarch64-*)
echo "arm64"
;;
arm-*)
echo "armv6"
;;
armv7-*)
echo "armv7"
;;
x86_64-*)
echo "x64"
;;
*)
error "unsupported arch: $RUST_TRIPLE"
;;
esac
case "$RUST_TRIPLE" in
aarch64-*)
echo "arm64"
;;
arm-*)
echo "armv6"
;;
armv7-*)
echo "armv7"
;;
x86_64-*)
echo "x64"
;;
universal2-*)
echo "universal"
;;
*)
error "unsupported arch: $RUST_TRIPLE"
;;
esac
}
get_suffix() {
case "$RUST_TRIPLE" in
*-musl | *-musleabi | *-musleabihf)
echo "-musl"
;;
*)
echo ""
;;
esac
case "$RUST_TRIPLE" in
*-musl | *-musleabi | *-musleabihf)
echo "-musl"
;;
*)
echo ""
;;
esac
}
#endregion
@ -76,9 +79,11 @@ VERSION=$(./scripts/get-version.sh)
BASENAME=$NAME-$VERSION-$(get_os)-$(get_arch)$(get_suffix)
if command -v cross >/dev/null; then
cross build "$@"
cross build "$@"
elif command -v zig >/dev/null; then
cargo zigbuild "$@"
else
cargo build "$@"
cargo build "$@"
fi
mkdir -p dist/rtx/bin
mkdir -p dist/rtx/man/man1
@ -94,8 +99,8 @@ tar -cJf "$BASENAME.tar.xz" rtx
tar -czf "$BASENAME.tar.gz" rtx
if [ -f ~/.zipsign/rtx.priv ]; then
zipsign sign tar "$BASENAME.tar.gz" ~/.zipsign/rtx.priv
zipsign verify tar "$BASENAME.tar.gz" ../zipsign.pub
zipsign sign tar "$BASENAME.tar.gz" ~/.zipsign/rtx.priv
zipsign verify tar "$BASENAME.tar.gz" ../zipsign.pub
fi
ls -oh "$BASENAME.tar.xz"

View File

@ -1,5 +0,0 @@
Get-ChildItem target\release
New-Item dist\rtx\bin -ItemType Directory -ea 0
Copy-Item target\release\rtx.exe dist\rtx\bin\rtx.exe
$Env:RTX_VERSION = (cargo get version --pretty)
Compress-Archive -Path dist\rtx -DestinationPath dist\rtx-$env:RTX_VERSION-windows-x64.zip

View File

@ -2,9 +2,9 @@
set -euxo pipefail
if [[ "${NO_UPDATE:-}" == "1" ]]; then
echo "NO_UPDATE is set, skipping update"
echo "NO_UPDATE is set, skipping update"
else
cargo update && git add Cargo.lock
cargo update && git add Cargo.lock
fi
just render-mangen render-help

View File

@ -26,6 +26,6 @@ aws s3 cp artifacts/deb/dists/ "s3://$AWS_S3_BUCKET/deb/dists/" --cache-control
export CLOUDFLARE_ACCOUNT_ID=6e243906ff257b965bcae8025c2fc344
export CLOUDFLARE_ZONE_ID=80d977fd09f01db52bec165778088891
curl --fail-with-body -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{ "purge_everything": true }'
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{ "purge_everything": true }'

View File

@ -3,12 +3,12 @@ set -euxo pipefail
RTX_VERSION=$(./scripts/get-version.sh)
TAR_GZ_URI="https://github.com/jdx/rtx/releases/download/${RTX_VERSION}/rtx-${RTX_VERSION}-linux-x64.tar.gz"
TAR_GZ_URI="https://github.com/jdx/rtx/releases/download/$RTX_VERSION/rtx-$RTX_VERSION-linux-x64.tar.gz"
SHA512=$(curl -L "$TAR_GZ_URI" | sha512sum | awk '{print $1}')
if [ ! -d aur-bin ]; then
git clone ssh://aur@aur.archlinux.org/rtx-bin.git aur-bin
git clone ssh://aur@aur.archlinux.org/rtx-bin.git aur-bin
fi
git -C aur-bin pull
@ -29,19 +29,19 @@ source=("rtx-\$pkgver.tar.gz::${TAR_GZ_URI}")
sha512sums=('$SHA512')
build() {
cd "\$srcdir/"
rtx/bin/rtx completions bash > rtx.bash
rtx/bin/rtx completions fish > rtx.fish
rtx/bin/rtx completions zsh > _rtx
cd "\$srcdir/"
rtx/bin/rtx completions bash > rtx.bash
rtx/bin/rtx completions fish > rtx.fish
rtx/bin/rtx completions zsh > _rtx
}
package() {
cd "\$srcdir/"
install -Dm755 rtx/bin/rtx "\$pkgdir/usr/bin/rtx"
install -Dm644 rtx/man/man1/rtx.1 "\$pkgdir/usr/share/man/man1/rtx.1"
install -Dm644 rtx.bash "\$pkgdir/usr/share/bash-completion/completions/rtx"
install -Dm644 rtx.fish "\$pkgdir/usr/share/fish/completions/rtx.fish"
install -Dm644 _rtx "\$pkgdir/usr/share/zsh/site-functions/_rtx"
cd "\$srcdir/"
install -Dm755 rtx/bin/rtx "\$pkgdir/usr/bin/rtx"
install -Dm644 rtx/man/man1/rtx.1 "\$pkgdir/usr/share/man/man1/rtx.1"
install -Dm644 rtx.bash "\$pkgdir/usr/share/bash-completion/completions/rtx"
install -Dm644 rtx.fish "\$pkgdir/usr/share/fish/completions/rtx.fish"
install -Dm644 _rtx "\$pkgdir/usr/share/zsh/site-functions/_rtx"
}
check() {
@ -51,16 +51,16 @@ EOF
cat >aur-bin/.SRCINFO <<EOF
pkgbase = rtx-bin
pkgdesc = Polyglot runtime manager
pkgver = ${RTX_VERSION#v*}
pkgrel = 1
url = https://github.com/jdx/rtx
arch = x86_64
license = MIT
provides = rtx
conflicts = rtx
source = rtx-${RTX_VERSION#v*}.tar.gz::${TAR_GZ_URI}
sha512sums = $SHA512
pkgdesc = Polyglot runtime manager
pkgver = ${RTX_VERSION#v*}
pkgrel = 1
url = https://github.com/jdx/rtx
arch = x86_64
license = MIT
provides = rtx
conflicts = rtx
source = rtx-${RTX_VERSION#v*}.tar.gz::${TAR_GZ_URI}
sha512sums = $SHA512
pkgname = rtx-bin
EOF
@ -68,4 +68,6 @@ EOF
cd aur-bin
git add .SRCINFO PKGBUILD
git commit -m "rtx ${RTX_VERSION#v}"
git push
if [[ "$DRY_RUN" != 1 ]]; then
git push
fi

View File

@ -6,7 +6,7 @@ RTX_VERSION=$(./scripts/get-version.sh)
SHA512=$(curl -L "https://github.com/jdx/rtx/archive/$RTX_VERSION.tar.gz" | sha512sum | awk '{print $1}')
if [ ! -d aur ]; then
git clone ssh://aur@aur.archlinux.org/rtx.git aur
git clone ssh://aur@aur.archlinux.org/rtx.git aur
fi
git -C aur pull
@ -28,45 +28,45 @@ source=("\$pkgname-\$pkgver.tar.gz::https://github.com/jdx/\$pkgname/archive/v\$
sha512sums=('$SHA512')
prepare() {
cd "\$srcdir/\$pkgname-\$pkgver"
cargo fetch --locked --target "\$CARCH-unknown-linux-gnu"
cd "\$srcdir/\$pkgname-\$pkgver"
cargo fetch --locked --target "\$CARCH-unknown-linux-gnu"
}
build() {
cd "\$srcdir/\$pkgname-\$pkgver"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
cargo build --frozen --release
cd "\$srcdir/\$pkgname-\$pkgver"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
cargo build --frozen --release
}
package() {
cd "\$srcdir/\$pkgname-\$pkgver"
install -Dm755 target/release/rtx "\$pkgdir/usr/bin/rtx"
install -Dm644 man/man1/rtx.1 "\$pkgdir/usr/share/man/man1/rtx.1"
install -Dm644 completions/rtx.bash "\$pkgdir/usr/share/bash-completion/completions/rtx"
install -Dm644 completions/rtx.fish "\$pkgdir/usr/share/fish/completions/rtx.fish"
install -Dm644 completions/_rtx "\$pkgdir/usr/share/zsh/site-functions/_rtx"
cd "\$srcdir/\$pkgname-\$pkgver"
install -Dm755 target/release/rtx "\$pkgdir/usr/bin/rtx"
install -Dm644 man/man1/rtx.1 "\$pkgdir/usr/share/man/man1/rtx.1"
install -Dm644 completions/rtx.bash "\$pkgdir/usr/share/bash-completion/completions/rtx"
install -Dm644 completions/rtx.fish "\$pkgdir/usr/share/fish/completions/rtx.fish"
install -Dm644 completions/_rtx "\$pkgdir/usr/share/zsh/site-functions/_rtx"
}
check() {
cd "\$srcdir/\$pkgname-\$pkgver"
./target/release/rtx --version
cd "\$srcdir/\$pkgname-\$pkgver"
./target/release/rtx --version
}
EOF
cat >aur/.SRCINFO <<EOF
pkgbase = rtx
pkgdesc = Polyglot runtime manager
pkgver = ${RTX_VERSION#v*}
pkgrel = 1
url = https://github.com/jdx/rtx
arch = x86_64
license = MIT
makedepends = cargo
provides = rtx
conflicts = rtx
source = rtx-${RTX_VERSION#v*}.tar.gz::https://github.com/jdx/rtx/archive/$RTX_VERSION.tar.gz
sha512sums = $SHA512
pkgdesc = Polyglot runtime manager
pkgver = ${RTX_VERSION#v*}
pkgrel = 1
url = https://github.com/jdx/rtx
arch = x86_64
license = MIT
makedepends = cargo
provides = rtx
conflicts = rtx
source = rtx-${RTX_VERSION#v*}.tar.gz::https://github.com/jdx/rtx/archive/$RTX_VERSION.tar.gz
sha512sums = $SHA512
pkgname = rtx
EOF
@ -74,4 +74,6 @@ EOF
cd aur
git add .SRCINFO PKGBUILD
git commit -m "rtx ${RTX_VERSION#v}"
git push
if [ "$DRY_RUN" != 1 ]; then
git push
fi

View File

@ -2,52 +2,52 @@
set -euxo pipefail
error() {
echo "$@" >&2
exit 1
echo "$@" >&2
exit 1
}
if [[ -z "${NODE_AUTH_TOKEN:-}" ]]; then
echo "NODE_AUTH_TOKEN must be set" >&2
exit 0
echo "NODE_AUTH_TOKEN must be set" >&2
exit 0
fi
mkdir -p "$RELEASE_DIR/npm"
dist_tag_from_version() {
IFS="-" read -r -a version_split <<<"$1"
IFS="." read -r -a version_split <<<"${version_split[1]:-latest}"
echo "${version_split[0]}"
IFS="-" read -r -a version_split <<<"$1"
IFS="." read -r -a version_split <<<"${version_split[1]:-latest}"
echo "${version_split[0]}"
}
dist_tag="$(dist_tag_from_version "$RTX_VERSION")"
platforms=(
linux-x64
linux-x64-musl
linux-arm64
linux-arm64-musl
linux-armv6
linux-armv6-musl
linux-armv7
linux-armv7-musl
macos-x64
macos-arm64
linux-x64
linux-x64-musl
linux-arm64
linux-arm64-musl
linux-armv6
linux-armv6-musl
linux-armv7
linux-armv7-musl
macos-x64
macos-arm64
)
for platform in "${platforms[@]}"; do
# shellcheck disable=SC2206
platform_split=(${platform//-/ })
os="${platform_split[0]}"
arch="${platform_split[1]}"
# shellcheck disable=SC2206
platform_split=(${platform//-/ })
os="${platform_split[0]}"
arch="${platform_split[1]}"
if [[ "$os" == "macos" ]]; then
os="darwin"
fi
if [[ "$os" == "macos" ]]; then
os="darwin"
fi
cp "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform.tar.gz" "$RELEASE_DIR/rtx-latest-$platform.tar.gz"
cp "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform.tar.xz" "$RELEASE_DIR/rtx-latest-$platform.tar.xz"
tar -xzvf "$RELEASE_DIR/rtx-latest-$platform.tar.gz" -C "$RELEASE_DIR"
rm -rf "$RELEASE_DIR/npm"
mv "$RELEASE_DIR/rtx" "$RELEASE_DIR/npm"
cat <<EOF >"$RELEASE_DIR/npm/package.json"
cp "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform.tar.gz" "$RELEASE_DIR/rtx-latest-$platform.tar.gz"
cp "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform.tar.xz" "$RELEASE_DIR/rtx-latest-$platform.tar.xz"
tar -xzvf "$RELEASE_DIR/rtx-latest-$platform.tar.gz" -C "$RELEASE_DIR"
rm -rf "$RELEASE_DIR/npm"
mv "$RELEASE_DIR/rtx" "$RELEASE_DIR/npm"
cat <<EOF >"$RELEASE_DIR/npm/package.json"
{
"name": "$NPM_PREFIX-$os-$arch",
"version": "$RTX_VERSION",
@ -68,10 +68,10 @@ for platform in "${platforms[@]}"; do
"cpu": "$arch"
}
EOF
pushd "$RELEASE_DIR/npm"
tree || true
npm publish --access public --tag "$dist_tag"
popd
pushd "$RELEASE_DIR/npm"
tree || true
npm publish --access public --tag "$dist_tag"
popd
done
cat <<EOF >"$RELEASE_DIR/npm/installArchSpecificPackage.js"

View File

@ -10,30 +10,30 @@ export RTX_VERSION RELEASE_DIR
rm -rf "${RELEASE_DIR:?}/$RTX_VERSION"
mkdir -p "$RELEASE_DIR/$RTX_VERSION"
targets=$(find artifacts -name 'tarball-*' -exec basename {} \; | sed 's/^tarball-//')
for target in "${targets[@]}"; do
cp "artifacts/tarball-$target/"*.tar.gz "$RELEASE_DIR/$RTX_VERSION"
cp "artifacts/tarball-$target/"*.tar.xz "$RELEASE_DIR/$RTX_VERSION"
done
find artifacts -name 'tarball-*' -exec sh -c '
target=${1#artifacts/tarball-}
cp "artifacts/tarball-$target/"*.tar.gz "$RELEASE_DIR/$RTX_VERSION"
cp "artifacts/tarball-$target/"*.tar.xz "$RELEASE_DIR/$RTX_VERSION"
' sh {} \;
platforms=(
linux-x64
linux-x64-musl
linux-arm64
linux-arm64-musl
linux-armv6
linux-armv6-musl
linux-armv7
linux-armv7-musl
macos-x64
macos-arm64
linux-x64
linux-x64-musl
linux-arm64
linux-arm64-musl
linux-armv6
linux-armv6-musl
linux-armv7
linux-armv7-musl
macos-x64
macos-arm64
)
for platform in "${platforms[@]}"; do
cp "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform.tar.gz" "$RELEASE_DIR/rtx-latest-$platform.tar.gz"
cp "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform.tar.xz" "$RELEASE_DIR/rtx-latest-$platform.tar.xz"
tar -xvzf "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform.tar.gz"
cp -v rtx/bin/rtx "$RELEASE_DIR/rtx-latest-$platform"
cp -v rtx/bin/rtx "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform"
cp "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform.tar.gz" "$RELEASE_DIR/rtx-latest-$platform.tar.gz"
cp "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform.tar.xz" "$RELEASE_DIR/rtx-latest-$platform.tar.xz"
tar -xvzf "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform.tar.gz"
cp -v rtx/bin/rtx "$RELEASE_DIR/rtx-latest-$platform"
cp -v rtx/bin/rtx "$RELEASE_DIR/$RTX_VERSION/rtx-$RTX_VERSION-$platform"
done
pushd "$RELEASE_DIR"
@ -56,10 +56,12 @@ popd
./rtx/scripts/render-install.sh >"$RELEASE_DIR"/install.sh
gpg -u 408B88DB29DDE9E0 --output "$RELEASE_DIR"/install.sh.sig --sign "$RELEASE_DIR"/install.sh
NPM_PREFIX=@jdxcode/rtx ./rtx/scripts/release-npm.sh
NPM_PREFIX=rtx-cli ./rtx/scripts/release-npm.sh
#AWS_S3_BUCKET=rtx.pub ./rtx/scripts/publish-s3.sh
./rtx/scripts/publish-r2.sh
if [[ "$DRY_RUN" != 1 ]]; then
NPM_PREFIX=@jdxcode/rtx ./rtx/scripts/release-npm.sh
NPM_PREFIX=rtx-cli ./rtx/scripts/release-npm.sh
#AWS_S3_BUCKET=rtx.pub ./rtx/scripts/publish-s3.sh
./rtx/scripts/publish-r2.sh
fi
./rtx/scripts/render-homebrew.sh >homebrew-tap/rtx.rb
pushd homebrew-tap

View File

@ -3,15 +3,15 @@ set -euxo pipefail
# shellcheck disable=SC2016
RTX_VERSION=${RTX_VERSION#v*} \
RTX_CHECKSUM_LINUX_X86_64=$(grep "rtx-v$RTX_VERSION-linux-x64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_X86_64_MUSL=$(grep "rtx-v$RTX_VERSION-linux-x64-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARM64=$(grep "rtx-v$RTX_VERSION-linux-arm64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARM64_MUSL=$(grep "rtx-v$RTX_VERSION-linux-arm64-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARMV6=$(grep "rtx-v$RTX_VERSION-linux-armv6.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARMV6_MUSL=$(grep "rtx-v$RTX_VERSION-linux-armv6-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARMV7=$(grep "rtx-v$RTX_VERSION-linux-armv7.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARMV7_MUSL=$(grep "rtx-v$RTX_VERSION-linux-armv7-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_MACOS_X86_64=$(grep "rtx-v$RTX_VERSION-macos-x64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_MACOS_ARM64=$(grep "rtx-v$RTX_VERSION-macos-arm64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
envsubst '$RTX_VERSION,$RTX_CHECKSUM_LINUX_X86_64,$RTX_CHECKSUM_LINUX_ARM64,$RTX_CHECKSUM_MACOS_X86_64,$RTX_CHECKSUM_MACOS_ARM64' \
<rtx/packaging/homebrew/homebrew.rb
RTX_CHECKSUM_LINUX_X86_64=$(grep "rtx-v$RTX_VERSION-linux-x64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_X86_64_MUSL=$(grep "rtx-v$RTX_VERSION-linux-x64-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARM64=$(grep "rtx-v$RTX_VERSION-linux-arm64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARM64_MUSL=$(grep "rtx-v$RTX_VERSION-linux-arm64-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARMV6=$(grep "rtx-v$RTX_VERSION-linux-armv6.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARMV6_MUSL=$(grep "rtx-v$RTX_VERSION-linux-armv6-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARMV7=$(grep "rtx-v$RTX_VERSION-linux-armv7.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_LINUX_ARMV7_MUSL=$(grep "rtx-v$RTX_VERSION-linux-armv7-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_MACOS_X86_64=$(grep "rtx-v$RTX_VERSION-macos-x64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
RTX_CHECKSUM_MACOS_ARM64=$(grep "rtx-v$RTX_VERSION-macos-arm64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \
envsubst '$RTX_VERSION,$RTX_CHECKSUM_LINUX_X86_64,$RTX_CHECKSUM_LINUX_ARM64,$RTX_CHECKSUM_MACOS_X86_64,$RTX_CHECKSUM_MACOS_ARM64' \
<rtx/packaging/homebrew/homebrew.rb

View File

@ -3,15 +3,15 @@ set -euxo pipefail
# shellcheck disable=SC2016
RTX_VERSION=$RTX_VERSION \
RTX_CHECKSUM_LINUX_X86_64=$(grep "rtx-v.*linux-x64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_X86_64_MUSL=$(grep "rtx-v.*linux-x64-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARM64=$(grep "rtx-v.*linux-arm64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARM64_MUSL=$(grep "rtx-v.*linux-arm64-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARMV6=$(grep "rtx-v.*linux-armv6.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARMV6_MUSL=$(grep "rtx-v.*linux-armv6-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARMV7=$(grep "rtx-v.*linux-armv7.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARMV7_MUSL=$(grep "rtx-v.*linux-armv7-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_MACOS_X86_64=$(grep "rtx-v.*macos-x64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_MACOS_ARM64=$(grep "rtx-v.*macos-arm64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
envsubst '$RTX_VERSION,$RTX_CHECKSUM_LINUX_X86_64,$RTX_CHECKSUM_LINUX_ARM64,$RTX_CHECKSUM_MACOS_X86_64,$RTX_CHECKSUM_MACOS_ARM64' \
<rtx/packaging/standalone/install.envsubst
RTX_CHECKSUM_LINUX_X86_64=$(grep "rtx-v.*linux-x64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_X86_64_MUSL=$(grep "rtx-v.*linux-x64-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARM64=$(grep "rtx-v.*linux-arm64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARM64_MUSL=$(grep "rtx-v.*linux-arm64-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARMV6=$(grep "rtx-v.*linux-armv6.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARMV6_MUSL=$(grep "rtx-v.*linux-armv6-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARMV7=$(grep "rtx-v.*linux-armv7.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_LINUX_ARMV7_MUSL=$(grep "rtx-v.*linux-armv7-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_MACOS_X86_64=$(grep "rtx-v.*macos-x64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
RTX_CHECKSUM_MACOS_ARM64=$(grep "rtx-v.*macos-arm64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \
envsubst '$RTX_VERSION,$RTX_CHECKSUM_LINUX_X86_64,$RTX_CHECKSUM_LINUX_ARM64,$RTX_CHECKSUM_MACOS_X86_64,$RTX_CHECKSUM_MACOS_ARM64' \
<rtx/packaging/standalone/install.envsubst

View File

@ -2,8 +2,8 @@
set -euxo pipefail
if [ -z "$ZIPSIGN" ]; then
echo "ZIPSIGN is not defined"
exit 0
echo "ZIPSIGN is not defined"
exit 0
fi
cargo install zipsign

View File

@ -6,20 +6,20 @@ git clone --depth 1 https://github.com/asdf-vm/asdf-plugins
rm -f src/default_shorthands.rs
custom_plugins=(
'("pipenv", "https://github.com/rtx-plugins/rtx-pipenv.git"),'
'("poetry", "https://github.com/rtx-plugins/rtx-poetry.git"),'
'("tiny", "https://github.com/rtx-plugins/rtx-tiny.git"),'
'("pipenv", "https://github.com/rtx-plugins/rtx-pipenv.git"),'
'("poetry", "https://github.com/rtx-plugins/rtx-poetry.git"),'
'("tiny", "https://github.com/rtx-plugins/rtx-tiny.git"),'
)
asdf_plugins=$(find asdf-plugins/plugins -maxdepth 1 |
sort |
grep -v '/go$' |
grep -v '/golang$' |
grep -v '/java$' |
grep -v '/nodejs$' |
grep -v '/plugins$' |
grep -v '/python$' |
grep -v '/ruby$')
sort |
grep -v '/go$' |
grep -v '/golang$' |
grep -v '/java$' |
grep -v '/nodejs$' |
grep -v '/plugins$' |
grep -v '/python$' |
grep -v '/ruby$')
num_plugins=$(echo "$asdf_plugins" | wc -l | tr -d ' ')
num_plugins=$((num_plugins + ${#custom_plugins[@]}))
@ -54,14 +54,14 @@ const DEFAULT_SHORTHAND_LIST: [(&str, &str); $num_plugins] = [
// asdf original shorthands from https://github.com/asdf-vm/asdf-plugins
EOF
for file in $asdf_plugins; do
plugin=$(basename "$file")
repository=$(cat "$file")
repository="${repository/#repository = /}"
echo " (\"$plugin\", \"$repository\")," >>src/default_shorthands.rs
plugin=$(basename "$file")
repository=$(cat "$file")
repository="${repository/#repository = /}"
echo " (\"$plugin\", \"$repository\")," >>src/default_shorthands.rs
done
echo " // rtx custom shorthands" >>src/default_shorthands.rs
for plugin in "${custom_plugins[@]}"; do
echo " $plugin" >>src/default_shorthands.rs
echo " $plugin" >>src/default_shorthands.rs
done
echo "];" >>src/default_shorthands.rs
rm -rf asdf-plugins

View File

@ -123,7 +123,7 @@ pub fn local(
}
if !runtime.is_empty() {
let runtimes = ToolArg::double_tool_condition(&runtime.clone());
let runtimes = ToolArg::double_tool_condition(&runtime);
if cf.display_runtime(out, &runtimes)? {
return Ok(());
}

View File

@ -59,7 +59,7 @@ impl Client {
T: serde::de::DeserializeOwned,
{
let url = url.into_url().unwrap();
let resp = self.get(url.clone())?;
let resp = self.get(url)?;
let json = resp.json()?;
Ok(json)
}
@ -67,7 +67,7 @@ impl Client {
pub fn download_file<U: IntoUrl>(&self, url: U, path: &Path) -> Result<()> {
let url = url.into_url()?;
debug!("GET Downloading {} to {}", &url, display_path(path));
let mut resp = self.get(url.clone())?;
let mut resp = self.get(url)?;
file::create_dir_all(path.parent().unwrap())?;
let mut file = File::create(path)?;

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
def debug?
!!ENV["RTX_DEBUG"]
end

View File

@ -143,7 +143,7 @@ impl JavaPlugin {
.find(|e| e.as_ref().unwrap().file_type().unwrap().is_dir())
.unwrap()?
.path();
let contents_dir = basedir.join("Contents").clone();
let contents_dir = basedir.join("Contents");
let source_dir = match m.vendor.as_str() {
"zulu" | "liberica" => basedir,
_ if os() == "macosx" => basedir.join("Contents").join("Home"),

View File

@ -257,7 +257,7 @@ impl Plugin for NodePlugin {
let body = body.trim().strip_prefix('v').unwrap_or(&body);
// replace lts/* with lts
let body = body.replace("lts/*", "lts");
Ok(body.to_string())
Ok(body)
}
fn install_version_impl(&self, ctx: &InstallContext) -> Result<()> {

View File

@ -218,7 +218,7 @@ impl Plugin for NodeBuildPlugin {
let body = body.trim().strip_prefix('v').unwrap_or(&body);
// replace lts/* with lts
let body = body.replace("lts/*", "lts");
Ok(body.to_string())
Ok(body)
}
fn external_commands(&self) -> Result<Vec<Command>> {

View File

@ -14,6 +14,7 @@ fn init() {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("test"),
);
set_current_dir(env::HOME.join("cwd")).unwrap();
env::remove_var("RTX_TRUSTED_CONFIG_PATHS");
env::set_var("NO_COLOR", "1");
env::set_var("RTX_YES", "1");
env::set_var("RTX_USE_TOML", "0");

View File

@ -44,7 +44,7 @@ impl ToolVersion {
latest_versions: bool,
) -> Result<Self> {
if !tool.is_installed() {
let tv = Self::new(tool, request.clone(), opts.clone(), request.version());
let tv = Self::new(tool, request.clone(), opts, request.version());
return Ok(tv);
}
let tv = match request.clone() {