-
Notifications
You must be signed in to change notification settings - Fork 164
/
magefile.go
54 lines (48 loc) · 893 Bytes
/
magefile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//go:build mage
// +build mage
package main
import (
"context"
"fmt"
"github.com/magefile/mage/sh"
"golang.org/x/sync/errgroup"
)
func BuildAll(ctx context.Context) error {
skips := map[int]bool{
16: false,
}
const lastEpisode = 32
g, ctx := errgroup.WithContext(ctx)
for i := 0; i <= lastEpisode; i++ {
if _, ok := skips[i]; ok {
continue
}
idx := i
g.Go(func() error {
return sh.RunV(
"go",
"build",
"-o",
fmt.Sprintf("bin/episode%d", idx),
fmt.Sprintf("./episode%d", idx),
)
})
}
return g.Wait()
}
func TestOne(ctx context.Context, episodeNum int) error {
return sh.RunV(
"go",
"test",
fmt.Sprintf("./episode%d", episodeNum),
)
}
func BuildOne(ctx context.Context, episodeNum int) error {
return sh.RunV(
"go",
"build",
"-o",
fmt.Sprintf("bin/episode%d", episodeNum),
fmt.Sprintf("./episode%d", episodeNum),
)
}