Skip to content

Commit

Permalink
build: Migrate to devbox for tooling configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson authored and faiq committed Jan 26, 2024
1 parent c075eb4 commit 0f2dd4a
Show file tree
Hide file tree
Showing 23 changed files with 622 additions and 479 deletions.
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: 26 additions & 7 deletions .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,33 @@ 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
Expand All @@ -36,10 +48,17 @@ jobs:
run: make lint-yaml

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

# go cov 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

- run: ls /home/runner/go/src/github.com/nutanix-cloud-native/cluster-api-provider-nutanix/

- 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

0 comments on commit 0f2dd4a

Please sign in to comment.