Rewrite SplitLocale to not allocate #10
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 | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- "**.go" | |
- "**.c" | |
- "**.m" | |
- "**.yml" | |
pull_request: | |
branches: | |
- master | |
paths: | |
- "**.go" | |
- "**.c" | |
- "**.m" | |
- "**.yml" | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
go: | |
- ~1.17 | |
- ~1.18 | |
- ~1.19 | |
- ~1.20 | |
- ~1.21 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Cache the Go modules | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Download the Go modules | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: go mod download | |
- name: Build | |
run: go build -ldflags="-s -w" ./examples/getlocale | |
- name: Build (WASM) | |
if: startsWith(matrix.os, 'ubuntu') | |
# Try to build the WASM executable once (on Ubuntu) | |
run: GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o getlocale.wasm ./examples/getlocale | |
- name: Set locale (macOS) | |
if: startsWith(matrix.os, 'macos') | |
# Manually set the AppleLanguages on macOS | |
# Otherwise, we get the following error when running GetLocales(): | |
# The domain/default pair of (kCFPreferencesAnyApplication, AppleLanguages) does not exist | |
run: defaults write NSGlobalDomain AppleLanguages "(en, fr-FR, ja-JP)" | |
- name: Test | |
run: go test -v -race -covermode="atomic" -coverprofile="profile.cov" | |
- name: Send coverage | |
uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: profile.cov | |
parallel: true | |
finish: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send post build webhook to Coveralls | |
uses: shogo82148/actions-goveralls@v1 | |
with: | |
parallel-finished: true | |
lint: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
GOLANGCI_LINT_VERSION: 1.55.2 | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Download golangci-lint | |
if: startsWith(matrix.os, 'windows') != true | |
run: | | |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ~/bin "v${GOLANGCI_LINT_VERSION}" | |
- name: Download golangci-lint | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
Invoke-WebRequest "https://github.com/golangci/golangci-lint/releases/download/v${env:GOLANGCI_LINT_VERSION}/golangci-lint-${env:GOLANGCI_LINT_VERSION}-windows-amd64.zip" -OutFile "golangci-lint.zip" | |
Expand-Archive "golangci-lint.zip" -DestinationPath "." | |
New-Item -ItemType Directory -Path "~\bin" | |
Move-Item -Path "golangci-lint-${env:GOLANGCI_LINT_VERSION}-windows-amd64\golangci-lint.exe" -Destination "~\bin\" | |
- name: Run golangci-lint | |
run: ~/bin/golangci-lint run --out-format github-actions . |