diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..f10603fbe --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: [ "develop", "release-candidate", "main" ] + pull_request: + branches: [ "develop", "release-candidate", "main" ] + +jobs: + unit-test: + name: Unit Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + - name: Run ginkgo tests + run: go run github.com/onsi/ginkgo/v2/ginkgo -r --procs=3 --compilers=3 --randomize-all --randomize-suites --fail-on-pending --keep-going --race --trace helpers + + check-pr-target-branch: + if: github.event_name == 'pull_request' + name: Check PR target branch + runs-on: ubuntu-latest + steps: + - name: Fail if target branch is main + run: | + if [ "${{ github.event.pull_request.base.ref }}" == "main" ]; then + echo "Pull requests should not target 'main' branch." + exit 1 + fi + - name: Fail if target branch is release-candidate + run: | + if [ "${{ github.event.pull_request.base.ref }}" == "release-candidate" ]; then + echo "Pull requests should not target 'release-candidate' branch." + exit 1 + fi