Merge branch 'main' into david.lee/workflow-to-build-serverless-agent… #2493
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
on: [push] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Cache | |
uses: ./.github/actions/cache | |
- name: Install latest nightly toolchain and rustfmt | |
run: rustup update nightly && rustup default nightly && rustup component add rustfmt | |
- run: rm -rf ipc/tarpc && sed -i 's/tarpc.*//' ipc/Cargo.toml && cargo fmt --all -- --check | |
clippy: | |
name: "clippy #${{ matrix.rust_version }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
# Ignore nightly for now, it fails too often | |
rust_version: ["1.69.0", "stable"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Cache | |
uses: ./.github/actions/cache | |
with: | |
rust_version: ${{ matrix.rust_version }} | |
- name: Install ${{ matrix.version }} toolchain and clippy | |
run: rustup install ${{ matrix.rust_version }} && rustup default ${{ matrix.rust_version }} && rustup component add clippy | |
- run: cargo clippy --all-targets --all-features -- -D warnings | |
licensecheck: | |
runs-on: ubuntu-latest | |
name: "Presence of licence headers" | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Install licensecheck | |
run: sudo apt-get install -y licensecheck | |
- name: Check licenses | |
run: '! find . \( -name "*.rs" -o -name "*.c" -o -name "*.sh" \) -not -path "*/tarpc/*" | xargs licensecheck -c ".*" | grep -v "Apache License 2.0"' | |
# todo: fix upstream warnings; from the readme: | |
# The most common cause of missing licenses seems to be workspaces that | |
# don't include forward their license files. Go to the repo for the | |
# workspace and copy the relevant files from there. | |
# A package license may receive a confidence warning stating that | |
# cargo-bundle-licenses is "unsure" or "semi" confident. This means that | |
# when the found license was compared to a template license it was found to | |
# have diverged in more than a few words. You should verify that the licence | |
# text is in fact correct in these cases. | |
# | |
# If this job fails, you need to regenerate the license, e.g. | |
# CARGO_HOME=/tmp/dd-cargo cargo bundle-licenses --format yaml --output LICENSE-3rdparty.yml | |
license-3rdparty: | |
runs-on: ubuntu-latest | |
name: "Valid LICENSE-3rdparty.yml" | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- run: stat LICENSE-3rdparty.yml | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry/ | |
~/.cargo/git/db/ | |
~/.cargo/bin/ | |
~/.cargo/.crates.toml | |
# cache key contains current version of cargo-bundle-licenses | |
# when upstream version is updated we can bump the cache key version, to cache the latest version of the tool | |
key: "v1-0.5.0" | |
- run: cargo install cargo-bundle-licenses | |
- name: "Generate new LICENSE-3rdparty.yml and check against the previous" | |
env: | |
CARGO_HOME: "/tmp/dd-cargo" | |
run: > | |
cargo bundle-licenses \ | |
--format yaml \ | |
--output /tmp/CI.yaml \ | |
--previous LICENSE-3rdparty.yml \ | |
--check-previous | |
- name: export the generated license file on failure | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: LICENSE-3rdparty.yml | |
path: /tmp/CI.yaml |