2022-09-09 19:02:43 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
|
2022-12-12 17:27:43 +00:00
|
|
|
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"
|
|
|
|
|
2022-09-09 19:02:43 +00:00
|
|
|
jobs:
|
2022-11-14 17:57:04 +00:00
|
|
|
lints:
|
2022-11-14 16:45:41 +00:00
|
|
|
name: Lints
|
2022-11-16 21:08:42 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-09-09 19:02:43 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: cachix/install-nix-action@v17
|
|
|
|
with:
|
|
|
|
extra_nix_config: |
|
|
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
2022-11-16 21:08:42 +00:00
|
|
|
- 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
|
2022-09-09 19:02:43 +00:00
|
|
|
- name: Check rustfmt
|
2022-12-05 18:27:12 +00:00
|
|
|
run: nix develop --store ~/.ci-store --command check-rustfmt
|
2022-09-09 19:02:43 +00:00
|
|
|
- name: Check Spelling
|
2022-12-05 18:27:12 +00:00
|
|
|
run: nix develop --store ~/.ci-store --command check-spelling
|
2022-09-09 19:02:43 +00:00
|
|
|
- name: Check nixpkgs-fmt formatting
|
2022-12-05 18:27:12 +00:00
|
|
|
run: nix develop --store ~/.ci-store --command check-nixpkgs-fmt
|
2022-09-09 19:02:43 +00:00
|
|
|
- name: Check EditorConfig conformance
|
2022-12-05 18:27:12 +00:00
|
|
|
run: nix develop --store ~/.ci-store --command check-editorconfig
|
2022-12-12 17:27:43 +00:00
|
|
|
- name: Create artifact for `nix-install.sh`
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: nix-install
|
|
|
|
path: |
|
|
|
|
nix-install.sh
|
2022-09-09 19:02:43 +00:00
|
|
|
|
2022-11-14 16:45:41 +00:00
|
|
|
build-x86_64-linux:
|
|
|
|
name: Build x86_64 Linux
|
2022-11-16 21:08:42 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-09-09 19:02:43 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: cachix/install-nix-action@v17
|
|
|
|
with:
|
|
|
|
extra_nix_config: |
|
|
|
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
2022-11-16 21:08:42 +00:00
|
|
|
- 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
|
2022-09-09 19:02:43 +00:00
|
|
|
- name: Build harmonic
|
2022-11-16 21:08:42 +00:00
|
|
|
run: nix build --store ~/.ci-store --print-build-logs .#packages.x86_64-linux.harmonic
|
2022-09-09 19:02:43 +00:00
|
|
|
- name: Build harmonicStatic
|
2022-11-16 21:08:42 +00:00
|
|
|
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
|
2022-12-12 17:27:43 +00:00
|
|
|
- name: Create artifact for x86_64-linux harmonic
|
2022-09-09 19:02:43 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: harmonic-x86_64-linux
|
|
|
|
path: |
|
2022-11-16 21:08:42 +00:00
|
|
|
harmonic
|
2022-09-09 19:02:43 +00:00
|
|
|
|
2022-11-14 16:45:41 +00:00
|
|
|
run-x86_64-linux:
|
|
|
|
name: Run x86_64 Linux
|
2022-11-16 21:08:42 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-12-12 17:27:43 +00:00
|
|
|
needs: [build-x86_64-linux, lints]
|
2022-11-08 19:30:49 +00:00
|
|
|
steps:
|
2022-12-07 16:22:24 +00:00
|
|
|
- run: sudo apt install fish zsh
|
2022-11-08 19:30:49 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: harmonic-x86_64-linux
|
2022-12-12 17:27:43 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: nix-install
|
|
|
|
- name: Move & set executable
|
|
|
|
run: |
|
|
|
|
chmod +x ./harmonic
|
|
|
|
mv harmonic harmonic-x86_64-linux
|
2022-11-08 19:30:49 +00:00
|
|
|
- name: Initial install
|
2022-12-12 17:27:43 +00:00
|
|
|
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 }}"
|
2022-12-02 15:31:15 +00:00
|
|
|
- name: Initial uninstall (without a `nix run` first)
|
2022-12-12 17:27:43 +00:00
|
|
|
run: sudo -E /nix/harmonic uninstall
|
2022-12-02 15:31:15 +00:00
|
|
|
- name: Repeated install
|
2022-12-12 17:27:43 +00:00
|
|
|
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 }}"
|
2022-12-07 16:22:24 +00:00
|
|
|
- name: echo $PATH
|
|
|
|
run: echo $PATH
|
2022-12-12 17:27:43 +00:00
|
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
2022-12-07 16:22:24 +00:00
|
|
|
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}
|
2022-12-09 16:17:45 +00:00
|
|
|
- name: Test fish
|
|
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
|
|
if: success() || failure()
|
|
|
|
shell: fish --login {0}
|
2022-12-02 15:31:15 +00:00
|
|
|
- name: Repeated uninstall
|
2022-12-12 17:27:43 +00:00
|
|
|
run: sudo -E /nix/harmonic uninstall
|
2022-11-08 19:22:08 +00:00
|
|
|
|
2022-12-02 15:31:15 +00:00
|
|
|
run-steam-deck:
|
|
|
|
name: Run Steam Deck (mock)
|
|
|
|
runs-on: ubuntu-22.04
|
2022-12-12 17:27:43 +00:00
|
|
|
needs: [build-x86_64-linux, lints]
|
2022-12-02 15:31:15 +00:00
|
|
|
steps:
|
2022-12-07 16:22:24 +00:00
|
|
|
- run: sudo apt install fish zsh
|
2022-12-02 15:31:15 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: harmonic-x86_64-linux
|
2022-12-12 17:27:43 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: nix-install
|
|
|
|
- name: Move & set executable
|
|
|
|
run: |
|
|
|
|
chmod +x ./harmonic
|
|
|
|
mv harmonic harmonic-x86_64-linux
|
2022-12-02 15:31:15 +00:00
|
|
|
- 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
|
2022-12-12 17:27:43 +00:00
|
|
|
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 }}"
|
2022-12-02 15:31:15 +00:00
|
|
|
- name: Initial uninstall (without a `nix run` first)
|
2022-12-12 17:27:43 +00:00
|
|
|
run: sudo -E /nix/harmonic uninstall
|
2022-12-02 15:31:15 +00:00
|
|
|
- name: Repeated install
|
2022-12-12 17:27:43 +00:00
|
|
|
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 }}"
|
2022-12-07 16:22:24 +00:00
|
|
|
- name: echo $PATH
|
|
|
|
run: echo $PATH
|
2022-12-12 17:27:43 +00:00
|
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
2022-12-07 16:22:24 +00:00
|
|
|
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}
|
2022-12-09 16:17:45 +00:00
|
|
|
- name: Test fish
|
|
|
|
run: nix-instantiate -E 'builtins.currentTime' --eval
|
|
|
|
if: success() || failure()
|
|
|
|
shell: fish --login {0}
|
2022-12-02 15:31:15 +00:00
|
|
|
- name: Repeated uninstall
|
2022-12-12 17:27:43 +00:00
|
|
|
run: sudo -E /nix/harmonic uninstall
|
2022-12-02 15:31:15 +00:00
|
|
|
|
2022-11-14 16:45:41 +00:00
|
|
|
build-x86_64-darwin:
|
|
|
|
name: Build x86_64 Darwin
|
2022-11-16 21:08:42 +00:00
|
|
|
runs-on: macos-12
|
2022-09-09 19:02:43 +00:00
|
|
|
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
|
2022-11-08 19:22:08 +00:00
|
|
|
|
2022-11-14 16:45:41 +00:00
|
|
|
run-x86_64-darwin:
|
|
|
|
name: Run x86_64 Darwin
|
2022-11-16 21:08:42 +00:00
|
|
|
runs-on: macos-12
|
2022-12-12 17:27:43 +00:00
|
|
|
needs: [build-x86_64-darwin, lints]
|
2022-11-08 19:30:49 +00:00
|
|
|
steps:
|
2022-12-12 17:27:43 +00:00
|
|
|
- run: brew install fish coreutils
|
2022-11-08 19:30:49 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: harmonic-x86_64-darwin
|
2022-12-12 17:27:43 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: nix-install
|
|
|
|
- name: Move & set executable
|
|
|
|
run: |
|
|
|
|
chmod +x ./harmonic
|
|
|
|
mv harmonic harmonic-x86_64-darwin
|
2022-11-08 19:30:49 +00:00
|
|
|
- name: Initial install
|
2022-12-12 17:27:43 +00:00
|
|
|
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 }}"
|
2022-12-02 15:31:15 +00:00
|
|
|
- name: Initial uninstall (without a `nix run` first)
|
2022-12-12 17:27:43 +00:00
|
|
|
run: sudo -E /nix/harmonic uninstall
|
2022-11-08 19:30:49 +00:00
|
|
|
- name: Repeated install
|
2022-12-12 17:27:43 +00:00
|
|
|
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 }}"
|
2022-12-07 16:22:24 +00:00
|
|
|
- name: echo $PATH
|
|
|
|
run: echo $PATH
|
2022-12-12 17:27:43 +00:00
|
|
|
- name: Test `nix` with `$GITHUB_PATH`
|
2022-12-07 16:22:24 +00:00
|
|
|
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}
|
2022-11-08 19:30:49 +00:00
|
|
|
- name: Repeated uninstall
|
2022-12-12 17:27:43 +00:00
|
|
|
run: sudo -E /nix/harmonic uninstall
|
2022-11-08 19:22:08 +00:00
|
|
|
|