Skip to content

Commit

Permalink
Nightly web build (linera-io#2516)
Browse files Browse the repository at this point in the history
* Promote lint toolchain to nightly build toolchain

* Add `rust-src` component to nightly toolchain

* `.github/workflows/rust.yml`: run Web tests with nightly toolchain
  • Loading branch information
Twey authored Sep 19, 2024
1 parent 44b22cd commit bf84a0f
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 30 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- name: Switch to nightly Rust toolchain
run: |
ln -sf toolchains/nightly/rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Compile `linera-client` for the browser
run: |
Expand Down Expand Up @@ -159,7 +162,7 @@ jobs:
| xargs -0 scripts/target/release/check_copyright_header
- name: Put lint toolchain file in place
run: |
ln -sf toolchains/lint/rust-toolchain.toml
ln -sf toolchains/nightly/rust-toolchain.toml
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-machete
run: |
Expand Down Expand Up @@ -225,7 +228,7 @@ jobs:
- name: Restore `rust-toolchain.toml` file
if: '!cancelled()'
run: |
ln -sf toolchains/build/rust-toolchain.toml
ln -sf toolchains/stable/rust-toolchain.toml
- name: Check linera-service GraphQL schema
run: |
diff <(cargo run --locked --bin linera-schema-export) linera-service-graphql-client/gql/service_schema.graphql
7 changes: 2 additions & 5 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{ crane, pkgs }:
let
rust-toolchain = (pkgs.rust-bin.fromRustupToolchainFile
./toolchains/build/rust-toolchain.toml);
in ((crane.mkLib pkgs).overrideToolchain rust-toolchain).buildPackage {
{ crane, pkgs, rust-toolchain }:
((crane.mkLib pkgs).overrideToolchain rust-toolchain).buildPackage {
pname = "linera";
src = ./.;
cargoExtraArgs = "-p linera-service";
Expand Down
41 changes: 20 additions & 21 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,22 @@
];
perSystem = { config, self', inputs', pkgs, lib, system, ... }:
let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
nonRustDeps = with pkgs; [
];
linera = pkgs.callPackage ./. { inherit (inputs) crane; };
in {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ (import inputs.rust-overlay) ];
linera = rust-toolchain: pkgs.callPackage ./. {
inherit (inputs) crane;
inherit rust-toolchain;
};

packages.default = linera;

# Rust dev environment
devShells.default = pkgs.mkShell {
rust-stable = (pkgs.rust-bin.fromRustupToolchainFile
./toolchains/stable/rust-toolchain.toml);
rust-nightly = (pkgs.rust-bin.fromRustupToolchainFile
./toolchains/nightly/rust-toolchain.toml);
devShell = rust-toolchain: pkgs.mkShell {
inputsFrom = [
config.treefmt.build.devShell
linera
(linera rust-toolchain)
];
shellHook = ''
# For rust-analyzer 'hover' tooltips to work.
export RUST_SRC_PATH=${linera.rust-toolchain.availableComponents.rust-src}
export RUST_SRC_PATH=${rust-toolchain.availableComponents.rust-src}
export LIBCLANG_PATH=${pkgs.libclang.lib}/lib
export PATH=$PWD/target/debug:~/.cargo/bin:$PATH
export ROCKSDB_LIB_DIR=${pkgs.rocksdb}/lib
Expand All @@ -48,14 +43,18 @@
rust-analyzer
];
};

devShells.lint = pkgs.mkShell {
nativeBuildInputs = [
(pkgs.rust-bin.fromRustupToolchainFile
./toolchains/lint/rust-toolchain.toml)
];
in {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ (import inputs.rust-overlay) ];
};

packages.default = linera;

# Rust dev environment
devShells.default = devShell rust-stable;
devShells.nightly = devShell rust-nightly;

# Add your auto-formatters here.
# cf. https://numtide.github.io/treefmt/
treefmt.config = {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2024-07-11"
components = [ "clippy", "rustfmt" ]
components = [ "clippy", "rustfmt", "rust-src" ]
targets = [ "wasm32-unknown-unknown" ]
profile = "minimal"
File renamed without changes.

0 comments on commit bf84a0f

Please sign in to comment.