Curl on ci (#110)
* Perform sudo in harmonic * Remove sudo in scripts * A bit more tweaking... * Yay unix * Use curl sh on ci * Preserve environments we require * Fix the yamls * Better explain a run step * Preserve GITHUB_PATH too * Correct trace * Include install-nix.sh in artifacts * Remove unused vars * Use /nix/harmonic for uninstall * Only pass --preserve-env if required * Wait for python server to start * Use a sudo uninstall * Pass verbosity correctly * Pass no-confirm by env * Pass no-confirm by env redux * Hahaha very funny yaml * handle env in no-confirm * Preserve env on ci * Mac stuff
This commit is contained in:
parent
fede228894
commit
29a345f99f
99
.github/workflows/ci.yml
vendored
99
.github/workflows/ci.yml
vendored
|
@ -5,6 +5,14 @@ on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
env:
|
||||||
|
NIX_INSTALL_FORCE_ALLOW_HTTP: "1"
|
||||||
|
NIX_INSTALL_UPDATE_ROOT: "http://0.0.0.0:8000"
|
||||||
|
RUST_BACKTRACE: "full"
|
||||||
|
HARMONIC_VERBOSITY: "2"
|
||||||
|
HARMONIC_NO_CONFIRM: "true"
|
||||||
|
HARMONIC_LOGGER: "pretty"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lints:
|
lints:
|
||||||
name: Lints
|
name: Lints
|
||||||
|
@ -29,6 +37,12 @@ jobs:
|
||||||
run: nix develop --store ~/.ci-store --command check-nixpkgs-fmt
|
run: nix develop --store ~/.ci-store --command check-nixpkgs-fmt
|
||||||
- name: Check EditorConfig conformance
|
- name: Check EditorConfig conformance
|
||||||
run: nix develop --store ~/.ci-store --command check-editorconfig
|
run: nix develop --store ~/.ci-store --command check-editorconfig
|
||||||
|
- name: Create artifact for `nix-install.sh`
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: nix-install
|
||||||
|
path: |
|
||||||
|
nix-install.sh
|
||||||
|
|
||||||
build-x86_64-linux:
|
build-x86_64-linux:
|
||||||
name: Build x86_64 Linux
|
name: Build x86_64 Linux
|
||||||
|
@ -53,7 +67,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
RESULT=$(nix eval --raw --store ~/.ci-store --print-build-logs .#packages.x86_64-linux.harmonicStatic --apply "x: \"$HOME/.ci-store\${x}\"")
|
RESULT=$(nix eval --raw --store ~/.ci-store --print-build-logs .#packages.x86_64-linux.harmonicStatic --apply "x: \"$HOME/.ci-store\${x}\"")
|
||||||
cp $RESULT/bin/harmonic harmonic
|
cp $RESULT/bin/harmonic harmonic
|
||||||
- name: Create artifact for x86_64-linux harmonicStatic
|
- name: Create artifact for x86_64-linux harmonic
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: harmonic-x86_64-linux
|
name: harmonic-x86_64-linux
|
||||||
|
@ -63,23 +77,34 @@ jobs:
|
||||||
run-x86_64-linux:
|
run-x86_64-linux:
|
||||||
name: Run x86_64 Linux
|
name: Run x86_64 Linux
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: build-x86_64-linux
|
needs: [build-x86_64-linux, lints]
|
||||||
steps:
|
steps:
|
||||||
- run: sudo apt install fish zsh
|
- run: sudo apt install fish zsh
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: harmonic-x86_64-linux
|
name: harmonic-x86_64-linux
|
||||||
- name: Set executable
|
- uses: actions/download-artifact@v3
|
||||||
run: chmod +x ./harmonic
|
with:
|
||||||
|
name: nix-install
|
||||||
|
- name: Move & set executable
|
||||||
|
run: |
|
||||||
|
chmod +x ./harmonic
|
||||||
|
mv harmonic harmonic-x86_64-linux
|
||||||
- name: Initial install
|
- name: Initial install
|
||||||
run: GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
run: |
|
||||||
|
python -m http.server --bind 0.0.0.0 8000 &
|
||||||
|
timeout 20 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/localhost/8000; do echo "Waiting for server..."; sleep 1; done'
|
||||||
|
curl -L http://0.0.0.0:8000/nix-install.sh | sh -s -- install linux-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}"
|
||||||
- name: Initial uninstall (without a `nix run` first)
|
- name: Initial uninstall (without a `nix run` first)
|
||||||
run: GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
run: sudo -E /nix/harmonic uninstall
|
||||||
- name: Repeated install
|
- name: Repeated install
|
||||||
run: GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
run: |
|
||||||
|
python -m http.server --bind 0.0.0.0 8000 &
|
||||||
|
timeout 20 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/localhost/8000; do echo "Waiting for server..."; sleep 1; done'
|
||||||
|
curl -L http://0.0.0.0:8000/nix-install.sh | sh -s -- install linux-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}"
|
||||||
- name: echo $PATH
|
- name: echo $PATH
|
||||||
run: echo $PATH
|
run: echo $PATH
|
||||||
- name: Test `nix`
|
- name: Test `nix` with `$GITHUB_PATH`
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
run: nix run nixpkgs#fortune
|
run: nix run nixpkgs#fortune
|
||||||
- name: Test bash
|
- name: Test bash
|
||||||
|
@ -99,19 +124,24 @@ jobs:
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
shell: fish --login {0}
|
shell: fish --login {0}
|
||||||
- name: Repeated uninstall
|
- name: Repeated uninstall
|
||||||
run: GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
run: sudo -E /nix/harmonic uninstall
|
||||||
|
|
||||||
run-steam-deck:
|
run-steam-deck:
|
||||||
name: Run Steam Deck (mock)
|
name: Run Steam Deck (mock)
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: build-x86_64-linux
|
needs: [build-x86_64-linux, lints]
|
||||||
steps:
|
steps:
|
||||||
- run: sudo apt install fish zsh
|
- run: sudo apt install fish zsh
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: harmonic-x86_64-linux
|
name: harmonic-x86_64-linux
|
||||||
- name: Set executable
|
- uses: actions/download-artifact@v3
|
||||||
run: chmod +x ./harmonic
|
with:
|
||||||
|
name: nix-install
|
||||||
|
- name: Move & set executable
|
||||||
|
run: |
|
||||||
|
chmod +x ./harmonic
|
||||||
|
mv harmonic harmonic-x86_64-linux
|
||||||
- name: Make the CI look like a steam deck
|
- name: Make the CI look like a steam deck
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/bin
|
mkdir -p ~/bin
|
||||||
|
@ -119,14 +149,20 @@ jobs:
|
||||||
sudo chmod +x /bin/steamos-readonly
|
sudo chmod +x /bin/steamos-readonly
|
||||||
sudo useradd -m deck
|
sudo useradd -m deck
|
||||||
- name: Initial install
|
- name: Initial install
|
||||||
run: GITHUB_PATH=$GITHUB_PATH PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install steam-deck --persistence `pwd`/ci-test-nix --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
run: |
|
||||||
|
python -m http.server --bind 0.0.0.0 8000 &
|
||||||
|
timeout 20 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/localhost/8000; do echo "Waiting for server..."; sleep 1; done'
|
||||||
|
curl -L http://0.0.0.0:8000/nix-install.sh | sh -s -- install steam-deck --persistence `pwd`/ci-test-nix --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}"
|
||||||
- name: Initial uninstall (without a `nix run` first)
|
- name: Initial uninstall (without a `nix run` first)
|
||||||
run: GITHUB_PATH=$GITHUB_PATH PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
run: sudo -E /nix/harmonic uninstall
|
||||||
- name: Repeated install
|
- name: Repeated install
|
||||||
run: GITHUB_PATH=$GITHUB_PATH PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install steam-deck --persistence `pwd`/ci-test-nix --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
run: |
|
||||||
|
python -m http.server --bind 0.0.0.0 8000 &
|
||||||
|
timeout 20 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/localhost/8000; do echo "Waiting for server..."; sleep 1; done'
|
||||||
|
curl -L http://0.0.0.0:8000/nix-install.sh | sh -s -- install steam-deck --persistence `pwd`/ci-test-nix --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}"
|
||||||
- name: echo $PATH
|
- name: echo $PATH
|
||||||
run: echo $PATH
|
run: echo $PATH
|
||||||
- name: Test `nix`
|
- name: Test `nix` with `$GITHUB_PATH`
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
run: nix run nixpkgs#fortune
|
run: nix run nixpkgs#fortune
|
||||||
- name: Test bash
|
- name: Test bash
|
||||||
|
@ -146,7 +182,7 @@ jobs:
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
shell: fish --login {0}
|
shell: fish --login {0}
|
||||||
- name: Repeated uninstall
|
- name: Repeated uninstall
|
||||||
run: GITHUB_PATH=$GITHUB_PATH PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
run: sudo -E /nix/harmonic uninstall
|
||||||
|
|
||||||
build-x86_64-darwin:
|
build-x86_64-darwin:
|
||||||
name: Build x86_64 Darwin
|
name: Build x86_64 Darwin
|
||||||
|
@ -170,23 +206,34 @@ jobs:
|
||||||
run-x86_64-darwin:
|
run-x86_64-darwin:
|
||||||
name: Run x86_64 Darwin
|
name: Run x86_64 Darwin
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
needs: build-x86_64-darwin
|
needs: [build-x86_64-darwin, lints]
|
||||||
steps:
|
steps:
|
||||||
- run: brew install fish
|
- run: brew install fish coreutils
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: harmonic-x86_64-darwin
|
name: harmonic-x86_64-darwin
|
||||||
- name: Set executable
|
- uses: actions/download-artifact@v3
|
||||||
run: chmod +x ./harmonic
|
with:
|
||||||
|
name: nix-install
|
||||||
|
- name: Move & set executable
|
||||||
|
run: |
|
||||||
|
chmod +x ./harmonic
|
||||||
|
mv harmonic harmonic-x86_64-darwin
|
||||||
- name: Initial install
|
- name: Initial install
|
||||||
run: GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
run: |
|
||||||
|
python3 -m http.server --bind 0.0.0.0 8000 &
|
||||||
|
gtimeout 20 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/localhost/8000; do echo "Waiting for server..."; sleep 1; done'
|
||||||
|
curl -L http://0.0.0.0:8000/nix-install.sh | sh -s -- install darwin-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}"
|
||||||
- name: Initial uninstall (without a `nix run` first)
|
- name: Initial uninstall (without a `nix run` first)
|
||||||
run: GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
run: sudo -E /nix/harmonic uninstall
|
||||||
- name: Repeated install
|
- name: Repeated install
|
||||||
run: GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
|
run: |
|
||||||
|
python -m http.server --bind 0.0.0.0 8000 &
|
||||||
|
timeout 20 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/localhost/8000; do echo "Waiting for server..."; sleep 1; done'
|
||||||
|
curl -L http://0.0.0.0:8000/nix-install.sh | sh -s -- install darwin-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}"
|
||||||
- name: echo $PATH
|
- name: echo $PATH
|
||||||
run: echo $PATH
|
run: echo $PATH
|
||||||
- name: Test `nix`
|
- name: Test `nix` with `$GITHUB_PATH`
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
run: nix run nixpkgs#fortune
|
run: nix run nixpkgs#fortune
|
||||||
- name: Test bash
|
- name: Test bash
|
||||||
|
@ -206,5 +253,5 @@ jobs:
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
shell: fish --login {0}
|
shell: fish --login {0}
|
||||||
- name: Repeated uninstall
|
- name: Repeated uninstall
|
||||||
run: GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
run: sudo -E /nix/harmonic uninstall
|
||||||
|
|
|
@ -77,6 +77,9 @@ main() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
if [ "${HARMONIC_NO_CONFIRM-}" ]; then
|
||||||
|
need_tty=no
|
||||||
|
fi
|
||||||
|
|
||||||
if $_ansi_escapes_are_valid; then
|
if $_ansi_escapes_are_valid; then
|
||||||
printf "\33[1minfo:\33[0m downloading installer \33[4m%s\33[0m\n" "$_url" 1>&2
|
printf "\33[1minfo:\33[0m downloading installer \33[4m%s\33[0m\n" "$_url" 1>&2
|
||||||
|
|
|
@ -29,10 +29,10 @@ impl std::fmt::Display for Logger {
|
||||||
#[derive(clap::Args, Debug, Valuable)]
|
#[derive(clap::Args, Debug, Valuable)]
|
||||||
pub struct Instrumentation {
|
pub struct Instrumentation {
|
||||||
/// Enable debug logs, -vv for trace
|
/// Enable debug logs, -vv for trace
|
||||||
#[clap(short = 'v', long, action = clap::ArgAction::Count, global = true)]
|
#[clap(short = 'v', env = "HARMONIC_VERBOSITY", long, action = clap::ArgAction::Count, global = true)]
|
||||||
pub verbose: u8,
|
pub verbose: u8,
|
||||||
/// Which logger to use
|
/// Which logger to use
|
||||||
#[clap(long, default_value_t = Default::default(), global = true)]
|
#[clap(long, env = "HARMONIC_LOGGER", default_value_t = Default::default(), global = true)]
|
||||||
pub logger: Logger,
|
pub logger: Logger,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ use owo_colors::OwoColorize;
|
||||||
pub struct Install {
|
pub struct Install {
|
||||||
#[clap(
|
#[clap(
|
||||||
long,
|
long,
|
||||||
|
env = "HARMONIC_NO_CONFIRM",
|
||||||
action(ArgAction::SetTrue),
|
action(ArgAction::SetTrue),
|
||||||
default_value = "false",
|
default_value = "false",
|
||||||
global = true
|
global = true
|
||||||
|
@ -30,6 +31,7 @@ pub struct Install {
|
||||||
|
|
||||||
#[clap(
|
#[clap(
|
||||||
long,
|
long,
|
||||||
|
env = "HARMONIC_EXPLAIN",
|
||||||
action(ArgAction::SetTrue),
|
action(ArgAction::SetTrue),
|
||||||
default_value = "false",
|
default_value = "false",
|
||||||
global = true
|
global = true
|
||||||
|
|
|
@ -21,6 +21,7 @@ use crate::cli::{interaction, CommandExecute};
|
||||||
pub struct Uninstall {
|
pub struct Uninstall {
|
||||||
#[clap(
|
#[clap(
|
||||||
long,
|
long,
|
||||||
|
env = "HARMONIC_NO_CONFIRM",
|
||||||
action(ArgAction::SetTrue),
|
action(ArgAction::SetTrue),
|
||||||
default_value = "false",
|
default_value = "false",
|
||||||
global = true
|
global = true
|
||||||
|
@ -28,6 +29,7 @@ pub struct Uninstall {
|
||||||
pub no_confirm: bool,
|
pub no_confirm: bool,
|
||||||
#[clap(
|
#[clap(
|
||||||
long,
|
long,
|
||||||
|
env = "HARMONIC_EXPLAIN",
|
||||||
action(ArgAction::SetTrue),
|
action(ArgAction::SetTrue),
|
||||||
default_value = "false",
|
default_value = "false",
|
||||||
global = true
|
global = true
|
||||||
|
|
Loading…
Reference in a new issue