Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: migrate to devbox tooling #358

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Automatically sets up your devbox environment whenever you cd into this
# directory via our direnv integration:

eval "$(devbox generate direnv --print-envrc)"

# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
# for more details
33 changes: 25 additions & 8 deletions .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,52 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."

- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."

- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
- uses: actions/cache@v3
with:
go-version: "^1.21"
path: |
~/.cache/golangci-lint
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Install devbox
run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f

- name: Install devbox deps
run: devbox install

- name: Verify that generated manifests committed to the repository are up to date
run: make verify-manifests
run: devbox run -- make verify-manifests

- name: Build
run: make generate fmt vet build
run: devbox run -- make generate fmt vet build

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
with:
args: --enable gofmt --enable gofumpt --timeout 5m --build-tags e2e

- name: Lint
run: make lint-yaml
run: devbox run -- make lint-yaml

- name: Run unit tests
run: make unit-test
run: devbox run -- make unit-test

# gocov-xml expects things to be properly placed under go path.
# GHA clones into /home/runner/work/repository so we create
# the directory under the right path and link it
- run: mkdir -p /home/runner/go/src/github.com/nutanix-cloud-native/ && ln -s /home/runner/work/cluster-api-provider-nutanix/cluster-api-provider-nutanix /home/runner/go/src/github.com/nutanix-cloud-native

- name: Run coverage report
run: make coverage
run: devbox run -- "make coverage"

- name: Codecov
uses: codecov/codecov-action@v3.1.4
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ on:
jobs:
build_release:
name: Build Release
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "^1.19"
fetch-depth: 0

- name: Install tools
uses: redhat-actions/openshift-tools-installer@v1
with:
source: "github"
kustomize: "latest"
ko: "latest"
- name: Install devbox
run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f

- name: Install devbox deps
run: devbox install

- name: Login to GHCR
uses: docker/login-action@v3
Expand All @@ -46,7 +45,7 @@ jobs:
type=sha

- name: Prepare build
run: make manifests generate
run: devbox run -- make manifests generate

- name: Build container
env:
Expand Down Expand Up @@ -74,7 +73,7 @@ jobs:
NEW_IMG: ghcr.io/${{ github.repository }}/controller:${{ steps.meta.outputs.version }}
run: |
(cd config/manager && kustomize edit set image controller=$NEW_IMG)
make release-manifests
devbox run -- make release-manifests

- name: generate image info
env:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/synopsys-schedule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "^1.19"
- name: Install devbox
run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f

- name: Install devbox deps
run: devbox install

- name: Build Project
run: make build
run: devbox run -- make build

- name: Run Synopsys Detect
uses: synopsys-sig/detect-action@v0.3.4
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/synopsys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "^1.19"
- name: Install devbox
run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f
- name: Install devbox deps
run: devbox install

- name: Build Project
run: make build
run: devbox run -- make build

- name: Run Synopsys Detect
uses: synopsys-sig/detect-action@v0.3.4
Expand Down
18 changes: 5 additions & 13 deletions .github/workflows/trivy-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,13 @@ jobs:

- name: Get repository name
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "^1.19"

- name: Install tools
uses: redhat-actions/openshift-tools-installer@v1
with:
source: "github"
kustomize: "latest"
ko: "latest"
- name: Install devbox
run: curl -fsSL https://get.jetpack.io/devbox | bash -s -- -f
- name: Install devbox deps
run: devbox install

- name: Prepare build
run: make manifests generate
run: devbox run -- make manifests generate

- name: Build container
env:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,5 @@ coverage.xml
clusterctl.yaml
cluster.yaml
*.workload.kubeconfig
/.local/
/.devbox/
Loading
Loading