forked from lix-project/lix-installer
cfded4bb8a
* Move binary out of /nix if it is there during uninstall * Add tracing * Stick some random bytes on the end of the tmp exe
212 lines
8.9 KiB
YAML
212 lines
8.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
lints:
|
|
name: Lints
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: cachix/install-nix-action@v17
|
|
with:
|
|
extra_nix_config: |
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
- name: Cache lint store (x86_64-linux)
|
|
id: lint-store-x86_64-linux
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.ci-store
|
|
key: lint-store-x86_64-linux-${{ hashFiles('**/Cargo.lock', '**/flake.lock') }}-v1
|
|
- name: Check rustfmt
|
|
run: nix develop --store ~/.ci-store --command check-rustfmt
|
|
- name: Check Spelling
|
|
run: nix develop --store ~/.ci-store --command check-spelling
|
|
- name: Check nixpkgs-fmt formatting
|
|
run: nix develop --store ~/.ci-store --command check-nixpkgs-fmt
|
|
- name: Check EditorConfig conformance
|
|
run: nix develop --store ~/.ci-store --command check-editorconfig
|
|
|
|
build-x86_64-linux:
|
|
name: Build x86_64 Linux
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: cachix/install-nix-action@v17
|
|
with:
|
|
extra_nix_config: |
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
- name: Cache build store (x86_64-linux)
|
|
id: build-store-x86_64-linux
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.ci-store
|
|
key: build-store-x86_64-linux-${{ hashFiles('**/Cargo.lock', '**/flake.lock') }}-v1
|
|
- name: Build harmonic
|
|
run: nix build --store ~/.ci-store --print-build-logs .#packages.x86_64-linux.harmonic
|
|
- name: Build harmonicStatic
|
|
run: nix build --store ~/.ci-store --print-build-logs .#packages.x86_64-linux.harmonicStatic
|
|
- name: Copy artifact
|
|
run: |
|
|
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
|
|
- name: Create artifact for x86_64-linux harmonicStatic
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: harmonic-x86_64-linux
|
|
path: |
|
|
harmonic
|
|
|
|
run-x86_64-linux:
|
|
name: Run x86_64 Linux
|
|
runs-on: ubuntu-22.04
|
|
needs: build-x86_64-linux
|
|
steps:
|
|
- run: sudo apt install fish zsh
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: harmonic-x86_64-linux
|
|
- name: Set executable
|
|
run: chmod +x ./harmonic
|
|
- name: Initial install
|
|
run: sudo 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
|
|
- name: Initial uninstall (without a `nix run` first)
|
|
run: sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
|
- name: Repeated install
|
|
run: sudo 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
|
|
- name: echo $PATH
|
|
run: echo $PATH
|
|
- name: Test `nix`
|
|
if: success() || failure()
|
|
run: nix run nixpkgs#fortune
|
|
- name: Test bash
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
if: success() || failure()
|
|
shell: bash --login {0}
|
|
- name: Test sh
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
if: success() || failure()
|
|
shell: sh -l {0}
|
|
- name: Test zsh
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
if: success() || failure()
|
|
shell: zsh --login --interactive {0}
|
|
## Broken until https://github.com/NixOS/nix/pull/7105 is released due to the version on Ubuntu's runners
|
|
# - name: Test fish
|
|
# run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
# if: success() || failure()
|
|
# shell: fish --login {0}
|
|
- name: Repeated uninstall
|
|
run: sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
|
|
|
|
run-steam-deck:
|
|
name: Run Steam Deck (mock)
|
|
runs-on: ubuntu-22.04
|
|
needs: build-x86_64-linux
|
|
steps:
|
|
- run: sudo apt install fish zsh
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: harmonic-x86_64-linux
|
|
- name: Set executable
|
|
run: chmod +x ./harmonic
|
|
- name: Make the CI look like a steam deck
|
|
run: |
|
|
mkdir -p ~/bin
|
|
echo -e "#! /bin/sh\nexit 0" | sudo tee -a /bin/steamos-readonly
|
|
sudo chmod +x /bin/steamos-readonly
|
|
sudo useradd -m deck
|
|
- name: Initial install
|
|
run: sudo 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
|
|
- name: Initial uninstall (without a `nix run` first)
|
|
run: sudo GITHUB_PATH=$GITHUB_PATH PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
|
- name: Repeated install
|
|
run: sudo 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
|
|
- name: echo $PATH
|
|
run: echo $PATH
|
|
- name: Test `nix`
|
|
if: success() || failure()
|
|
run: nix run nixpkgs#fortune
|
|
- name: Test bash
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
if: success() || failure()
|
|
shell: bash --login {0}
|
|
- name: Test sh
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
if: success() || failure()
|
|
shell: sh -l {0}
|
|
- name: Test zsh
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
if: success() || failure()
|
|
shell: zsh --login --interactive {0}
|
|
## Broken until https://github.com/NixOS/nix/pull/7105 is released due to the version on Ubuntu's runners
|
|
# - name: Test fish
|
|
# run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
# if: success() || failure()
|
|
# shell: fish --login {0}
|
|
- name: Repeated uninstall
|
|
run: sudo GITHUB_PATH=$GITHUB_PATH PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
|
|
|
build-x86_64-darwin:
|
|
name: Build x86_64 Darwin
|
|
runs-on: macos-12
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: cachix/install-nix-action@v17
|
|
with:
|
|
extra_nix_config: |
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
|
# Runs clippy as part of the preBuild.
|
|
- name: Build harmonic
|
|
run: nix build .#packages.x86_64-darwin.harmonic -L
|
|
- name: Create artifact for x86_64-darwin harmonic
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: harmonic-x86_64-darwin
|
|
path: |
|
|
result/bin/harmonic
|
|
|
|
run-x86_64-darwin:
|
|
name: Run x86_64 Darwin
|
|
runs-on: macos-12
|
|
needs: build-x86_64-darwin
|
|
steps:
|
|
- run: brew install fish
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: harmonic-x86_64-darwin
|
|
- name: Set executable
|
|
run: chmod +x ./harmonic
|
|
- name: Initial install
|
|
run: sudo 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
|
|
- name: Initial uninstall (without a `nix run` first)
|
|
run: sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
|
- name: Repeated install
|
|
run: sudo 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
|
|
- name: echo $PATH
|
|
run: echo $PATH
|
|
- name: Test `nix`
|
|
if: success() || failure()
|
|
run: nix run nixpkgs#fortune
|
|
- name: Test bash
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
if: success() || failure()
|
|
shell: bash --login {0}
|
|
- name: Test sh
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
if: success() || failure()
|
|
shell: sh -l {0}
|
|
- name: Test zsh
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
if: success() || failure()
|
|
shell: zsh --login --interactive {0}
|
|
- name: Test fish
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
if: success() || failure()
|
|
shell: fish --login {0}
|
|
- name: Repeated uninstall
|
|
run: sudo GITHUB_PATH=$GITHUB_PATH RUST_LOG=harmonic=trace RUST_BACKTRACE=full /nix/harmonic uninstall --no-confirm
|
|
|