From ab39f1c3c83c7156e6e9979773bf542a59d9b4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 9 Aug 2023 17:35:36 +0900 Subject: [PATCH] chore(ci): Cleanup CI (#7787) **Description**: - Disable `crev` action. - Cleanup compilation check matrix. - Update `cargo-hack`. --- .github/workflows/CI.yml | 70 ++++++++--------------- scripts/github/create-matrix.sh | 11 ---- scripts/github/run-cargo-hack.sh | 21 +++++++ scripts/{ci => github}/test-concurrent.sh | 0 scripts/github/tests.yml | 2 +- 5 files changed, 46 insertions(+), 58 deletions(-) create mode 100755 scripts/github/run-cargo-hack.sh rename scripts/{ci => github}/test-concurrent.sh (100%) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 45b7db9da3b..fd40afce818 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -75,21 +75,21 @@ jobs: git config --global user.name 'SWC bot' git config --global user.email 'bot@swc.rs' - - name: Install cargo-crev - uses: baptiste0928/cargo-install@v1.1.0 - with: - crate: cargo-crev - version: "=0.23.5" - locked: true + # - name: Install cargo-crev + # uses: baptiste0928/cargo-install@v2 + # with: + # crate: cargo-crev + # version: "=0.24.3" + # # locked: true - - name: Configure cargo-crev - run: | - cargo crev trust --level high https://github.com/kdy1/crev-proofs - cargo crev repo fetch all + # - name: Configure cargo-crev + # run: | + # cargo crev trust --level high https://github.com/kdy1/crev-proofs + # cargo crev repo fetch all - - name: Check dependencies - run: | - ./scripts/crev/verify.sh + # - name: Check dependencies + # run: | + # ./scripts/crev/verify.sh cargo-deny: name: Check license of dependencies @@ -105,7 +105,7 @@ jobs: profile: minimal - name: Install cargo-deny - uses: baptiste0928/cargo-install@v1.1.0 + uses: baptiste0928/cargo-install@v2 with: crate: cargo-deny version: "0.11.3" @@ -232,8 +232,6 @@ jobs: - crate: swc os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps --exclude-features debug --exclude-features plugin --exclude-features plugin_transform_schema_v1 --exclude-features plugin_transform_schema_vtest --exclude-features plugin_transform_host_js --exclude-features plugin_transform_host_native - crate: swc os: windows-latest runner: windows-latest @@ -243,16 +241,12 @@ jobs: - crate: swc_bundler os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps - crate: swc_cached os: ubuntu-latest runner: ubuntu-latest - crate: swc_common os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps --exclude-features plugin_transform_schema_vtest --exclude-features __plugin --exclude-features __plugin_mode --exclude-features __plugin_rt --exclude-features __rkyv --exclude-features rkyv-impl - crate: swc_common os: windows-latest runner: windows-latest @@ -310,8 +304,6 @@ jobs: - crate: swc_ecma_ast os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps --exclude-features __rkyv - crate: swc_ecma_codegen os: ubuntu-latest runner: ubuntu-latest @@ -333,8 +325,6 @@ jobs: - crate: swc_ecma_loader os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps - crate: swc_ecma_loader os: windows-latest runner: windows-latest @@ -365,21 +355,15 @@ jobs: - crate: swc_ecma_transforms os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps - crate: swc_ecma_transforms_base os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps - crate: swc_ecma_transforms_classes os: ubuntu-latest runner: ubuntu-latest - crate: swc_ecma_transforms_compat os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps - crate: swc_ecma_transforms_macros os: ubuntu-latest runner: ubuntu-latest @@ -392,8 +376,6 @@ jobs: - crate: swc_ecma_transforms_optimization os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps - crate: swc_ecma_transforms_proposal os: ubuntu-latest runner: ubuntu-latest @@ -409,16 +391,15 @@ jobs: - crate: swc_ecma_transforms_typescript os: ubuntu-latest runner: ubuntu-latest + - crate: swc_ecma_usage_analyzer + os: ubuntu-latest + runner: ubuntu-latest - crate: swc_ecma_utils os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps - crate: swc_ecma_visit os: ubuntu-latest runner: ubuntu-latest - check: | - cargo hack check --feature-powerset --no-dev-deps - crate: swc_ecmascript os: ubuntu-latest runner: ubuntu-latest @@ -479,9 +460,6 @@ jobs: - crate: swc_node_bundler os: ubuntu-latest runner: ubuntu-latest - check: | - cargo check - cargo check --no-default-features --features swc_v2 - crate: swc_node_bundler os: windows-latest runner: windows-latest @@ -677,7 +655,7 @@ jobs: env: SWC_FORCE_CONCURRENT: "1" run: | - ./scripts/ci/test-concurrent.sh ${{ matrix.settings.crate }} + ./scripts/github/test-concurrent.sh ${{ matrix.settings.crate }} - name: Run cargo test (swc, concurrent) shell: bash @@ -688,16 +666,16 @@ jobs: cargo test -p swc --features concurrent - name: Install cargo-hack - uses: baptiste0928/cargo-install@v1.1.0 - if: matrix.settings.os == 'ubuntu-latest' && matrix.settings.check + uses: baptiste0928/cargo-install@v2 + if: matrix.settings.os == 'ubuntu-latest' with: crate: cargo-hack - version: "0.5.7" + version: "0.5.29" + locked: true - name: Check compilation - if: matrix.settings.check - working-directory: "crates/${{ matrix.settings.crate }}" - run: "${{ matrix.settings.check }}" + run: | + ./scripts/github/run-cargo-hack.sh ${{ matrix.settings.crate }} node-test: name: Test node bindings - ${{ matrix.os }} diff --git a/scripts/github/create-matrix.sh b/scripts/github/create-matrix.sh index 812b477e224..c4c04f9f67d 100755 --- a/scripts/github/create-matrix.sh +++ b/scripts/github/create-matrix.sh @@ -27,17 +27,6 @@ do echo " runner: ubuntu-latest" fi - if echo $json_str | jq -e ".check.\"$crate\"" > /dev/null; then - echo " check: |" - - check_commands=$(echo $json_str | jq -e -r ".check.\"$crate\" | .[]") - - while IFS= read -r line; do - echo " $line" - done <<< "$check_commands" - fi - - if echo $json_str | jq -e "select(.os.macos | index(\"$crate\"))" > /dev/null; then echo "- crate: $crate" echo " os: macos-latest" diff --git a/scripts/github/run-cargo-hack.sh b/scripts/github/run-cargo-hack.sh new file mode 100755 index 00000000000..be3d94cffb9 --- /dev/null +++ b/scripts/github/run-cargo-hack.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -eu + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +crate=$1 + +echo "Running cargo hack for crate $crate" + +# yq query syntax is weird, so we have to use jq +json_str="$(yq -o=json $SCRIPT_DIR/tests.yml)" + + +if echo $json_str | jq -e ".check.\"$crate\"" > /dev/null; then + check_commands=$(echo $json_str | jq -e -r ".check.\"$crate\" | .[]") + + while IFS= read -r line; do + echo " Running '$line'" + (cd "crates/$crate" && $line) + done <<< "$check_commands" +fi \ No newline at end of file diff --git a/scripts/ci/test-concurrent.sh b/scripts/github/test-concurrent.sh similarity index 100% rename from scripts/ci/test-concurrent.sh rename to scripts/github/test-concurrent.sh diff --git a/scripts/github/tests.yml b/scripts/github/tests.yml index 15c993c7dd3..452b896f767 100644 --- a/scripts/github/tests.yml +++ b/scripts/github/tests.yml @@ -26,7 +26,7 @@ os: check: swc: # plugin feature is verified by other tasks - - "cargo hack check --feature-powerset --no-dev-deps --exclude-features debug --exclude-features plugin --exclude-features plugin_transform_schema_v1 --exclude-features plugin_transform_schema_vtest" + - "cargo hack check --feature-powerset --no-dev-deps --exclude-features debug --exclude-features plugin --exclude-features plugin_transform_schema_v1 --exclude-features plugin_transform_schema_vtest --exclude-features plugin_transform_host_js" swc_bundler: - "cargo hack check --feature-powerset --no-dev-deps" swc_common: