Skip to content

Commit

Permalink
refine CI, add prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Wanja Zaeske authored and sevenautumns committed Jul 19, 2023
1 parent 9885334 commit 34643ce
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 42 deletions.
39 changes: 35 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,53 @@
name: Run checks
name: Checks

on:
pull_request:
push:
branches: [main]

jobs:
nix-checks:
nix-flake-check:
name: Run nix flake check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
with:
name: dlr-ft
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Nix Flake Check
run: nix flake check

impure-checks:
name: Run check ${{ matrix.check }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
check:
- udeps
- treefmt --fail-on-change
- audit --deny warnings
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
with:
name: dlr-ft
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ github.job }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run check ${{ matrix.check }}
run: nix develop --command ${{ matrix.check }}
50 changes: 12 additions & 38 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,50 +21,24 @@ jobs:
DURATION: 10s
RUST_LOG: trace
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
with:
name: dlr-ft
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ github.job }}-${{ matrix.example }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check CGroup
run: systemd-run --user --scope cat /proc/self/cgroup
- name: Run example ${{ matrix.example }}
run: nix develop --command systemd-run-example-${{ matrix.example }} --duration $DURATION

checks:
name: Run check ${{ matrix.check }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
check:
- udeps
- treefmt --fail-on-change
- audit --deny warnings
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-stable
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Cache Nix store
uses: actions/cache@v3
id: nix-cache
with:
path: /tmp/nixcache
key: nix-${{ runner.os }}
- name: Import Nix store cache
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: nix copy --no-check-sigs --from /tmp/nixcache --all
- name: Run check ${{ matrix.check }}
run: nix develop --command ${{ matrix.check }}
- name: Export Nix store cache
if: "steps.nix-cache.outputs.cache-hit != 'true'"
run: |
nix copy --no-check-sigs --to /tmp/nixcache \
.#devShells.x86_64-linux.default
run: nix develop --command systemd-run-example-${{ matrix.example }} --duration $DURATION
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"

members = [
"hypervisor",
Expand Down
10 changes: 10 additions & 0 deletions examples/dev_random.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
major_frame: 1s
partitions:
- id: 0
name: partition_0
duration: 1s
offset: 0ms
period: 1s
image: target/x86_64-unknown-linux-musl/release/dev_random
mounts:
- [/dev/random, /dev/random]
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
cargo-audit
cargo-expand
nixpkgs-fmt
nodePackages.prettier
];
git.hooks = {
enable = true;
Expand Down

0 comments on commit 34643ce

Please sign in to comment.