Skip to content

Commit

Permalink
Copy Nix flake setup from RustShop
Browse files Browse the repository at this point in the history
  • Loading branch information
dpc committed Jul 29, 2022
1 parent a6f1f12 commit f44aed1
Show file tree
Hide file tree
Showing 8 changed files with 309 additions and 60 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci-nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This is a basic workflow to help you get started with Actions

name: "CI (nix)"

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
lint:
name: "Lint"
runs-on: ubuntu-latest

steps:
# Checks-out repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v3

- name: Cache install Nix packages
uses: mtoohey31/cache-flake-attrs@v2
with:
key: ${{ runner.os }}-nix-${{ hashFiles('./flake.lock', './flake.nix') }}-lint
flake_paths: ".#devShells.x86_64-linux.lint"

# run the same check that git `pre-commit` hook would, just in case
- name: Commit check
run: nix develop --ignore-environment --extra-experimental-features nix-command --extra-experimental-features flakes .#lint --command ./misc/git-hooks/pre-commit


build:
name: "Build"
runs-on: ubuntu-latest
steps:
# Checks-out repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v3

- name: Cache install Nix packages
uses: mtoohey31/cache-flake-attrs@v2
with:
key: ${{ runner.os }}-nix-${{ hashFiles('./flake.lock', './flake.nix', './Cargo.lock') }}-deps
flake_paths: ".#deps"

- name: Run tests
run: nix build -L --extra-experimental-features nix-command --extra-experimental-features flakes .#ci
5 changes: 4 additions & 1 deletion cargo-crev/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,10 @@ impl Repo {
let dependency_request =
Dependency::parse(name, version_str.as_deref(), source.source_id())?;
let _lock = self.config.acquire_package_cache_lock()?;
if !source.query(&dependency_request, &mut |summary| summaries.push(summary)).is_ready() {
if !source
.query(&dependency_request, &mut |summary| summaries.push(summary))
.is_ready()
{
source.block_until_ready()?;
}
let summary = if let Some(version) = version {
Expand Down
2 changes: 1 addition & 1 deletion ci/prep_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ cp cargo-crev/README.md LICENSE* "$name/"
tar czvf "$name.tar.gz" "$name"

# Get the sha-256 checksum w/o filename and newline
echo -n $(shasum -ba 256 "$name.tar.gz" | cut -d " " -f 1) > "$name.tar.gz.sha256"
echo -n "$(shasum -ba 256 "$name.tar.gz" | cut -d " " -f 1)" > "$name.tar.gz.sha256"

3 changes: 2 additions & 1 deletion crev-wot/src/trust_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ impl TrustSet {
.unwrap_or_else(HashSet::new);

let too_far = candidate_total_distance.map(|d| params.max_distance < d);
let trust_too_low = too_far.unwrap_or(true) && effective_trust_level == TrustLevel::None;
let trust_too_low =
too_far.unwrap_or(true) && effective_trust_level == TrustLevel::None;

let overriden_by = if let Some(existing_override) = current_trust_set
.trust_ignore_overrides
Expand Down
98 changes: 76 additions & 22 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f44aed1

Please sign in to comment.