From ddb1efc47fa9dd255aa5b3acb568d26f290a93c5 Mon Sep 17 00:00:00 2001 From: MalteHerrmann Date: Mon, 28 Aug 2023 16:26:18 +0200 Subject: [PATCH] add CI and makefile for unit tests --- .github/workflows/test.yml | 35 +++++++++++++++++++++++++++++++++++ CHANGELOG.md | 6 ++++++ Makefile | 4 ++++ 3 files changed, 45 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 Makefile diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6aaafe6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +name: Tests +on: + pull_request: + push: + branches: + - main + - release/** + +jobs: + cleanup-runs: + runs-on: ubuntu-latest + steps: + - uses: rokroskar/workflow-run-cleanup-action@master + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'" + + test-unit: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v4 + with: + go-version: '1.20' + check-latest: true + - uses: actions/checkout@v3 + - uses: technote-space/get-diff-action@v6.1.2 + with: + PATTERNS: | + **/**.go + go.mod + go.sum + - name: Run Unit Tests + run: | + make test-unit + if: env.GIT_DIFF diff --git a/CHANGELOG.md b/CHANGELOG.md index 32b8ab3..677c7d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog +## Unreleased + +### Improvements + +- [#4](https://github.com/MalteHerrmann/upgrade-local-node-go/pull/4) add GH actions and Makefile for testing + ## [v0.2.0](https://github.com/MalteHerrmann/upgrade-local-node-go/releases/tag/v0.2.0) - 2023-08-09 ### Improvements diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ec8b559 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +test: test-unit + +test-unit: + go test -mod=readonly ./...