40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
name: Run short tests
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
run-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- name: Run short tests with coverage
|
|
working-directory: ./src
|
|
run: | # TODO: at this moment only Home Assistant component is tested
|
|
go test -v --short ./components/homeassistant/... -cover -coverprofile=cover.out
|
|
- name: Upload coverage report
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: coverage-report_build_${{ github.run_number }}
|
|
path: ${{ github.workspace }}/src/cover.out
|
|
retention-days: 1
|
|
- name: Generate coverage badge
|
|
run: |
|
|
go install github.com/t-yuki/gocover-cobertura@latest
|
|
gocover-cobertura < cover.out > coverage.xml
|
|
go install github.com/boumenot/gocover-cobertura@latest
|
|
gocover-cobertura -coverprofile=cover.out -o coverage.svg
|
|
- name: Upload coverage svg
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
path: coverage.svg
|
|
retention-days: 1
|
|
name: coverage-badge_build_${{ github.run_number }}
|