From 44eeb40d0df5016b4ca0ae024649f8fc6bc322ee Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Tue, 28 Sep 2021 12:01:49 +0800 Subject: [PATCH 1/5] Add presubmit check actions for agent --- .github/workflows/presubmit-agent.yml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/presubmit-agent.yml diff --git a/.github/workflows/presubmit-agent.yml b/.github/workflows/presubmit-agent.yml new file mode 100644 index 0000000000..6f33a38727 --- /dev/null +++ b/.github/workflows/presubmit-agent.yml @@ -0,0 +1,49 @@ +name: presubmit-agent +on: + pull_request: + paths: + - 'agent/**' +jobs: + check: + runs-on: ${{ matrix.os }} + env: + # Emit backtraces on panics. + RUST_BACKTRACE: 1 + strategy: + matrix: + build: [linux, macos, win-msvc] + include: + - build: linux + os: ubuntu-18.04 + rust: nightly + target: x86_64-unknown-linux-musl + - build: macos + os: macos-latest + rust: nightly + target: x86_64-apple-darwin + - build: win-msvc + os: windows-latest + rust: nightly + target: x86_64-pc-windows-msvc + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + profile: minimal + override: true + target: ${{ matrix.target }} + + - name: Cargo Format Check + working-directory: agent + run: cargo fmt -- --check + + - name: Cargo Test + working-directory: agent + run: cargo test --verbose --release --target ${{ matrix.target }} From fe9aa679b921a16eb02d9492b4861be484ddc460 Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Tue, 28 Sep 2021 12:05:57 +0800 Subject: [PATCH 2/5] Add rustfmt component --- .github/workflows/presubmit-agent.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/presubmit-agent.yml b/.github/workflows/presubmit-agent.yml index 6f33a38727..468a44f949 100644 --- a/.github/workflows/presubmit-agent.yml +++ b/.github/workflows/presubmit-agent.yml @@ -37,6 +37,7 @@ jobs: with: toolchain: ${{ matrix.rust }} profile: minimal + components: rustfmt override: true target: ${{ matrix.target }} From b2789b23d2954d3ed83e25e5ad8dcd0c42f96219 Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Tue, 28 Sep 2021 12:10:08 +0800 Subject: [PATCH 3/5] Set fail-fast to false --- .github/workflows/presubmit-agent.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/presubmit-agent.yml b/.github/workflows/presubmit-agent.yml index 468a44f949..f98f99eb05 100644 --- a/.github/workflows/presubmit-agent.yml +++ b/.github/workflows/presubmit-agent.yml @@ -4,12 +4,14 @@ on: paths: - 'agent/**' jobs: - check: + presubmit: + name: Presubmit runs-on: ${{ matrix.os }} env: # Emit backtraces on panics. RUST_BACKTRACE: 1 strategy: + fail-fast: false matrix: build: [linux, macos, win-msvc] include: From 30b75f3018c4972d846714ee8e7d1d98642b8f9f Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Tue, 28 Sep 2021 12:13:52 +0800 Subject: [PATCH 4/5] Move format check to the last step --- .github/workflows/presubmit-agent.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/presubmit-agent.yml b/.github/workflows/presubmit-agent.yml index f98f99eb05..ffef511210 100644 --- a/.github/workflows/presubmit-agent.yml +++ b/.github/workflows/presubmit-agent.yml @@ -43,10 +43,14 @@ jobs: override: true target: ${{ matrix.target }} - - name: Cargo Format Check + - name: Cargo Build working-directory: agent - run: cargo fmt -- --check + run: cargo build --verbose --release --target ${{ matrix.target }} - name: Cargo Test working-directory: agent run: cargo test --verbose --release --target ${{ matrix.target }} + + - name: Cargo Format Check + working-directory: agent + run: cargo fmt --all -- --check From e7eb096db2ecd1a729d7d445d1993eb48d33aaa9 Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Tue, 28 Sep 2021 12:14:43 +0800 Subject: [PATCH 5/5] Don't use release flag for build and test --- .github/workflows/presubmit-agent.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/presubmit-agent.yml b/.github/workflows/presubmit-agent.yml index ffef511210..46e4a304df 100644 --- a/.github/workflows/presubmit-agent.yml +++ b/.github/workflows/presubmit-agent.yml @@ -45,11 +45,11 @@ jobs: - name: Cargo Build working-directory: agent - run: cargo build --verbose --release --target ${{ matrix.target }} + run: cargo build --verbose --target ${{ matrix.target }} - name: Cargo Test working-directory: agent - run: cargo test --verbose --release --target ${{ matrix.target }} + run: cargo test --verbose --target ${{ matrix.target }} - name: Cargo Format Check working-directory: agent