From e023bf6b713de579172da4bae39c339a4bbf3f2f Mon Sep 17 00:00:00 2001 From: Mona Aghili <155162210+emmadevjr@users.noreply.github.com> Date: Fri, 24 May 2024 13:10:16 +0330 Subject: [PATCH 1/2] Add unit test to github actions --- .github/workflows/go.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index fb7ef42..0485c11 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -40,8 +40,8 @@ jobs: exit 1 fi - test: - name: Test + unit-test: + name: Unit Tests runs-on: ubuntu-latest needs: fmt steps: @@ -58,5 +58,26 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - - name: Test - run: go test -v . + - name: Run Unit Tests + run: go test -v ./... -run '.*_unit_test.go' + + property-test: + name: Property Tests + runs-on: ubuntu-latest + needs: fmt + steps: + - name: Setting up Go + uses: actions/setup-go@v3 + with: + go-version: '1.22.2' + - name: Check out code + uses: actions/checkout@v2 + - name: Cache Go Modules + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Run Property Tests + run: go test -v ./... -run '.*_property_test.go' From 949fa3a674702d21db850885ce9f29baa0660a64 Mon Sep 17 00:00:00 2001 From: emmadevjr Date: Fri, 24 May 2024 13:24:41 +0330 Subject: [PATCH 2/2] Fix formatting actions issue --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 0485c11..8d73415 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -31,7 +31,7 @@ jobs: uses: actions/setup-go@v3 with: go-version: '1.22.2' - - name: Format + - name: Check Formatting run: | unformatted=$(gofmt -l .) if [ -n "$unformatted" ]; then