Skip to content

Commit

Permalink
Merge pull request #502 from andyzhangx/build-test
Browse files Browse the repository at this point in the history
test: add github action build test
  • Loading branch information
saad-ali authored Mar 29, 2022
2 parents b09ca9e + 19e8f62 commit de56b07
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 45 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Ubuntu Build Test

on:
pull_request: {}
push: {}

jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.16
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Build Test
run: |
make
make -C lib/go protoc
make -C lib/go protoc-gen-go
make build_go
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,32 @@ CSI_PKG := lib/go/csi
# This is the target for building the temporary CSI protobuf file.
#
# The temporary file is not versioned, and thus will always be
# built on Travis-CI.
# built on GitHub Actions.
$(CSI_PROTO).tmp: $(CSI_SPEC) Makefile
echo "// Code generated by make; DO NOT EDIT." > "$@"
cat $< | sed -n -e '/```protobuf$$/,/^```$$/ p' | sed '/^```/d' >> "$@"

# This is the target for building the CSI protobuf file.
#
# This target depends on its temp file, which is not versioned.
# Therefore when built on Travis-CI the temp file will always
# be built and trigger this target. On Travis-CI the temp file
# Therefore when built on GitHub Actions the temp file will always
# be built and trigger this target. On GitHub Actions the temp file
# is compared with the real file, and if they differ the build
# will fail.
#
# Locally the temp file is simply copied over the real file.
$(CSI_PROTO): $(CSI_PROTO).tmp
ifeq (true,$(TRAVIS))
ifeq (true,$(GITHUB_ACTIONS))
diff "$@" "$?"
else
diff "$@" "$?" > /dev/null 2>&1 || cp -f "$?" "$@"
endif

build: check

# If this is not running on Travis-CI then for sake of convenience
# If this is not running on GitHub Actions then for sake of convenience
# go ahead and update the language bindings as well.
ifneq (true,$(TRAVIS))
ifneq (true,$(GITHUB_ACTIONS))
build: build_cpp build_go
endif

Expand Down
2 changes: 1 addition & 1 deletion lib/go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ $(CSI_GO_TMP): $(CSI_PROTO) | $(PROTOC) $(PROTOC_GEN_GO)
# versioned. If they are different then it means the language
# bindings were not updated prior to being committed.
$(CSI_GO): $(CSI_GO_TMP)
ifeq (true,$(TRAVIS))
ifeq (true,$(GITHUB_ACTIONS))
diff "$@" "$?"
else
@mkdir -p "$(@D)"
Expand Down

0 comments on commit de56b07

Please sign in to comment.