diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ec2f029..3c00a64 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,4 +1,4 @@ -name: Run checks +name: Checks on: pull_request: @@ -6,17 +6,48 @@ on: 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 }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ae55245..6d9035d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 8113af6..dd28b17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "2" members = [ "hypervisor", diff --git a/examples/dev_random.yaml b/examples/dev_random.yaml new file mode 100644 index 0000000..9acbcb4 --- /dev/null +++ b/examples/dev_random.yaml @@ -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] diff --git a/flake.nix b/flake.nix index 7d1c4a1..ee7fe03 100644 --- a/flake.nix +++ b/flake.nix @@ -120,6 +120,7 @@ cargo-audit cargo-expand nixpkgs-fmt + nodePackages.prettier ]; git.hooks = { enable = true;