From 4f784bcdce55a23edaa5b02127035af31d963f22 Mon Sep 17 00:00:00 2001 From: Verin1005 Date: Wed, 5 Jun 2024 18:29:21 +0800 Subject: [PATCH] add basci gha --- .github/workflows/ci.yml | 68 +++++++++++++++++++ .../delete-branch-after-pr-merge.yml | 19 ++++++ 2 files changed, 87 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/delete-branch-after-pr-merge.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6d958f6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: General CI + +on: + push: + branches: + - dev + paths-ignore: + - "**/README.md" + pull_request: + branches: + - dev + types: + - opened + - reopened + - synchronize + - ready_for_review +jobs: + + set-node: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set Node version + uses: actions/setup-node@v4 + with: + node-version: 18 + + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install deps + run: | + npm install + + - name: Fmt check + run: | + npm run fmt-check + + compile: + runs-on: ubuntu-latest + needs: + - fmt + steps: + - uses: actions/checkout@v4 + + - name: Compile solidity + run: | + npm run compile + + hardhat-test: + runs-on: ubuntu-latest + needs: + - compile + + - uses: actions/checkout@v4 + + - name: Run hardhat test + run: | + npm run test:all + + + + + + diff --git a/.github/workflows/delete-branch-after-pr-merge.yml b/.github/workflows/delete-branch-after-pr-merge.yml new file mode 100644 index 0000000..8314dee --- /dev/null +++ b/.github/workflows/delete-branch-after-pr-merge.yml @@ -0,0 +1,19 @@ +name: Delete branch after PR merge + +on: + pull_request_target: + types: + - closed + +jobs: + delete_branch_optionally: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: delete_branch + run: | + git push origin --delete "${{ github.head_ref }}" + echo "remote branch ${{ github.head_ref }} deleted" \ No newline at end of file