Skip to content

Commit

Permalink
Merge pull request #4 from madflojo/split
Browse files Browse the repository at this point in the history
Splitting into multiple modules
  • Loading branch information
madflojo authored Jul 26, 2024
2 parents ef4a859 + 7f38459 commit 5aacd3a
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 22 deletions.
46 changes: 27 additions & 19 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,37 @@ on:
tags:
- v*
branches:
- actions
- main
pull_request:

jobs:
generate-matrix:
name: Generate matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
golangci_cfg_path: ${{ steps.find-golangci-cfg-path.outputs.golangci_cfg_path }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set matrix
id: set-matrix
run: |
MODULES=$(find . -type f -name "go.mod" | sed -e 's/\/go.mod//g' | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=${MODULES}" >> $GITHUB_OUTPUT
- name: Find golangci.yml path
id: find-golangci-cfg-path
run: |
GOLANGCI_CFG_PATH=$(find $GITHUB_WORKSPACE -type f -name ".golangci.yml" | head -n 1)
echo "golangci_cfg_path=${GOLANGCI_CFG_PATH}" >> $GITHUB_OUTPUT
golangci:
name: golangci
needs: generate-matrix
runs-on: ubuntu-latest
strategy:
matrix:
modules: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/setup-go@v3
with:
Expand All @@ -19,23 +43,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
working-directory: ${{ matrix.modules }}
args: -E misspell -E revive -E gochecknoinits -E gofmt -E errname -c ${{ needs.generate-matrix.outputs.golangci_cfg_path }}

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: -E misspell -E revive -E bodyclose -E errname -E gofmt --timeout=5m

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go.
# skip-go-installation: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ build:
$(MAKE) -C testdata/hello-go build

tests: build
go test -race -v -covermode=atomic -coverprofile=coverage.out ./...
$(MAKE) -C callbacks tests
$(MAKE) -C engine tests

benchmarks: build
go test -bench=. -benchmem ./...
$(MAKE) -C callbacks benchmarks
$(MAKE) -C engine benchmarks
5 changes: 5 additions & 0 deletions callbacks/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tests:
go test -race -v -covermode=atomic -coverprofile=coverage.out ./...

benchmarks:
go test -bench=. -benchmem ./...
3 changes: 3 additions & 0 deletions callbacks/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/tarmac-project/wapc-toolkit/callbacks

go 1.21.4
5 changes: 5 additions & 0 deletions engine/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tests:
go test -race -v -covermode=atomic -coverprofile=coverage.out ./...

benchmarks:
go test -bench=. -benchmem ./...
2 changes: 1 addition & 1 deletion go.mod → engine/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/tarmac-project/wapc-toolkit
module github.com/tarmac-project/wapc-toolkit/engine

go 1.21.4

Expand Down
File renamed without changes.

0 comments on commit 5aacd3a

Please sign in to comment.