lix-installer/.github/workflows/ci.yml

162 lines
6.4 KiB
YAML
Raw Normal View History

2022-09-09 19:02:43 +00:00
name: CI
on:
pull_request:
push:
branches: [main]
jobs:
2022-11-14 17:57:04 +00:00
lints:
2022-11-14 16:45:41 +00:00
name: Lints
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 }}
- 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
run: nix develop --store ~/.ci-store --command check-rustfmt
2022-09-09 19:02:43 +00:00
- name: Check Spelling
run: nix develop --store ~/.ci-store --command check-spelling
2022-09-09 19:02:43 +00:00
- name: Check nixpkgs-fmt formatting
run: nix develop --store ~/.ci-store --command check-nixpkgs-fmt
2022-09-09 19:02:43 +00:00
- name: Check EditorConfig conformance
run: nix develop --store ~/.ci-store --command check-editorconfig
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
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 }}
- 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
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
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-09-09 19:02:43 +00:00
- name: Create artifact for x86_64-linux harmonicStatic
uses: actions/upload-artifact@v3
with:
name: harmonic-x86_64-linux
path: |
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
runs-on: ubuntu-22.04
2022-11-14 16:45:41 +00:00
needs: build-x86_64-linux
steps:
- uses: actions/download-artifact@v3
with:
name: harmonic-x86_64-linux
- name: Set executable
run: chmod +x ./harmonic
- name: Initial install
2022-11-10 18:23:00 +00:00
run: sudo 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 RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
- name: Repeated install
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install linux-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
- name: Test `nix`
2022-11-08 21:04:19 +00:00
run: |
2022-11-08 21:21:32 +00:00
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
2022-11-08 21:04:19 +00:00
nix run nixpkgs#fortune
- name: Repeated uninstall
2022-11-08 21:04:19 +00:00
run: sudo 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:
- 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 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 PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
- name: Repeated install
run: sudo 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: Test `nix`
run: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
nix run nixpkgs#fortune
- name: Repeated uninstall
run: sudo PATH=$PATH:$HOME/bin RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
2022-11-14 16:45:41 +00:00
build-x86_64-darwin:
name: Build x86_64 Darwin
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-14 16:45:41 +00:00
run-x86_64-darwin:
name: Run x86_64 Darwin
runs-on: macos-12
2022-11-14 16:54:43 +00:00
needs: build-x86_64-darwin
steps:
- uses: actions/download-artifact@v3
with:
name: harmonic-x86_64-darwin
2022-11-09 17:33:19 +00:00
- name: Set executable
run: chmod +x ./harmonic
- name: Initial install
2022-11-10 18:23:00 +00:00
run: sudo 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)
2022-11-08 21:04:19 +00:00
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm
- name: Repeated install
2022-11-10 18:23:00 +00:00
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic install darwin-multi --extra-conf "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" --no-confirm
- name: Test `nix`
2022-11-09 17:25:29 +00:00
run: |
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
nix run nixpkgs#fortune
- name: Repeated uninstall
2022-11-08 21:04:19 +00:00
run: sudo RUST_LOG=harmonic=trace RUST_BACKTRACE=full ./harmonic uninstall --no-confirm