feat: migrate reporting to use cases #118
Workflow file for this run
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: ci | |
on: [push] | |
env: | |
GOEXPERIMENT: loopvar | |
jobs: | |
meta: | |
runs-on: ubuntu-latest | |
outputs: | |
date: ${{ steps.meta.outputs.date }} | |
pkg: ${{ steps.meta.outputs.pkg }} | |
steps: | |
- name: Configure build meta | |
id: meta | |
run: | | |
echo "::set-output name=date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | |
echo "::set-output name=pkg::github.com/sergeii/swat4master/cmd/swat4master" | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
- name: Run tests with coverage | |
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./... | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
- name: Run golangci | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54.1 | |
install-mode: "goinstall" | |
args: --timeout=10m | |
smoke-binary: | |
runs-on: ubuntu-latest | |
needs: meta | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Configure linker flags | |
id: ldflags | |
run: echo "::set-output name=ldflags::-X '${{ needs.meta.outputs.pkg }}/build.Time=${{ needs.meta.outputs.date }}' -X '${{ needs.meta.outputs.pkg }}/build.Commit=${{ github.sha }}' -X '${{ needs.meta.outputs.pkg }}/build.Version=${{ github.ref_name }}'" | |
- name: Build test binary | |
run: go build -v -ldflags="${{ steps.ldflags.outputs.ldflags }}" -o swat4master cmd/swat4master/main.go | |
- name: Test built binary | |
run: ./swat4master -version | |
smoke-image: | |
runs-on: ubuntu-latest | |
needs: | |
- meta | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build test image | |
uses: docker/build-push-action@v3 | |
with: | |
load: true | |
tags: testing | |
build-args: | | |
build_commit_sha=${{ github.sha }} | |
build_version=testing | |
build_time=${{ needs.meta.outputs.date }} | |
- name: Test built image | |
run: docker run --rm testing -version |