lade 0.17.2

Automatically load secrets from your preferred vault as environment variables, and clear them once your shell command is over.
on:
  push:
    branches:
      - main
  pull_request:
    types:
      - opened
      - synchronize
      - ready_for_review

jobs:
  lint:
    runs-on: ubuntu-24.04
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@v2
        with:
          key: lint
      - uses: pre-commit/action@v3.0.1
      - uses: rhysd/actionlint@v1.7.12

  test-native:
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-24.04
          - os: macos-15

    runs-on: ${{ matrix.os }}
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
        with:
          key: ${{ runner.os }}-native

      - name: Install dependencies on Linux
        if: runner.os == 'Linux'
        run: |
          sudo apt-get update
          sudo apt-get install -y bash fish zsh

      - name: Install dependencies on macOS
        if: runner.os == 'macOS'
        run: |
          brew update
          brew install fish zsh

      - name: Tool versions
        run: |
          bash --version
          fish --version
          zsh --version

      - name: Run native tests
        run: |
          cargo run --no-default-features -- --help
          cargo test --workspace --locked --no-default-features

  test-docker:
    runs-on: ubuntu-24.04
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
        with:
          key: ubuntu-docker

      - name: Set up Docker
        uses: docker/setup-docker-action@v5

      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y bash curl fish kubectl wget zsh

      - name: Install k3d
        run: curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash

      - name: Install Vault CLI
        run: |
          wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
          echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
          sudo apt-get update && sudo apt-get install -y vault=1.18.3-1
          vault --version

      - name: Tool versions
        run: |
          bash --version
          fish --version
          zsh --version
          docker info
          k3d version
          kubectl version --client=true
          vault --version

      - name: Run Docker tests
        run: cargo test -p lade --locked --no-default-features --features docker-tests --test docker

  installer-unit:
    runs-on: ubuntu-24.04
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v6
      - name: Install shellcheck
        run: sudo apt-get update && sudo apt-get install -y shellcheck
      - name: Run installer unit test
        run: bash tests/installer_test.sh

  installer-e2e:
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-24.04
          - os: macos-15
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v6
      - name: Install wget on macOS
        if: runner.os == 'macOS'
        run: brew install wget
      - name: curl|bash the pushed commit (latest)
        shell: bash
        run: |
          set -euo pipefail
          REF="${{ github.event.pull_request.head.sha || github.sha }}"
          REPO="${{ github.event.pull_request.head.repo.full_name || github.repository }}"
          mkdir -p "$HOME/lade-curl"
          for attempt in 1 2; do
            if curl -fsSL "https://raw.githubusercontent.com/$REPO/$REF/installer.sh" \
              | CI=1 OUT_DIR="$HOME/lade-curl" bash; then
              break
            fi
            test "$attempt" -eq 1
          done
          "$HOME/lade-curl/lade" --version
      - name: wget|bash the checked-out installer (latest)
        shell: bash
        run: |
          set -euo pipefail
          mkdir -p "$HOME/lade-wget"
          for attempt in 1 2; do
            if CI=1 DOWNLOADER=wget OUT_DIR="$HOME/lade-wget" sh ./installer.sh; then
              break
            fi
            test "$attempt" -eq 1
          done
          "$HOME/lade-wget/lade" --version