wip #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-and-test | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
types: [opened, edited] | |
pull_request_target: | |
types: [opened, edited] | |
env: | |
GO_VERSION: "~1.22" | |
GO111MODULE: "on" | |
jobs: | |
test-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache-dependency-path: go.mod | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
id: cache-go-packages | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build Application | |
run: task build | |
- name: Run functional test | |
env: | |
EGET_CONFIG: eget.toml | |
EGET_BIN: '' | |
TEST_EGET: ../dist/eget | |
run: cd test && go run test_eget.go | |
run-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Task | |
uses: arduino/setup-task@v2 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
id: cache-go-packages | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install ginkgo | |
run: go install github.com/onsi/ginkgo/v2/ginkgo | |
- name: Run unit tests with coverage | |
run: ginkgo -cover -r -v --junit-report ginkgo.xml | |
- name: Upload coverage reports to Codecov | |
if: ${{success()}} | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverprofile.out,ginkgo.xml |