Skip to content

rtx

rtx #3643

Workflow file for this run

name: rtx
on:
push:
tags: ["v*"]
branches: ["main"]
pull_request:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
jobs:
unit:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- 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
- name: Run cargo nextest
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
coverage:
name: coverage-${{matrix.tranche}}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
tranche: [0, 1, 2, 3]
steps:
- name: Checkout
uses: actions/checkout@v4
- run: rustup toolchain install nightly --component llvm-tools-preview
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: coverage
save-if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Install zsh/fish/direnv
run: sudo apt-get update; sudo apt-get install zsh fish direnv
- name: Install just
uses: taiki-e/install-action@just
- name: Run tests with coverage
uses: nick-fields/retry@v2
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUST_BACKTRACE: "1"
RTX_GITHUB_BOT_TOKEN: ${{ secrets.RTX_GITHUB_BOT_TOKEN }}
TEST_TRANCHE: ${{matrix.tranche}}
TEST_TRANCHE_COUNT: 4
with:
timeout_minutes: 30
max_attempts: 2
command: just test-coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
files: lcov.info
build-linux:
name: build-${{matrix.target}}
runs-on: ubuntu-22.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
target:
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: "build-linux-${{matrix.target}}"
save-if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- uses: taiki-e/install-action@cross
- run: scripts/setup-zipsign.sh
env:
ZIPSIGN: ${{ secrets.ZIPSIGN }}
- run: scripts/build-tarball.sh rtx --release --features openssl/vendored --target ${{matrix.target}}
env:
CROSS: "1"
- uses: actions/upload-artifact@v3
with:
name: tarball-${{matrix.target}}
path: |
dist/rtx-*.tar.xz
dist/rtx-*.tar.gz
if-no-files-found: error
build-macos:
name: build-${{matrix.target}}
runs-on: macos-12
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
steps:
- uses: actions/checkout@v4
- run: rustup target add ${{matrix.target}}
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: "${{matrix.target}}"
save-if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- run: scripts/setup-zipsign.sh
env:
ZIPSIGN: ${{ secrets.ZIPSIGN }}
- run: scripts/build-tarball.sh rtx --release --features openssl/vendored --target ${{matrix.target}}
- uses: actions/upload-artifact@v3
with:
name: tarball-${{matrix.target}}
path: |
dist/rtx-*.tar.xz
dist/rtx-*.tar.gz
if-no-files-found: error
e2e-linux:
runs-on: ubuntu-22.04
needs: [build-linux]
timeout-minutes: 30
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Install zsh/fish/direnv
run: sudo apt-get update; sudo apt-get install zsh fish direnv
- uses: actions/download-artifact@v3
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: rtx -v
- name: Run e2e tests
uses: nick-fields/retry@v2
env:
RUST_BACKTRACE: "1"
with:
timeout_minutes: 20
max_attempts: 3
command: ./e2e/run_all_tests
rpm:
runs-on: ubuntu-22.04
needs: [build-linux]
timeout-minutes: 10
container: jdxcode/rtx:rpm
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_KEY }}
- uses: actions/download-artifact@v3
with:
name: tarball-x86_64-unknown-linux-gnu
path: dist
- uses: actions/download-artifact@v3
with:
name: tarball-aarch64-unknown-linux-gnu
path: dist
- run: scripts/build-rpm.sh
- uses: actions/upload-artifact@v3
with:
name: rpm
path: dist/rpmrepo
if-no-files-found: error
deb:
runs-on: ubuntu-22.04
container: jdxcode/rtx:deb
timeout-minutes: 10
if: github.event_name != 'pull_request'
needs: [build-linux]
steps:
- uses: actions/checkout@v4
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_KEY }}
- uses: actions/download-artifact@v3
with:
name: tarball-x86_64-unknown-linux-gnu
path: dist
- uses: actions/download-artifact@v3
with:
name: tarball-aarch64-unknown-linux-gnu
path: dist
- run: scripts/build-deb.sh
- uses: actions/upload-artifact@v3
with:
name: deb
path: dist/deb
if-no-files-found: error
release:
runs-on: ubuntu-22.04
if: startsWith(github.event.ref, 'refs/tags/v')
timeout-minutes: 10
permissions:
contents: write
needs:
- unit
- coverage
- e2e-linux
- build-linux
- build-macos
- rpm
- deb
steps:
- uses: actions/checkout@v4
with:
path: rtx
- uses: actions/checkout@v4
with:
repository: jdx/homebrew-tap
path: homebrew-tap
token: ${{ secrets.RTX_GITHUB_BOT_TOKEN }}
- name: Install fd-find
run: |
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
- 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 }}
known_hosts: ${{ secrets.RTX_KNOWN_HOSTS_AUR }}
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true
workdir: homebrew-tap
- uses: actions/download-artifact@v3
with: { path: artifacts }
- run: rtx/scripts/release.sh
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
CLOUDFLARE_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }}
CLOUDFLARE_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }}
- name: homebrew-tap push
run: git push
working-directory: homebrew-tap
- name: GitHub Release Assets
uses: softprops/action-gh-release@v1
if: startsWith(github.event.ref, 'refs/tags/v')
with:
fail_on_unmatched_files: true
draft: false
files: releases/${{github.ref_name}}/*
generate_release_notes: true
token: ${{ secrets.RTX_GITHUB_BOT_TOKEN }}
- name: Release to aur
run: scripts/release-aur.sh
working-directory: rtx
- name: Release aur-bin
run: scripts/release-aur-bin.sh
working-directory: rtx
bump-homebrew-formula:
runs-on: macos-latest
if: startsWith(github.event.ref, 'refs/tags/v')
timeout-minutes: 10
needs: [release]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Bump Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3
with:
token: ${{ secrets.RTX_GITHUB_BOT_TOKEN }}
formula: rtx
bump-alpine:
runs-on: ubuntu-22.04
container: jdxcode/rtx:alpine
timeout-minutes: 30
needs: [release]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Bump APKBUILD
run: sudo -Eu packager ./scripts/release-alpine.sh
env:
ALPINE_PUB_KEY: ${{ secrets.ALPINE_PUB_KEY }}
ALPINE_PRIV_KEY: ${{ secrets.ALPINE_PRIV_KEY }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}