Refactor: delegate more on web app #376
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: Test/Tag | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
# unit-test-windows: | |
# if: ${{ !startsWith(github.event.head_commit.message, 'tag') }} | |
# runs-on: windows-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - uses: actions/setup-go@v4 | |
# with: | |
# go-version: '1.21' | |
# - name: Test | |
# run: go test -v ./... | |
unit-test-linux: | |
if: ${{ !startsWith(github.event.head_commit.message, 'tag') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Test | |
run: go test -v -covermode=count -coverprofile=.coverage.out ./... -coverpkg=./... | |
- name: Coveralls upload | |
uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: .coverage.out | |
web-unit-test: | |
if: ${{ !startsWith(github.event.head_commit.message, 'tag') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
cache-dependency-path: web/package-lock.json | |
- name: Install | |
run: npm i | |
working-directory: web | |
- name: Test | |
run: npm run test | |
working-directory: web | |
lint: | |
if: ${{ !startsWith(github.event.head_commit.message, 'tag') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.0 | |
- run: golangci-lint run -v | |
web-lint: | |
if: ${{ !startsWith(github.event.head_commit.message, 'tag') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
cache-dependency-path: web/package-lock.json | |
- name: Install | |
run: npm i | |
working-directory: web | |
- name: Test | |
run: npm run lint | |
working-directory: web | |
tag: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: | |
- unit-test-linux | |
# - unit-test-windows | |
- web-unit-test | |
- lint | |
- web-lint | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' # https://github.com/actions/checkout/issues/217 | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Tag | |
run: | | |
version=$(.github/semver.sh) | |
git config user.name github-actions | |
git config user.email [email protected] | |
sed "s/\"v[0-9]*\.[0-9]*\.[0-9]*\"/\"$version\"/" cmd/root.go > cmd/_root.go | |
mv cmd/_root.go cmd/root.go | |
git add cmd/root.go | |
git commit -m "tag: $version" | |
git tag "$version" | |
git push | |
git push --tags |