Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Add make target and actions job to execute tests #85

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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
strategy:
matrix:
node-version: [ 18 ]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
cache-dependency-path: ui/pnpm-lock.yaml

- name: Build UI Dashboard
run: pnpm --dir=./ui install && pnpm --dir=./ui build

- 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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ clean:
rm -rf ui/build/*

vet:
go vet
go vet

test:
go test ./...
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` <br>
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`