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

Add ink! linting MVP stage #431

Merged
merged 45 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
82a8d4c
Add ink! linting MVP stage
cmichi Feb 11, 2022
36c5c99
CI: cache cargo installations; update versions
Feb 17, 2022
203ae16
Apply suggestions from code review
cmichi Feb 18, 2022
565c433
Merge branch 'master' into cmichi-implemnt-dylint-mvp
cmichi Feb 18, 2022
618ea70
Update changelog
cmichi Feb 18, 2022
0536795
Check if `dylint` requirements are installed
cmichi Feb 18, 2022
2e18422
Merge branch 'master' into cmichi-implemnt-dylint-mvp
cmichi Feb 18, 2022
5035790
Make `clippy` happy
cmichi Feb 18, 2022
35107a8
Make tests happy
cmichi Feb 18, 2022
36e85d1
Make `LICENSE` symlink
cmichi Feb 22, 2022
2fc61c1
Make error handling and panic's consistent
cmichi Feb 22, 2022
26edca5
Improve code structure
cmichi Feb 22, 2022
26bf192
Remove unneeded `--workspace`
cmichi Feb 22, 2022
23af5eb
Fix `mapping-two-constructor` test file
cmichi Feb 22, 2022
aeb5287
Simplify `Option<Vec<_>>` to `Vec`
cmichi Feb 22, 2022
44fbfb9
Generalize unsetting of env variables in `invoke_cargo`
cmichi Feb 22, 2022
424a1e9
Move special case of `dylint` verbosity to call site
cmichi Feb 22, 2022
f8f9b8f
Keep calm and return an `Err`
cmichi Feb 22, 2022
db67998
Move checking for `dylint-link` to `build.rs`
cmichi Feb 23, 2022
2065d20
Add `ink_linting/Cargo.lock`
cmichi Feb 23, 2022
8367c5b
Move `bool_to_exit_code` inline
cmichi Feb 23, 2022
402a28d
Add test for non-fully-qualified path call of `initialize_contract`
cmichi Feb 23, 2022
60287bd
Fix panic when no manifest path was supplied
cmichi Feb 23, 2022
d0071ee
Improve structure of `build.rs`
cmichi Feb 23, 2022
87289ed
Make linting error message non-blaming
cmichi Feb 23, 2022
1fc817c
Remove incorrect note on not detecting indirections
cmichi Feb 23, 2022
16d77c6
Make `clippy` happy
cmichi Feb 23, 2022
98d2543
Impprove text
cmichi Feb 23, 2022
b1be397
Build `ink_linting` with `--locked`
cmichi Feb 23, 2022
b599831
Fix path separators for Windows CI
cmichi Feb 23, 2022
892f459
Revert "Fix path separators for Windows CI"
cmichi Feb 23, 2022
03a5fba
Revert me: Debug failing Windows CI
cmichi Feb 23, 2022
78db3f5
Revert me: Debug failing Windows CI
cmichi Feb 23, 2022
7a26bc9
Revert me: Debug failing Windows CI
cmichi Feb 23, 2022
cea5ab5
Revert me: Debug failing Windows CI
cmichi Feb 23, 2022
14af20e
Revert me: Debug failing Windows CI
cmichi Feb 23, 2022
f60e682
Revert me: Debug failing Windows CI
cmichi Feb 23, 2022
29b27a2
Revert me: Debug failing Windows CI
cmichi Feb 23, 2022
81bde92
Use `which` for detecting `dylint-link` installation
cmichi Feb 23, 2022
68a1562
Merge branch 'master' into cmichi-implemnt-dylint-mvp
cmichi Feb 23, 2022
d0d209f
Remove `DYLINT_DRIVER_PATH`
cmichi Feb 23, 2022
0ea9417
Add `--lib`
cmichi Feb 23, 2022
a00c562
Revert "Remove `DYLINT_DRIVER_PATH`"
cmichi Feb 23, 2022
959eb44
Use temporary `DYLINT_DRIVER_PATH` path during tests
cmichi Feb 23, 2022
d417899
Give `template` variable a speaking name
cmichi Feb 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:

- name: Checkout sources & submodules
uses: actions/checkout@master
uses: actions/checkout@v2.4.0
cmichi marked this conversation as resolved.
Show resolved Hide resolved
with:
fetch-depth: 1
submodules: recursive
Expand All @@ -36,20 +36,33 @@ jobs:

- name: Install toolchain
id: toolchain
uses: actions-rs/toolchain@master
uses: actions-rs/toolchain@v1.0.7
cmichi marked this conversation as resolved.
Show resolved Hide resolved
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
components: rust-src
override: true

- name: Install cargo-dylint
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-dylint
version: 1

- name: Install dylint-link
uses: baptiste0928/cargo-install@v1
with:
crate: dylint-link
version: 1

- name: Rust Cache
uses: Swatinem/rust-cache@v1.2.0
uses: Swatinem/rust-cache@v1.3.0

- name: Build contract template on ${{ matrix.platform }}-${{ matrix.toolchain }}
run: |
wasm-opt --version
cargo -vV
cargo dylint --version
cargo run -- contract --version
cargo run -- contract new foobar
echo "[workspace]" >> foobar/Cargo.toml
Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,40 @@ jobs:
pathInArchive: "binaryen-/bin/wasm-opt.exe"

- name: Checkout sources & submodules
uses: actions/checkout@master
uses: actions/checkout@v2.4.0
cmichi marked this conversation as resolved.
Show resolved Hide resolved
with:
fetch-depth: 1
submodules: recursive

- name: Install toolchain
id: toolchain
uses: actions-rs/toolchain@master
uses: actions-rs/toolchain@v1.0.7
cmichi marked this conversation as resolved.
Show resolved Hide resolved
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
components: rust-src
override: true

- name: Install cargo-dylint
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-dylint
version: 1

- name: Install dylint-link
uses: baptiste0928/cargo-install@v1
with:
crate: dylint-link
version: 1

- name: Rust Cache
uses: Swatinem/rust-cache@v1.2.0
uses: Swatinem/rust-cache@v1.3.0

- name: Build contract template on ${{ matrix.platform }}-${{ matrix.toolchain }}
run: |
wasm-opt --version
cargo -vV
cargo dylint --version
cargo run -- contract --version
cargo run -- contract new foobar
echo "[workspace]" >> foobar/Cargo.toml
Expand Down
26 changes: 26 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ workflow:
- cargo -vV
- rustc -vV
- rustup show
- cargo dylint --version
- bash --version
- ./scripts/ci/pre_cache.sh
# global RUSTFLAGS overrides the linker args so this way is better to pass the flags
- printf '[build]\nrustflags = ["-C", "link-dead-code"]\n' > ${CARGO_HOME}/config
- sccache -s

# needed until https://github.com/mozilla/sccache/issues/1000 is fixed.
# this is unfortunate, since it disables `sccache` for this entire file.
- unset RUSTC_WRAPPER

- git show
rules:
- if: $CI_PIPELINE_SOURCE == "web"
Expand Down Expand Up @@ -81,6 +87,26 @@ clippy:

#### stage: test (all features)

test-dylint:
stage: test
<<: *docker-env
script:
cmichi marked this conversation as resolved.
Show resolved Hide resolved
- cd ink_linting/

# Installing these components here is necessary because
# `ink_linting/` has a fixed `rust-toolchain` file.
# We can't move this line to the Docker container, since
# that would then make it impossible to upgrade the
# `ink_linting/rust-toolchain` file while still having
# this CI job succeed.
- rustup component add rustfmt clippy rust-src

- cargo check --verbose
- cargo fmt --verbose --all -- --check
- cargo clippy --verbose -- -D warnings;

- cargo test --verbose --workspace --all-features
cmichi marked this conversation as resolved.
Show resolved Hide resolved

test:
stage: test
<<: *docker-env
Expand Down
Loading