From f50565fc23a1426c40373411856979497f3b1c3d Mon Sep 17 00:00:00 2001 From: Kevin Zou Date: Fri, 2 Feb 2024 11:05:16 -0500 Subject: [PATCH] fix license script --- .github/workflows/test.yml | 3 ++- .pre-commit-config.yaml | 33 ++++++++++++++++++++------------- generate.sh | 3 ++- scripts/license-check.sh | 3 +++ 4 files changed, 27 insertions(+), 15 deletions(-) create mode 100755 scripts/license-check.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff06f3fc8..2d03f60a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,9 +79,10 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - name: Install Rust - uses: dtolnay/rust-toolchain@master + uses: dtolnay/rust-toolchain@v1 with: toolchain: ${{ matrix.rust-version }} + - uses: Swatinem/rust-cache@v2 - name: Test run: cargo build diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0216ab919..a0bfc2af8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,28 +3,35 @@ repos: hooks: - id: generate name: Generate - language: node + language: system entry: bash -c "./generate.sh" files: '^(\.generator/.*|\.pre-commit-config\.yaml|Makefile|\tests/scenarios/features/.*)' pass_filenames: false - - id: lint - name: Lint - entry: cargo clippy - language: system - pass_filenames: false + - id: generator + name: generator + language: python + entry: bash -c "cd .generator && poetry install && poetry run python -m generator ./schemas/v1/openapi.yaml ./schemas/v2/openapi.yaml -o ../src/" + files: "^.generator/(config|schemas/v1|src|poetry.lock|pyproject.toml)" stages: [manual] + pass_filenames: false + additional_dependencies: + - "poetry" - id: format name: Format language: rust entry: cargo fmt pass_filenames: false stages: [manual] - - id: generator - name: generator - language: python - entry: bash -c "cd .generator && poetry install && poetry run python -m generator ./schemas/v1/openapi.yaml ./schemas/v2/openapi.yaml -o ../src/" - files: "^.generator/(config|schemas/v1|src|poetry.lock|pyproject.toml)" + - id: lint + name: Lint + entry: cargo check + language: system + pass_filenames: false stages: [manual] + - id: license-check + name: Check license file + entry: bash -c "scripts/license-check.sh" + language: system + stages: ["manual"] + verbose: true pass_filenames: false - additional_dependencies: - - "poetry" \ No newline at end of file diff --git a/generate.sh b/generate.sh index df529f973..573622df8 100755 --- a/generate.sh +++ b/generate.sh @@ -26,4 +26,5 @@ pre_commit_wrapper () { rm -rf src/* examples/* pre_commit_wrapper generator pre_commit_wrapper format -pre_commit_wrapper lint \ No newline at end of file +pre_commit_wrapper lint +pre_commit_wrapper license-check diff --git a/scripts/license-check.sh b/scripts/license-check.sh new file mode 100755 index 000000000..776499f9b --- /dev/null +++ b/scripts/license-check.sh @@ -0,0 +1,3 @@ +cargo install --quiet dd-rust-license-tool +dd-rust-license-tool check +exit 0 \ No newline at end of file