From 01a4635b13cf53852b5dd25d6c4afb95bad25622 Mon Sep 17 00:00:00 2001 From: KnorpelSenf Date: Thu, 26 Dec 2024 12:48:13 +0000 Subject: [PATCH] chore: do not run `cargo install` as root --- .devcontainer/devcontainer.json | 2 +- .github/workflows/rust.yml | 2 +- build/postsetup.sh | 7 +++++++ build/setup.sh | 3 --- 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100755 build/postsetup.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e7cc9bd..736e79f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,5 +13,5 @@ ] } }, - "postCreateCommand": "mkdir -p ~/.local/share/bash-completion/completions && rustup completions bash > ~/.local/share/bash-completion/completions/rustup && rustup completions bash cargo > ~/.local/share/bash-completion/completions/cargo" + "postCreateCommand": "./build/postsetup.sh && P=~/.local/share/bash-completion/completions && mkdir -p $P && rustup completions bash > $P/rustup && rustup completions bash cargo > $P/cargo" } diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2f72360..0e98810 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,7 +25,7 @@ jobs: with: node-version: 22 - name: install deps - run: ./build/setup.sh + run: ./build/setup.sh && ./build/postsetup.sh - name: Build with all default solvers (no cplex) run: cargo build --features all_default_solvers --tests - name: Run tests with all default solvers (no cplex) diff --git a/build/postsetup.sh b/build/postsetup.sh new file mode 100755 index 0000000..ad47d80 --- /dev/null +++ b/build/postsetup.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# Print commands, exit upon error +set -ex + +# Install wasm-pack +cargo install wasm-pack diff --git a/build/setup.sh b/build/setup.sh index 47b0c16..f3dd625 100755 --- a/build/setup.sh +++ b/build/setup.sh @@ -13,6 +13,3 @@ DEBIAN_FRONTEND=noninteractive sudo apt-get install -y coinor-cbc coinor-libcbc- curl -LO https://github.com/rust-or/good_lp/releases/download/cplex/cplex.bin chmod u+x cplex.bin ./cplex.bin -f ./response.properties - -# Install wasm-pack -cargo install wasm-pack