Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Introduce unit tests execution workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Dec 1, 2023
1 parent 40f04dc commit 4ff3f52
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Unit Tests
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
workflow_call:
outputs:
workflow_output:
description: "Unit tests output"
value: ${{ jobs.go_test.outputs.test_output_failure }}

jobs:
go_test:
name: Execution
runs-on: ubuntu-latest
outputs:
test_output_failure: ${{ steps.run_tests_failure.outputs.test_output }}
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.21.x

- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Run Go Test
run: make unit-tests

- name: Run Go Test Failed
if: failure()
id: run_tests_failure
run: echo "test_output=false" >> $GITHUB_OUTPUT
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ stop-docker: check-docker
destroy-docker: check-docker
install-linter: check-go check-curl
lint: check-go
unit-tests: check-go
e2e-tests: check-go

ARCH := $(shell uname -m)

Expand Down Expand Up @@ -103,4 +105,6 @@ help: ## Prints the help

.PHONY: e2e-tests
e2e-tests: ## Runs E2E tests
go test -v -timeout=30m github.com/0xPolygon/beethoven/test
.PHONY: unit-tests
unit-tests: ## Runs unit tests
go test $(go list ./... | grep -v ./test) -v -timeout=5m

0 comments on commit 4ff3f52

Please sign in to comment.