forked from lix-project/lix-installer
c4274c93fb
* Add action * Checkout so we have actions.yml * yaml poking * Handle GITHUB_TOKEN * Don't ask github to do templating, use directives for logging * Missing changes * Fix build error * Fix yaml even more * Add shell command * Add a wait on the socket again * Print some debugging * Use more correct env vars * Correct install url logic * Use different style for inputs * Fix yaml errror * Tweak around local-root * provision nix-install.sh as well * Use nix-install.sh path directory in NIX_INSTALL_URL * Tweak variables to hopefully work * Call it BINARY_ROOT instead * Add exec output * Set no-confirm * no echo * Add token to workflow * Set no-confirm properly * Add no-confirm back for uninstall * Correct some env and vars * CreateDirectory respects existing symlink * Add a few more checks to the CI * pass valid yaml... * Slightly more aggressive cleanup of /nix * Ensure steam-deck cleans /home/nix * Add steam-deck check for persistence * Canonicalize steam-deck persistence * Ensure absolute path * Inverted logic sad * python3 on mac * Add readme info and fix a extra-conf mistype * Add unsaved changes * More fine grained trace logging * Restore spans we lost in refactor * BuiltinPlanner can accept settings * Reflect feedback * Push actually working code hopefully this time * Speeling
382 lines
13 KiB
YAML
382 lines
13 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 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 harmonic
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: harmonic-x86_64-linux
|
|
path: |
|
|
harmonic
|
|
|
|
# Various feature variations or versions of the build which we expect to always work
|
|
# Since it uses the `build-store-x86_64-linux-*` cache it should be quite fast
|
|
build-variants-x86_64-linux:
|
|
name: Build x86_64 Linux (Variants)
|
|
runs-on: ubuntu-22.04
|
|
needs: build-x86_64-linux # Only run this if the normal checks work, to avoid clogging builders
|
|
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: Test `nix develop` build without default features
|
|
run: nix develop --store ~/.ci-store --print-build-logs .# --command "cargo" build --no-default-features
|
|
- name: Test `nix develop` build all features
|
|
run: nix develop --store ~/.ci-store --print-build-logs .# --command "cargo" build --all-features
|
|
|
|
run-x86_64-linux:
|
|
name: Run x86_64 Linux
|
|
runs-on: ubuntu-22.04
|
|
needs: [build-x86_64-linux, lints]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- run: sudo apt install fish zsh
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: harmonic-x86_64-linux
|
|
- name: Move & set executable
|
|
run: |
|
|
chmod +x ./harmonic
|
|
mkdir install-root
|
|
cp nix-install.sh install-root/nix-install.sh
|
|
mv harmonic install-root/harmonic-x86_64-linux
|
|
- name: Initial install
|
|
uses: ./
|
|
with:
|
|
local-root: install-root/
|
|
logger: pretty
|
|
log-directives: harmonic=trace
|
|
backtrace: full
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Initial uninstall (without a `nix run` first)
|
|
run: sudo -E /nix/harmonic uninstall
|
|
env:
|
|
HARMONIC_NO_CONFIRM: true
|
|
HARMONIC_LOGGER: pretty
|
|
HARMONIC_LOG_DIRECTIVES: harmonic=trace
|
|
RUST_BACKTRACE: full
|
|
- name: Ensure `nix` is removed
|
|
run: |
|
|
if systemctl is-active nix-daemon.socket; then
|
|
echo "nix-daemon.socket was still running"
|
|
exit 1
|
|
fi
|
|
if systemctl is-active nix-daemon.service; then
|
|
echo "nix-daemon.service was still running"
|
|
exit 1
|
|
fi
|
|
if [ -e /nix ]; then
|
|
echo "/nix exists"
|
|
exit 1
|
|
fi
|
|
- name: Repeated install
|
|
uses: ./
|
|
with:
|
|
local-root: install-root/
|
|
logger: pretty
|
|
log-directives: harmonic=trace
|
|
backtrace: full
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: echo $PATH
|
|
run: echo $PATH
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
|
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 -E /nix/harmonic uninstall
|
|
env:
|
|
HARMONIC_NO_CONFIRM: true
|
|
HARMONIC_LOGGER: pretty
|
|
HARMONIC_LOG_DIRECTIVES: harmonic=trace
|
|
RUST_BACKTRACE: full
|
|
- name: Ensure `nix` is removed
|
|
run: |
|
|
if systemctl is-active nix-daemon.socket; then
|
|
echo "nix-daemon.socket was still running"
|
|
exit 1
|
|
fi
|
|
if systemctl is-active nix-daemon.service; then
|
|
echo "nix-daemon.service was still running"
|
|
exit 1
|
|
fi
|
|
if [ -e /nix ]; then
|
|
echo "/nix exists"
|
|
exit 1
|
|
fi
|
|
|
|
run-steam-deck:
|
|
name: Run Steam Deck (mock)
|
|
runs-on: ubuntu-22.04
|
|
needs: [build-x86_64-linux, lints]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- run: sudo apt install fish zsh
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: harmonic-x86_64-linux
|
|
- name: Move & set executable
|
|
run: |
|
|
chmod +x ./harmonic
|
|
mkdir install-root
|
|
cp nix-install.sh install-root/nix-install.sh
|
|
mv harmonic install-root/harmonic-x86_64-linux
|
|
- 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
|
|
uses: ./
|
|
with:
|
|
local-root: install-root/
|
|
logger: pretty
|
|
log-directives: harmonic=trace
|
|
backtrace: full
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
planner: steam-deck
|
|
extra-args: --persistence /home/runner/.ci-test-nix-home
|
|
- name: Initial uninstall (without a `nix run` first)
|
|
run: sudo -E /nix/harmonic uninstall
|
|
env:
|
|
HARMONIC_NO_CONFIRM: true
|
|
HARMONIC_LOGGER: pretty
|
|
HARMONIC_LOG_DIRECTIVES: harmonic=trace
|
|
RUST_BACKTRACE: full
|
|
- name: Ensure `nix` is removed
|
|
run: |
|
|
if systemctl is-active nix-daemon.socket; then
|
|
echo "nix-daemon.socket was still running"
|
|
exit 1
|
|
fi
|
|
if systemctl is-active nix-daemon.service; then
|
|
echo "nix-daemon.service was still running"
|
|
exit 1
|
|
fi
|
|
if [ -e /nix ]; then
|
|
echo "/nix exists"
|
|
exit 1
|
|
fi
|
|
if [ -e /home/runner/.ci-test-nix-home ]; then
|
|
echo "/home/runner/.ci-test-nix-home exists"
|
|
exit 1
|
|
fi
|
|
- name: Repeated install
|
|
uses: ./
|
|
with:
|
|
local-root: install-root/
|
|
logger: pretty
|
|
log-directives: harmonic=trace
|
|
backtrace: full
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
planner: steam-deck
|
|
extra-args: --persistence /home/runner/.ci-test-nix-home
|
|
- name: echo $PATH
|
|
run: echo $PATH
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
|
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 -E /nix/harmonic uninstall
|
|
env:
|
|
HARMONIC_NO_CONFIRM: true
|
|
HARMONIC_LOGGER: pretty
|
|
HARMONIC_LOG_DIRECTIVES: harmonic=trace
|
|
RUST_BACKTRACE: full
|
|
- name: Ensure `nix` is removed
|
|
run: |
|
|
if systemctl is-active nix-daemon.socket; then
|
|
echo "nix-daemon.socket was still running"
|
|
exit 1
|
|
fi
|
|
if systemctl is-active nix-daemon.service; then
|
|
echo "nix-daemon.service was still running"
|
|
exit 1
|
|
fi
|
|
if [ -e /nix ]; then
|
|
echo "/nix exists"
|
|
exit 1
|
|
fi
|
|
if [ -e /home/runner/.ci-test-nix-home ]; then
|
|
echo "/home/runner/.ci-test-nix-home exists"
|
|
exit 1
|
|
fi
|
|
|
|
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, lints]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- run: brew install fish coreutils
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: harmonic-x86_64-darwin
|
|
- name: Move & set executable
|
|
run: |
|
|
chmod +x ./harmonic
|
|
mkdir install-root
|
|
cp nix-install.sh install-root/nix-install.sh
|
|
mv harmonic install-root/harmonic-x86_64-darwin
|
|
- name: Initial install
|
|
uses: ./
|
|
with:
|
|
local-root: install-root/
|
|
logger: pretty
|
|
log-directives: harmonic=trace
|
|
backtrace: full
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Initial uninstall (without a `nix run` first)
|
|
run: sudo -E /nix/harmonic uninstall
|
|
env:
|
|
HARMONIC_NO_CONFIRM: true
|
|
HARMONIC_LOGGER: pretty
|
|
HARMONIC_LOG_DIRECTIVES: harmonic=trace
|
|
RUST_BACKTRACE: full
|
|
- name: Repeated install
|
|
uses: ./
|
|
with:
|
|
local-root: install-root/
|
|
logger: pretty
|
|
log-directives: harmonic=trace
|
|
backtrace: full
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: echo $PATH
|
|
run: echo $PATH
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
|
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 -E /nix/harmonic uninstall
|
|
env:
|
|
HARMONIC_NO_CONFIRM: true
|
|
HARMONIC_LOGGER: pretty
|
|
HARMONIC_LOG_DIRECTIVES: harmonic=trace
|
|
RUST_BACKTRACE: full
|
|
|