Skip to content

Commit

Permalink
chore(gh-actions): build driver before run linter and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-github committed Jun 15, 2024
1 parent 9fd707e commit 52d02b4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
37 changes: 24 additions & 13 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- "CHANGELOG.md"
- "README.md"
push:
branches: [ main ]
branches: [main]
paths-ignore:
- "CHANGELOG.md"
- "README.md"
Expand All @@ -14,30 +14,41 @@ permissions:
contents: read

jobs:
build:
name: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Build driver
run: make build

unit-tests:
name: unit tests
runs-on: ubuntu-latest
needs: build
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Set up cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum', 'tools/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install tools
run: make tools

- name: Lint source code
run: make tools lint
run: make lint

- name: Run unit tests
run: make test
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ test:
.PHONE: build
build:
@echo "==> Building binary..."
@echo " running go build"
@CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(PROJECT_NAME) cmd/xelon-csi/main.go
@echo " running go build for GOOS=linux GOARCH=amd64"
@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(PROJECT_NAME) cmd/xelon-csi/main.go


## build-docker: Build docker image with included binary.
Expand Down

0 comments on commit 52d02b4

Please sign in to comment.