Skip to content

Commit

Permalink
enable CI/CD for Golang mono repo (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
fogfish authored Sep 8, 2024
1 parent bd42920 commit 32bb9b5
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 64 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
##
## Build the main branch
##
name: build
on:
push:
branches:
- main
- /refs/heads/main

jobs:

build:
runs-on: ubuntu-latest
strategy:
matrix:
module: [".", "x/awsapi", "x/xhtml"]

steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"

- uses: actions/checkout@v4

- name: go build
working-directory: ${{ matrix.module }}
run: |
go build ./...
- name: go test
working-directory: ${{ matrix.module }}
run: |
go test -coverprofile=profile.cov $(go list ./... | grep -v /examples/)
- uses: shogo82148/actions-goveralls@v1
continue-on-error: true
with:
working-directory: ${{ matrix.module }}
path-to-profile: profile.cov
flag-name: ${{ matrix.module }}
parallel: true

- name: release
working-directory: ${{ matrix.module }}
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions@users.noreply.github.com"
for mod in `grep -roh "const Version = \".*" * | grep -Eoh "([[:alnum:]]*/*){1,}v[0-9]*\.[0-9]*\.[0-9]*"`
do
git tag $mod 2> /dev/null && git push origin -u $mod 2> /dev/null && echo "[+] $mod" || echo "[ ] $mod"
done
finish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true
25 changes: 0 additions & 25 deletions .github/workflows/check-code.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/check-test.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
###
## Unit Tests & Coverage
##
name: check
on:
pull_request:
types:
- opened
- synchronize

jobs:

unit:
runs-on: ubuntu-latest
strategy:
matrix:
module: [".", "x/awsapi", "x/xhtml"]

steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21"

- uses: actions/checkout@v4

- name: go build
working-directory: ${{ matrix.module }}
run: |
go build ./...
- name: go test
working-directory: ${{ matrix.module }}
run: |
go test -coverprofile=profile.cov $(go list ./... | grep -v /examples/)
- uses: shogo82148/actions-goveralls@v1
continue-on-error: true
with:
working-directory: ${{ matrix.module }}
path-to-profile: profile.cov
flag-name: ${{ matrix.module }}
parallel: true

- uses: dominikh/staticcheck-action@v1.3.0
with:
install-go: false
working-directory: ${{ matrix.module }}

finish:
needs: unit
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
with:
parallel-finished: true
11 changes: 11 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// Copyright (C) 2019 - 2024 Dmitry Kolesnikov
//
// This file may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
// https://github.com/fogfish/gurl
//

package gurl

const Version = "v2.9.1"
11 changes: 11 additions & 0 deletions x/awsapi/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// Copyright (C) 2019 - 2024 Dmitry Kolesnikov
//
// This file may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
// https://github.com/fogfish/gurl
//

package awsapi

const Version = "x/awsapi/v0.0.3"
11 changes: 11 additions & 0 deletions x/xhtml/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// Copyright (C) 2019 - 2024 Dmitry Kolesnikov
//
// This file may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
// https://github.com/fogfish/gurl
//

package xhtml

const Version = "x/xhtml/v0.0.2"

0 comments on commit 32bb9b5

Please sign in to comment.