Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ability to compile on stable rust #3759

Merged
merged 15 commits into from
Feb 2, 2022
61 changes: 56 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Compile NPM
run: |
cd applications/launchpad/gui-vue
npm install
npm ci
npm run build
- name: toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -80,7 +80,7 @@ jobs:
command: clippy
args: --all-targets -- -D warnings
build:
name: build
name: check nightly
runs-on: ubuntu-18.04
steps:
- name: checkout
Expand Down Expand Up @@ -114,14 +114,65 @@ jobs:
- name: Compile NPM
run: |
cd applications/launchpad/gui-vue
npm install
npm ci
npm run build
- name: toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.toolchain }}
components: clippy, rustfmt
override: true
- name: cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --release --all-targets
build-stable:
name: check stable
runs-on: ubuntu-18.04
steps:
- name: checkout
uses: actions/checkout@v2
- name: caching
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ runner.cpu-model }}-stable-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.cpu-model }}-stable-build-
${{ runner.os }}-${{ runner.cpu-model }}-stable-
- name: ubuntu dependencies
run: |
sudo apt-get update && \
sudo apt-get -y install \
build-essential \
libgtk-3-dev \
libwebkit2gtk-4.0-dev \
libsoup2.4-dev \
curl \
wget \
libappindicator3-dev \
patchelf \
librsvg2-dev \
libprotobuf-dev \
protobuf-compiler
- name: Compile NPM
run: |
cd applications/launchpad/gui-vue
npm ci
npm run build
- name: toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: rustup show
run: |
rustup show
- name: cargo build
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -163,7 +214,7 @@ jobs:
- name: Compile NPM
run: |
cd applications/launchpad/gui-vue
npm install
npm ci
npm run build
- name: toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -173,4 +224,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --release
args: --release --all-targets
1 change: 0 additions & 1 deletion applications/tari_collectibles/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(array_methods)]
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
Expand Down
3 changes: 2 additions & 1 deletion base_layer/key_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ serde_json = "1.0.39"
thiserror = "1.0.26"
strum_macros = "0.22"
strum = { version = "0.22", features = ["derive"] }
wasm-bindgen = { version = "0.2", features = ["serde-serialize", "nightly"] }
wasm-bindgen = { version = "0.2", features = ["serde-serialize", "nightly"], optional = true }
wasm-bindgen-test = "0.3.28"

[dev-dependencies]
Expand All @@ -41,3 +41,4 @@ sha2 = "0.9.8"
[features]
avx2 = ["tari_crypto/avx2"]
js = ["getrandom/js", "js-sys"]
wasm = ["wasm-bindgen", "js"]
20 changes: 9 additions & 11 deletions base_layer/key_manager/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
.PHONY: test
toolchain=nightly-2021-11-20

.phony: test
test:
wasm-pack test --node --features js

.PHONY: build
rustup run $(toolchain) wasm-pack test --node --features wasm

.phony: build
build:
wasm-pack build --target bundler . -- --features js

.PHONY: install
rustup run $(toolchain) wasm-pack build --target bundler . -- --features wasm

.phony: install
install:
wasm-pack build --out-dir=../../applications/tari_web_extension/src/key_manager/ --target bundler . -- --features js

.PHONY: web
rustup run $(toolchain) wasm-pack build --out-dir=../../applications/tari_web_extension/src/key_manager/ --target bundler . -- --features wasm

.phony: web
web:
wasm-pack build --target web . -- --features js
rustup run $(toolchain) wasm-pack build --target web . -- --features wasm
1 change: 1 addition & 0 deletions base_layer/key_manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ pub mod mnemonic;
pub mod mnemonic_wordlists;
// https://github.com/rustwasm/wasm-bindgen/issues/2774
#[allow(clippy::unused_unit)]
#[cfg(feature = "wasm")]
pub mod wasm;
2 changes: 1 addition & 1 deletion base_layer/key_manager/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ mod test {
let next_key = response.key_manager.next_key().unwrap();
assert_eq!(
next_key.k.to_hex(),
"5a14f1205cfeb10d53af46e82b70e8832a544206f524b404e7a346148532910a".to_string()
"5c06999ed20e18bbb76245826141f8ae8700a648d87ec4da5a2a7507ce4b5f0e".to_string()
)
}

Expand Down
1 change: 0 additions & 1 deletion comms/dht/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(map_entry_replace)]
#![doc(html_root_url = "https://docs.rs/tower-filter/0.3.0-alpha.2")]
#![cfg_attr(not(debug_assertions), deny(unused_variables))]
#![cfg_attr(not(debug_assertions), deny(unused_imports))]
Expand Down
8 changes: 4 additions & 4 deletions comms/dht/src/store_forward/local_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ impl SafLocalState {

pub fn register_inflight_request(&mut self, peer: NodeId) {
match self.inflight_saf_requests.entry(peer) {
Entry::Occupied(entry) => {
Entry::Occupied(mut entry) => {
let (count, _) = *entry.get();
entry.replace_entry((count + 1, Instant::now()));
*entry.get_mut() = (count + 1, Instant::now());
delta1 marked this conversation as resolved.
Show resolved Hide resolved
},
Entry::Vacant(entry) => {
entry.insert((1, Instant::now()));
Expand All @@ -53,11 +53,11 @@ impl SafLocalState {

pub fn mark_infight_response_received(&mut self, peer: NodeId) -> Option<Duration> {
match self.inflight_saf_requests.entry(peer) {
Entry::Occupied(entry) => {
Entry::Occupied(mut entry) => {
let (count, ts) = *entry.get();
let reduced_count = count - 1;
if reduced_count > 0 {
entry.replace_entry((reduced_count, ts));
*entry.get_mut() = (reduced_count, ts);
} else {
entry.remove();
}
Expand Down