Skip to content

Commit

Permalink
chore(meta): improve CI, use workspace.package (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Feb 7, 2024
1 parent 33b8ed1 commit 5d2142f
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 84 deletions.
126 changes: 63 additions & 63 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
name: Rust
name: CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --verbose
- name: Formatting
run: cargo fmt --all -- --check
- name: Linting
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test --all-features

windows-build:
runs-on: windows-latest
name: (${{ matrix.target }}, ${{ matrix.cfg_release_channel }})
env:
CFG_RELEASE_CHANNEL: ${{ matrix.cfg_release_channel }}
test:
name: test ${{ matrix.runner }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
strategy:
max-parallel: 2
fail-fast: false
matrix:
target: [
i686-pc-windows-gnu,
i686-pc-windows-msvc,
x86_64-pc-windows-gnu,
x86_64-pc-windows-msvc,
]
cfg_release_channel: [nightly]

runner: ["ubuntu-latest", "macos-13", "macos-14", "windows-latest"]
steps:
- name: checkout
uses: actions/checkout@v2

# Run build
- name: Install Rustup using win.rustup.rs
run: |
# disable download progress bar
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe
.\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --default-toolchain=none
del rustup-init.exe
rustup target add ${{ matrix.target }}
shell: powershell
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: test
run: cargo test --workspace --all-targets

- name: Add mingw32 to path for i686-gnu
run: |
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly'
shell: bash
feature-checks:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: cargo hack
run: cargo hack check --feature-powerset --depth 2

- name: Add mingw64 to path for x86_64-gnu
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
shell: bash
clippy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo clippy --workspace --all-targets --all-features
env:
RUSTFLAGS: -Dwarnings

- name: build
run: |
rustc -Vv
cargo -V
cargo build
shell: cmd
docs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo doc --workspace --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS: "--cfg docsrs -D warnings"

- name: test
run: cargo test
shell: cmd
fmt:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all --check
14 changes: 14 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
[workspace]
members = ["crates/svm-builds", "crates/svm-rs"]
resolver = "2"

[workspace.package]
version = "0.3.5"
edition = "2021"
rust-version = "1.70"
authors = [
"Rohit Narurkar <[email protected]>",
"Matthias Seitz <[email protected]>",
"DaniPopes <[email protected]>",
]
license = "MIT OR Apache-2.0"
readme = "./README.md"
repository = "https://github.com/alloy-rs/svm-rs"
homepage = "https://github.com/alloy-rs/svm-rs"
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
msrv = "1.70"
20 changes: 9 additions & 11 deletions crates/svm-builds/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
[package]
name = "svm-rs-builds"
version = "0.3.5"
edition = "2021"
rust-version = "1.65"
authors = [
"Matthias Seitz <[email protected]>",
"Rohit Narurkar <[email protected]>",
]
license = "MIT OR Apache-2.0"
readme = "../../README.md"
repository = "https://github.com/roynalnaruto/svm-rs"
homepage = "https://github.com/roynalnaruto/svm-rs"
description = "Solidity compiler builds"

version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
readme.workspace = true
repository.workspace = true
homepage.workspace = true

[build-dependencies]
svm = { package = "svm-rs", path = "../svm-rs", version = "0.3.5", default-features = false, features = [
"blocking",
Expand Down
19 changes: 10 additions & 9 deletions crates/svm-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[package]
name = "svm-rs"
version = "0.3.5"
edition = "2021"
rust-version = "1.65"
authors = ["Rohit Narurkar <[email protected]>"]
license = "MIT OR Apache-2.0"
readme = "../../README.md"
repository = "https://github.com/roynalnaruto/svm-rs"
homepage = "https://github.com/roynalnaruto/svm-rs"
description = "Solidity compiler Version Manager"
description = "Solidity compiler version manager"

version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
readme.workspace = true
repository.workspace = true
homepage.workspace = true

[lib]
name = "svm_lib"
Expand Down
1 change: 1 addition & 0 deletions crates/svm-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ fn try_lock_file(lock_path: PathBuf) -> Result<LockFile, SolcVmError> {
use fs2::FileExt;
let _lock_file = fs::OpenOptions::new()
.create(true)
.truncate(true)
.read(true)
.write(true)
.open(&lock_path)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/svm-rs/src/releases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ mod hex_string {
}
}

/// Blocking version fo [`all_realeases`]
/// Blocking version of [`all_releases`].
#[cfg(feature = "blocking")]
pub fn blocking_all_releases(platform: Platform) -> Result<Releases, SolcVmError> {
match platform {
Expand Down

0 comments on commit 5d2142f

Please sign in to comment.