From 38e5f642fac3df788c7520f0677bc85dc2ad1f26 Mon Sep 17 00:00:00 2001 From: codedump Date: Tue, 1 Oct 2024 16:22:49 +0800 Subject: [PATCH] feat: add github actions --- .github/actions/setup/action.yml | 21 +++++++++++++++++++++ .github/workflows/unit_test.yml | 24 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/workflows/unit_test.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..f23100d --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,21 @@ +name: Setup Rust Builder +description: 'Prepare Rust Build Environment' + +runs: + using: "composite" + steps: + - name: Setup rust related environment variables + shell: bash + run: | + # Disable full debug symbol generation to speed up CI build and keep memory down + # "1" means line tables only, which is useful for panic tracebacks. + # About `force-frame-pointers`, here's the discussion history: https://github.com/apache/opendal/issues/3756 + echo "RUSTFLAGS=-C force-frame-pointers=yes -C debuginfo=1" >> $GITHUB_ENV + # Enable backtraces + echo "RUST_BACKTRACE=1" >> $GITHUB_ENV + # Enable logging + echo "RUST_LOG=opendal=trace" >> $GITHUB_ENV + # Enable sparse index + echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV + # Make sure rust has been setup + cargo version diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml new file mode 100644 index 0000000..4407b4c --- /dev/null +++ b/.github/workflows/unit_test.yml @@ -0,0 +1,24 @@ +name: Unit Test + +on: + schedule: # execute every 24 hours + - cron: "* */24 * * *" + workflow_dispatch: + +jobs: + plan: + runs-on: ubuntu-latest + steps: + - name: 'Checkout codes' + uses: actions/checkout@v4 + with: + # fetch depth set to 0 to make sure we have correct diff result. + fetch-depth: 0 + + - name: Setup Rust toolchain + uses: ./.github/actions/setup + + - name: 'Run Unit tests' + shell: bash + run: | + cargo test