~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0
main
57 lines · 2.3 KB Raw History
name: containers
description: The rust toolchain of rust/socialweb-meshd and the container runtime the build scripts drive

runs:
  using: composite
  steps:
    - name: rust
      shell: bash
      run: |
        set -euo pipefail
        export RUSTUP_HOME="$CI_STATE/rustup" CARGO_HOME="$CI_STATE/cargo"
        export PATH="$CARGO_HOME/bin:$PATH"
        echo "PATH=$CARGO_HOME/bin:$PATH" >>"$GITHUB_PATH"
        for v in RUSTUP_HOME CARGO_HOME; do echo "$v=${!v}" >>"$GITHUB_ENV"; done
        mkdir -p "$CI_STATE"
        if [ ! -x "$CARGO_HOME/bin/rustup" ]; then
          init="$CI_STATE/rustup-init"
          curl -fsSL --max-time 120 -o "$init" https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init
          echo "$(curl -fsSL --max-time 30 https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init.sha256 | cut -d' ' -f1)  $init" | sha256sum -c --quiet -
          chmod 0755 "$init"
          timeout -k 10 300 "$init" -y --quiet --no-modify-path --profile minimal --default-toolchain none
          rm -f "$init"
        fi
        (cd rust && rustup toolchain install) || true
        if ! (cd rust && rustc --version >/dev/null 2>&1); then
          rm -rf "$RUSTUP_HOME/toolchains"
          (cd rust && rustup toolchain install)
        fi
        (cd rust && rustc --version)

    - name: disk
      shell: bash
      run: |
        set -euo pipefail
        sudo -n rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/share/boost /opt/hostedtoolcache/CodeQL 2>/dev/null || true
        df -h "$CI_STATE" | tail -1

    - name: container runtime
      shell: bash
      run: |
        set -euo pipefail
        missing=""
        for tool in zstd; do
          command -v "$tool" >/dev/null 2>&1 || missing="$missing $tool"
        done
        if [ -n "$missing" ]; then
          sudo apt-get update -qq
          sudo apt-get install -y --no-install-recommends $missing
        fi
        if docker version --format '{{.Server.Version}}' >/dev/null 2>&1; then
          docker version --format 'docker {{.Server.Version}}'
          echo "CONTAINER=docker" >>"$GITHUB_ENV"
          exit 0
        fi
        . scripts/ci-podman-setup.sh
        for v in XDG_RUNTIME_DIR CONTAINERS_STORAGE_CONF CONTAINERS_CONF; do echo "$v=${!v}" >>"$GITHUB_ENV"; done
        echo "CONTAINER=podman" >>"$GITHUB_ENV"