Skip to content

Commit 30bc487

Browse files
committed
add matrix build steps
1 parent c7191b5 commit 30bc487

File tree

3 files changed

+38
-33
lines changed

3 files changed

+38
-33
lines changed

.github/workflows/ci.yaml

+32-25
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,42 @@
11
name: Continuous Integration
2-
on:
3-
pull_request:
4-
types: [opened, synchronize, reopened]
5-
push:
6-
branches:
7-
- master
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
push:
6+
branches:
7+
- master
88

99
jobs:
1010
report:
1111
name: Report
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: ref
15-
run: echo ${{ github.ref }}
16-
- name: event_name
17-
run: echo ${{ github.event_name }}
14+
- name: ref
15+
run: echo ${{ github.ref }}
16+
- name: event_name
17+
run: echo ${{ github.event_name }}
1818
build:
1919
name: Build
20-
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
os: [macos-latest, windows-latest, ubuntu-latest]
23+
runs-on: ${{ matrix.os }}
2124
steps:
22-
- name: checkout
23-
uses: actions/checkout@v2
24-
- uses: actions/setup-go@v2
25-
with:
26-
go-version: ^1.16
27-
- name: vet
28-
run: make vet
29-
- name: lint
30-
run: make lint
31-
- name: image
32-
run: make image
33-
- name: test
34-
run: make test
35-
25+
- name: checkout
26+
uses: actions/checkout@v2
27+
- uses: actions/setup-go@v2
28+
with:
29+
go-version: ^1.16
30+
- run: go build
31+
- name: vet
32+
if: matrix.os != 'windows-latest'
33+
run: make vet
34+
- name: lint
35+
if: matrix.os != 'windows-latest'
36+
run: make lint
37+
- name: image
38+
if: matrix.os == 'ubuntu-latest'
39+
run: make image
40+
- name: test
41+
if: matrix.os == 'ubuntu-latest'
42+
run: make test

Makefile

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ GOBIN ?= $(shell go env GOPATH)/bin
88
LINTER ?= $(GOBIN)/golangci-lint
99
LINTER_VERSION ?= v1.49.0
1010

11-
1211
# BUILDARCH is the host architecture
1312
# ARCH is the target architecture
1413
# we need to keep track of them separately
@@ -30,10 +29,10 @@ OS ?= $(BUILDOS)
3029

3130
# canonicalized names for target architecture
3231
ifeq ($(ARCH),aarch64)
33-
override ARCH=arm64
32+
override ARCH=arm64
3433
endif
3534
ifeq ($(ARCH),x86_64)
36-
override ARCH=amd64
35+
override ARCH=amd64
3736
endif
3837

3938
BUILD_CMD = CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH)
@@ -62,12 +61,11 @@ golangci-lint: $(LINTER)
6261
$(LINTER):
6362
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) $(LINTER_VERSION)
6463

65-
6664
## Check the file format
6765
fmt-check:
6866
@if [ -n "$(shell $(BUILD_CMD) gofmt -l ${GO_FILES})" ]; then \
69-
$(BUILD_CMD) gofmt -s -e -d ${GO_FILES}; \
70-
exit 1; \
67+
$(BUILD_CMD) gofmt -s -e -d ${GO_FILES}; \
68+
exit 1; \
7169
fi
7270

7371
## Lint the files

diskfs_unix.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build !darwin || linux || solaris || aix || freebsd || illumos || netbsd || openbsd || plan9
2-
// +build !darwin linux solaris aix freebsd illumos netbsd openbsd plan9
1+
//go:build linux || solaris || aix || freebsd || illumos || netbsd || openbsd || plan9
2+
// +build linux solaris aix freebsd illumos netbsd openbsd plan9
33

44
package diskfs
55

0 commit comments

Comments
 (0)