Skip to content

Commit

Permalink
Migrate to goyek (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraaga authored Nov 28, 2024
1 parent 663ec64 commit f86bbd4
Show file tree
Hide file tree
Showing 24 changed files with 387 additions and 388 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/bench.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
branches:
- main
paths-ignore:
- '**/*.md'
- '**/*.txt'
- '**/*.yaml'
- "**/*.md"
- "**/*.txt"
- "**/*.yaml"
workflow_dispatch:

jobs:
Expand All @@ -19,14 +19,14 @@ jobs:
go-version-file: go.work
cache-dependency-path: |
**/go.sum
magefiles/versions.go
build/versions.go
- name: setup re2 for cgo
run: sudo apt-get update && sudo apt-get install -y libre2-dev

- run: go run mage benchall
- run: go run ./build bench-all

- run: go run mage wafbenchall
- run: go run ./build wafbench-all

- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v3
with:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5
with:
# TODO: Split lint step to allow it to have a higher minimum Go requirement.
go-version: '^1.22'
go-version: "^1.22"
cache-dependency-path: |
**/go.sum
magefiles/versions.go
build/versions.go
- name: setup re2 for cgo (linux)
if: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.mode == 'cgo' }}
Expand All @@ -64,7 +64,7 @@ jobs:
run: go install github.com/wasilibs/tools/cmd/wasmtime@875fe73f677c58d467ee373a9e00e6cb66b268f3

- name: run checks
run: go run mage check
run: go run ./build ${{ startsWith(matrix.os, 'ubuntu-') && 'check' || 'test' }}
if: ${{ !startsWith(matrix.os, 'windows-') || matrix.mode != 'cgo' }}
env:
RE2_TEST_MODE: ${{ matrix.mode }}
Expand All @@ -76,11 +76,11 @@ jobs:
# Race detector currently fails with Windows
TEST_NORACE: ${{ startsWith(matrix.os, 'windows-') && matrix.mode == 'wazero' && 'true' || '' }}

- name: run checks (windows cgo)
run: go run mage check
- name: run tests (windows cgo)
run: go run ./build test
if: ${{ startsWith(matrix.os, 'windows-') && matrix.mode == 'cgo' }}
# Shell does not support conditional expressions using matrix, so for now we duplicate the steps
shell: 'msys2 {0}'
shell: "msys2 {0}"
env:
RE2_TEST_MODE: ${{ matrix.mode }}
# General coverage should be good enough to not need to slow down development
Expand All @@ -90,16 +90,16 @@ jobs:
GOMEMLIMIT: ${{ github.event_name != 'pull_request' && '1GiB' || '' }}

test-bsd:
runs-on: ubuntu-latest
runs-on: ubuntu-latest

steps:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5
with:
go-version-file: go.work
cache-dependency-path: |
**/go.sum
magefiles/versions.go
build/versions.go
- name: Build
run: go test -c .
Expand All @@ -110,7 +110,7 @@ jobs:
uses: cross-platform-actions/action@cdc9ee69ef84a5f2e59c9058335d9c57bcb4ac86 # v0.25.0
with:
operating_system: freebsd
version: '14.0'
version: "14.0"
shell: bash
run: ./go-re2.test -test.v -test.short
sync_files: runner-to-vm
Expand All @@ -128,6 +128,6 @@ jobs:

- run: if command -v gcc &> /dev/null; then echo "GCC found but not expected"; exit 321; fi

- run: go run mage test
- run: go run ./build test
env:
TEST_NORACE: "true"
10 changes: 5 additions & 5 deletions .github/workflows/wasm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
app-id: ${{ vars.WASILIBS_APP_ID }}
private-key: ${{ secrets.WASILIBS_APP_PRIVATE_KEY }}

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
token: ${{ github.event_name != 'pull_request' && steps.app-token.outputs.token || github.token }}
Expand All @@ -38,20 +38,20 @@ jobs:
go-version: ^1.22
cache-dependency-path: |
**/go.sum
magefiles/versions.go
build/versions.go
- run: go run mage updateLibs
- run: go run ./build wasm

- name: generate memory.wasm
run: go run github.com/wasilibs/go-wabt/cmd/wat2wasm@face6b1 --enable-threads -o internal/wasm/memory.wasm internal/wasm/memory.wat

- run: go run mage test
- run: go run ./build test

- uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1
if: github.event_name != 'pull_request'
with:
subject-path: internal/wasm/*

- name: push wasm
if: github.event_name != 'pull_request'
continue-on-error: true # Ignore if there is no change
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea
build
out
go.work.sum
10 changes: 8 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
linters:
enable:
- gci
- gofumpt
- goimports
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/wasilibs/go-re2)
issues:
exclude-rules:
- path: magefiles
Expand All @@ -10,4 +16,4 @@ issues:
- path: _test.go
linters:
# We have tests for deprecated methods
- staticcheck
- staticcheck
5 changes: 5 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rules:
document-start: disable
line-length: disable
truthy:
check-keys: false
21 changes: 10 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Contributor Covenant Code of Conduct

## Our Pledge
Expand All @@ -18,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ behavior differences. These are likely corner cases that don't affect typical ap
best to confirm them before proceeding.

- Invalid utf-8 strings are treated differently. The standard library silently replaces invalid utf-8
with the unicode replacement character. This library will stop consuming strings when encountering
invalid utf-8.
with the unicode replacement character. This library will stop consuming strings when encountering
invalid utf-8.

- `experimental.CompileLatin1` can be used to match against non-utf8 strings

- `reflect.DeepEqual` cannot compare `Regexp` objects.
Expand Down Expand Up @@ -93,6 +94,7 @@ pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-re2
pacman -S mingw-w64-x86_64-pkg-config
```

If you want to run the resulting exe program outside the MINGW64 terminal you need to add a path to the MinGW-w64 libraries to the PATH environmental variable (adjust as needed for your system):

```cmd
Expand All @@ -105,7 +107,7 @@ On Mac start by installing [homebrew][9] including installation of the command l

```bash
brew install re2
````
```

## Performance

Expand Down
18 changes: 18 additions & 0 deletions build/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module build

go 1.21

require (
github.com/curioswitch/go-build v0.0.0-20241128010140-c23617fb13e0
github.com/goyek/goyek/v2 v2.2.0
github.com/goyek/x v0.2.0
)

require (
github.com/fatih/color v1.17.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-shellwords v1.0.12 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/sys v0.21.0 // indirect
)
21 changes: 21 additions & 0 deletions build/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
github.com/curioswitch/go-build v0.0.0-20241128010140-c23617fb13e0 h1:8vJgbqblea6p+Aej1gU5Zlz1Z2D4tWy/rEYerLmr51A=
github.com/curioswitch/go-build v0.0.0-20241128010140-c23617fb13e0/go.mod h1:N585oVwaSkxE9Iwus9TAHJEkoSQ+1/sSNFxFqLzn4iU=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/goyek/goyek/v2 v2.2.0 h1:FXdta04rwVN/HE33XKcBtYht6iaDkJ9Z5Bdh1TdXjO0=
github.com/goyek/goyek/v2 v2.2.0/go.mod h1:mqU0PSD8q3TRCzhJ1mL79/X7FOrXJcpvOtDEBXi92+E=
github.com/goyek/x v0.2.0 h1:vLTzDTqbUQnWTM3NOnejGAWwWZA+hJHElv/cd/3ybQc=
github.com/goyek/x v0.2.0/go.mod h1:I1yv17Zj0g3Zv5iDC+kB9gh3cqJquJSTEgfognEfe94=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
Loading

0 comments on commit f86bbd4

Please sign in to comment.