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

set up cargo-deny #89

Merged
merged 8 commits into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
66 changes: 36 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,17 @@ executors:
xcode: 11.4
rust_windows: &rust_windows_executor
machine:
image: 'windows-server-2019-vs2019:stable'
image: "windows-server-2019-vs2019:stable"
resource_class: windows.xlarge
shell: powershell.exe -ExecutionPolicy Bypass

jobs:
build_test_lint:
build_test_lint_check:
parameters:
platform:
type: executor
executor: << parameters.platform >>
environment:
# Note: This is a no-op at the second, but bear with me on this. If this
# comment is not removed by 2021-06-30 remove it along with the next line.
# renovate: datasource=github-tags depName=nodejs/node versioning=node
NODE_VERSION: 14.17.5
NPM_VERSION: 7.10.0
steps:
Expand All @@ -42,14 +39,15 @@ jobs:
command: git submodule update --recursive --init
- when:
condition:
equal: [ *rust_macos_executor, << parameters.platform >> ]
equal: [*rust_macos_executor, << parameters.platform >>]
steps:
- run: echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $BASH_ENV
- run: echo "export OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1" >> $BASH_ENV
- run: test -e "$OPENSSL_ROOT_DIR"
- run: brew install cmake
- rust/install:
version: stable
- run: cargo install --locked cargo-deny
- restore_cache:
keys:
- rust-target-v1-macos-{{ checksum "Cargo.lock" }}
Expand Down Expand Up @@ -80,7 +78,7 @@ jobs:
- target/
- when:
condition:
equal: [ *rust_linux_executor, << parameters.platform >> ]
equal: [*rust_linux_executor, << parameters.platform >>]
steps:
- run:
name: Update and install dependencies
Expand All @@ -89,6 +87,7 @@ jobs:
sudo apt-get install -y libssl-dev cmake
- rust/install:
version: stable
- run: cargo install --locked cargo-deny
- restore_cache:
keys:
- rust-target-v1-linux-{{ checksum "Cargo.lock" }}
Expand Down Expand Up @@ -118,18 +117,18 @@ jobs:
- target/
- when:
condition:
equal: [ *rust_windows_executor, << parameters.platform >> ]
equal: [*rust_windows_executor, << parameters.platform >>]
steps:
# - run:
# # TODO compiling grpcio on Windows is still not working
# # using boringssl gives an error message
# # using openssl hangs indefinitely
# name: Install grpcio build dependencies
# command: |
# choco install activeperl -y
# choco install cmake -y --installargs 'ADD_CMAKE_TO_PATH=System'
# choco install yasm -y
# choco install openssl -y
# - run:
# # TODO compiling grpcio on Windows is still not working
# # using boringssl gives an error message
# # using openssl hangs indefinitely
# name: Install grpcio build dependencies
# command: |
# choco install activeperl -y
# choco install cmake -y --installargs 'ADD_CMAKE_TO_PATH=System'
# choco install yasm -y
# choco install openssl -y
- run:
name: Install rustup
environment:
Expand All @@ -150,6 +149,8 @@ jobs:
[net]
git-fetch-with-cli = true
"@
$env:CARGO_NET_GIT_FETCH_WITH_CLI='true'
- run: cargo install --locked cargo-deny
- restore_cache:
keys:
- rust-target-v1-windows-{{ checksum "Cargo.lock" }}
Expand Down Expand Up @@ -206,23 +207,28 @@ jobs:
- run:
name: wait for federation demo to start
command: npx wait-on tcp:4001 tcp:4002 tcp:4003 tcp:4004 tcp:4000

- when:
condition:
not:
# TODO [igni]: figure out how to make this work on windows
equal: [*rust_windows_executor, << parameters.platform >>]
steps:
- run:
command: >
cargo xtask check
- run:
command: >
cargo xtask test
cargo xtask lint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check, lint.... 🤔 should it really be 2 different commands?

I think we should keep lint and move your check there. You can exclude windows from the test there too using #[cfg(not(windows))].

Check would be fine too if it didn't collide with "cargo check" which means checking if it compiles, not linting. (counter intuitive for rust developers)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can indeed be a bit confusing! Let's try to think of a name that conveys we're making sure the codebase complies to our standards, license and fmt and stylewise.

wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at #147 and this, i think this calls for a team discussion about what xtask does and what the CI does. I'm opening an issue or maybe a discussion ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just opened #160 so we dont forget about it!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purrfect 😸

- run:
command: >
cargo xtask lint
cargo xtask test

build_release:
parameters:
platform:
type: executor
executor: << parameters.platform >>
environment:
# Note: This is a no-op at the second, but bear with me on this. If this
# comment is not removed by 2021-06-30 remove it along with the next line.
# renovate: datasource=github-tags depName=nodejs/node versioning=node
NODE_VERSION: 14.17.5
NPM_VERSION: 7.10.0
RELEASE_BIN: router
Expand All @@ -236,7 +242,7 @@ jobs:
command: git submodule update --recursive --init
- when:
condition:
equal: [ *rust_macos_executor, << parameters.platform >> ]
equal: [*rust_macos_executor, << parameters.platform >>]
steps:
- run: echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $BASH_ENV
- run: echo "export OPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1" >> $BASH_ENV
Expand Down Expand Up @@ -280,7 +286,7 @@ jobs:
--output artifacts/
- when:
condition:
equal: [ *rust_linux_executor, << parameters.platform >> ]
equal: [*rust_linux_executor, << parameters.platform >>]
steps:
- run:
name: Update and install dependencies
Expand Down Expand Up @@ -316,7 +322,7 @@ jobs:
cargo xtask package --output artifacts/
- when:
condition:
equal: [ *rust_windows_executor, << parameters.platform >> ]
equal: [*rust_windows_executor, << parameters.platform >>]
steps:
- run:
name: Install rustup
Expand Down Expand Up @@ -409,7 +415,7 @@ jobs:
workflows:
build:
jobs:
- build_test_lint:
- build_test_lint_check:
matrix:
parameters:
platform: [rust_macos, rust_windows, rust_linux]
Expand All @@ -423,11 +429,11 @@ workflows:
branches:
ignore: /.*/
tags:
only : /v.*/
only: /v.*/
- publish_github_release:
requires: [build_release]
filters:
branches:
ignore: /.*/
tags:
only : /v.*/
only: /v.*/
Loading