Skip to content

Commit 2848e56

Browse files
authored
CI: Add GH actions workflow (#1371)
* CI: Add GH actions workflow * CI: Remove schedule from CI workflow Removes the unnecessary schedule from the GH Actions CI workflow. The schedule is unnecessary because there's currently no external dependency in any of the jobs in the workflow that could benefit from testing over time, without code changes. For example, that usually takes the form of a linting job, where the linting tool improves over time.
1 parent 803ab83 commit 2848e56

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "develop", "release-candidate", "main" ]
6+
pull_request:
7+
branches: [ "develop", "release-candidate", "main" ]
8+
9+
jobs:
10+
unit-test:
11+
name: Unit Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version-file: "go.mod"
18+
- name: Run ginkgo tests
19+
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
20+
21+
check-pr-target-branch:
22+
if: github.event_name == 'pull_request'
23+
name: Check PR target branch
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Fail if target branch is main
27+
run: |
28+
if [ "${{ github.event.pull_request.base.ref }}" == "main" ]; then
29+
echo "Pull requests should not target 'main' branch."
30+
exit 1
31+
fi
32+
- name: Fail if target branch is release-candidate
33+
run: |
34+
if [ "${{ github.event.pull_request.base.ref }}" == "release-candidate" ]; then
35+
echo "Pull requests should not target 'release-candidate' branch."
36+
exit 1
37+
fi

0 commit comments

Comments
 (0)