Skip to content

Commit

Permalink
build: Try devbox instead of devenv
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson committed Jul 18, 2023
1 parent 1ebe724 commit 243a3a9
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 33 deletions.
8 changes: 5 additions & 3 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
strict_env
# Automatically sets up your devbox environment whenever you cd into this
# directory via our direnv integration:

source_url "https://raw.githubusercontent.com/cachix/devenv/v0.6.2/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="
eval "$(devbox generate direnv --print-envrc)"

use devenv
# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
# for more details
16 changes: 12 additions & 4 deletions .github/workflows/checks-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
# Setup github authentication to ensure Github's rate limits are not hit.
- name: Configure nix GitHub access-tokens
run: |
mkdir -p ~/.config/nix
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
- name: Install devbox
uses: jetpack-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true
env:
NIX_USER_COUNT: 4

- name: Build
run: make SKIP_UPX=false build-snapshot
run: devbox run -- make SKIP_UPX=false build-snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
73 changes: 55 additions & 18 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,21 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
# Setup github authentication to ensure Github's rate limits are not hit.
- name: Configure nix GitHub access-tokens
run: |
mkdir -p ~/.config/nix
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
- name: Install devbox
uses: jetpack-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true
env:
NIX_USER_COUNT: 4

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

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
Expand All @@ -52,18 +60,26 @@ jobs:
with:
fetch-depth: 0

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
# Setup github authentication to ensure Github's rate limits are not hit.
- name: Configure nix GitHub access-tokens
run: |
mkdir -p ~/.config/nix
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
- name: Install devbox
uses: jetpack-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true
env:
NIX_USER_COUNT: 4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Run e2e tests
run: make e2e-test
run: devbox run -- make e2e-test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -81,15 +97,23 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
# Setup github authentication to ensure Github's rate limits are not hit.
- name: Configure nix GitHub access-tokens
run: |
mkdir -p ~/.config/nix
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
- name: Install devbox
uses: jetpack-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true
env:
NIX_USER_COUNT: 4

- name: Export golang and golangci-lint versions
run: |
echo "GOLANGCI_LINT_VERSION=v$(golangci-lint version --format short)" >>$GITHUB_ENV
echo "GO_VERSION=$(go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>$GITHUB_ENV
echo "GOLANGCI_LINT_VERSION=v$(devbox run -- golangci-lint version --format short)" >>$GITHUB_ENV
echo "GO_VERSION=$(devbox run -- go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>$GITHUB_ENV
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
Expand All @@ -105,13 +129,26 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
# Setup github authentication to ensure Github's rate limits are not hit.
- name: Configure nix GitHub access-tokens
run: |
mkdir -p ~/.config/nix
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
- name: Install devbox
uses: jetpack-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true
env:
NIX_USER_COUNT: 4

- uses: pre-commit/[email protected]
- name: Set up pre-commit cache
uses: actions/cache@v3
with:
extra_args: --all-files --show-diff-on-failure
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit
run: devbox run -- make pre-commit
env:
SKIP: no-commit-to-branch,golangci-lint
16 changes: 12 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,21 @@ jobs:
with:
languages: ${{ matrix.language }}

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
# Setup github authentication to ensure Github's rate limits are not hit.
- name: Configure nix GitHub access-tokens
run: |
mkdir -p ~/.config/nix
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
- name: Install devbox
uses: jetpack-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true
env:
NIX_USER_COUNT: 4

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

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
16 changes: 12 additions & 4 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@ jobs:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
# Setup github authentication to ensure Github's rate limits are not hit.
- name: Configure nix GitHub access-tokens
run: |
mkdir -p ~/.config/nix
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
- name: Install devbox
uses: jetpack-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true
env:
NIX_USER_COUNT: 4

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
Expand All @@ -35,6 +43,6 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Release
run: make release
run: devbox run -- make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"packages": [
"go@latest",
"bash@latest",
"coreutils@latest",
"crane@latest",
"findutils@latest",
"ginkgo@latest",
"git@latest",
"gnused@latest",
"gnugrep@latest",
"gnumake@latest",
"gojq@latest",
"golangci-lint@latest",
"golines@latest",
"goreleaser@latest",
"gotestsum@latest",
"kubernetes-helm@latest",
"pre-commit@latest",
"shfmt@latest",
"upx@latest"
],
"shell": {
"init_hook": [
"echo 'Welcome to devbox!' > /dev/null"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
119 changes: 119 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"lockfile_version": "1",
"packages": {
"bash@latest": {
"last_modified": "2023-05-07T06:59:10Z",
"resolved": "github:NixOS/nixpkgs/eb751d65225ec53de9cf3d88acbf08d275882389#bash",
"source": "devbox-search",
"version": "5.2-p15"
},
"coreutils@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#coreutils",
"source": "devbox-search",
"version": "9.3"
},
"crane@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#crane",
"source": "devbox-search",
"version": "0.15.2"
},
"findutils@latest": {
"last_modified": "2023-05-07T06:59:10Z",
"resolved": "github:NixOS/nixpkgs/eb751d65225ec53de9cf3d88acbf08d275882389#findutils",
"source": "devbox-search",
"version": "4.9.0"
},
"ginkgo@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#ginkgo",
"source": "devbox-search",
"version": "2.11.0"
},
"git@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#git",
"source": "devbox-search",
"version": "2.41.0"
},
"gnugrep@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#gnugrep",
"source": "devbox-search",
"version": "3.11"
},
"gnumake@latest": {
"last_modified": "2023-05-07T06:59:10Z",
"resolved": "github:NixOS/nixpkgs/eb751d65225ec53de9cf3d88acbf08d275882389#gnumake",
"source": "devbox-search",
"version": "4.4.1"
},
"gnused@latest": {
"last_modified": "2023-05-07T06:59:10Z",
"resolved": "github:NixOS/nixpkgs/eb751d65225ec53de9cf3d88acbf08d275882389#gnused",
"source": "devbox-search",
"version": "4.9"
},
"go@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#go",
"source": "devbox-search",
"version": "1.20.5"
},
"gojq@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#gojq",
"source": "devbox-search",
"version": "0.12.13"
},
"golangci-lint@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#golangci-lint",
"source": "devbox-search",
"version": "1.53.3"
},
"golines@latest": {
"last_modified": "2023-05-07T06:59:10Z",
"resolved": "github:NixOS/nixpkgs/eb751d65225ec53de9cf3d88acbf08d275882389#golines",
"source": "devbox-search",
"version": "0.11.0"
},
"goreleaser@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#goreleaser",
"source": "devbox-search",
"version": "1.18.2"
},
"gotestsum@latest": {
"last_modified": "2023-05-07T06:59:10Z",
"resolved": "github:NixOS/nixpkgs/eb751d65225ec53de9cf3d88acbf08d275882389#gotestsum",
"source": "devbox-search",
"version": "1.10.0"
},
"kubernetes-helm@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#kubernetes-helm",
"source": "devbox-search",
"version": "3.12.1"
},
"pre-commit@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#pre-commit",
"source": "devbox-search",
"version": "3.3.3"
},
"shfmt@latest": {
"last_modified": "2023-06-29T16:20:38Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#shfmt",
"source": "devbox-search",
"version": "3.7.0"
},
"upx@latest": {
"last_modified": "2023-05-07T06:59:10Z",
"resolved": "github:NixOS/nixpkgs/eb751d65225ec53de9cf3d88acbf08d275882389#upx",
"source": "devbox-search",
"version": "4.0.2"
}
}
}

0 comments on commit 243a3a9

Please sign in to comment.