diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a9b8d2a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: Run integration tests + +on: + # Runs when a push is made the main branch + push: + branches: [ "main" ] + # Runs when a PR is targeting the main branch + pull_request: + branches: [ "main" ] + # Manual activation + workflow_dispatch: + +jobs: + go_test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: ">=1.21.3" + - name: Tidy modules + run: go mod tidy + - name: Run tests + run: go test -v -coverprofile coverage.csv ./... + - name: Create coverage report + run: go tool cover -html=coverage.csv -o coverage.html + - name: Upload coverage report + uses: actions/upload-artifact@v3 + with: + name: coverage.html + path: coverage.html diff --git a/Makefile b/Makefile index 2772318..f5bcb1a 100644 --- a/Makefile +++ b/Makefile @@ -24,4 +24,7 @@ clean: rm -rf ui/build/* vet: - go vet \ No newline at end of file + go vet + +test: + go test ./... diff --git a/README.md b/README.md index 848a6a9..d62f60d 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ If you do not wish to use this, you can just rename `.example.env` to `.env` and 1. Run `make prep` 2. Run `make clean` -3. Run `make build`
+3. Run `make test` +4. Run `make build` -Your binary should now be built and you can run it with `bin/go-fast-cdn-linux` or `bin/go-fast-cdn-windows` or `bin/go-fast-cdn-darwin` +Your binary should now be tested, built, and you can run it with `bin/go-fast-cdn-linux` or `bin/go-fast-cdn-windows` or `bin/go-fast-cdn-darwin`