diff --git a/.github/workflows/readmeStats.yml b/.github/workflows/readmeStats.yml index 68d966b..1c64e9a 100644 --- a/.github/workflows/readmeStats.yml +++ b/.github/workflows/readmeStats.yml @@ -10,9 +10,9 @@ jobs: steps: - uses: actions/checkout@v4 - run: cd 2022 && go build . - - run: cd 2022 && ./aoc2022 + - run: cd 2022 && ./aoc2022 -benchmark - run: cd 2023 && go build . - - run: cd 2023 && ./aoc2023 + - run: cd 2023 && ./aoc2023 -benchmark - uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: Update readme statistics diff --git a/2022/main.go b/2022/main.go index b44b431..6dd2250 100644 --- a/2022/main.go +++ b/2022/main.go @@ -1,7 +1,9 @@ package main import ( + "flag" "fmt" + "os" "strconv" "aoc2022/utils" @@ -27,10 +29,17 @@ var solutions = map[string]func(){ } func main() { - for _, solution := range solutions { - utils.Benchmark(solution) + benchmark := flag.Bool("benchmark", false, "Run benchmarks") + flag.Parse() + + if !*benchmark { + for _, solution := range solutions { + utils.Benchmark(solution) + } + os.Exit(0) } + // Run the full benchark suite and update the README updateReadme() } diff --git a/2023/main.go b/2023/main.go index 95bbf17..159129e 100644 --- a/2023/main.go +++ b/2023/main.go @@ -1,7 +1,9 @@ package main import ( + "flag" "fmt" + "os" "strconv" "aoc2023/utils" @@ -13,10 +15,17 @@ var solutions = map[string]func(){ } func main() { - for _, solution := range solutions { - utils.Benchmark(solution) + benchmark := flag.Bool("benchmark", false, "Run benchmarks") + flag.Parse() + + if !*benchmark { + for _, solution := range solutions { + utils.Benchmark(solution) + } + os.Exit(0) } + // Run the full benchark suite and update the README updateReadme() }