Skip to content

Commit

Permalink
Add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
angristan committed Dec 4, 2023
1 parent b3ae25a commit 4d1a179
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/push.yml
@@ -0,0 +1,54 @@
name: Push workflow

on: push

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os:
- linux
- darwin
arch:
- amd64
- arm64
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '>=1.21.0'
- name: Run build
run: go build -o $GOOS-$GOARCH
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '>=1.21.0'
- name: Run test
run: go test -v ./...

bench:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '>=1.21.0'
- name: Run test
run: go test -bench Benchmark -benchmem ./...

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: latest
20 changes: 19 additions & 1 deletion 01/01_test.go
@@ -1,6 +1,8 @@
package main

import "testing"
import (
"testing"
)

func TestComputeCalibrationSum(t *testing.T) {
type test struct {
Expand Down Expand Up @@ -41,3 +43,19 @@ func TestComputeCalibrationSum(t *testing.T) {

}
}

func BenchmarkComputeCalibrationSum(b *testing.B) {
input := []string{
"two1nine",
"eightwothree",
"abcone2threexyz",
"xtwone3four",
"4nineeightseven2",
"zoneight234",
"7pqrstsixteen",
}

for i := 0; i < b.N; i++ {
ComputeCalibrationSum(input)
}
}

0 comments on commit 4d1a179

Please sign in to comment.