diff --git a/.envrc b/.envrc index c1a8e7f1..84fc8e53 100644 --- a/.envrc +++ b/.envrc @@ -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 diff --git a/.github/workflows/checks-macos.yml b/.github/workflows/checks-macos.yml index 59d8355d..27f59242 100644 --- a/.github/workflows/checks-macos.yml +++ b/.github/workflows/checks-macos.yml @@ -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/devbox-install-action@v0.4.0 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 }} diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d013e400..74d93ad5 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -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/devbox-install-action@v0.4.0 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 @@ -52,10 +60,18 @@ 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/devbox-install-action@v0.4.0 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + enable-cache: true + env: + NIX_USER_COUNT: 4 - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -63,7 +79,7 @@ jobs: platforms: arm64 - name: Run e2e tests - run: make e2e-test + run: devbox run -- make e2e-test env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -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/devbox-install-action@v0.4.0 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 @@ -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/devbox-install-action@v0.4.0 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + enable-cache: true + env: + NIX_USER_COUNT: 4 - - uses: pre-commit/action@v3.0.0 + - 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 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a4a4a376..0c2c111e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -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/devbox-install-action@v0.4.0 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 diff --git a/.github/workflows/release-tag.yaml b/.github/workflows/release-tag.yaml index 9effb287..e0580047 100644 --- a/.github/workflows/release-tag.yaml +++ b/.github/workflows/release-tag.yaml @@ -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/devbox-install-action@v0.4.0 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 @@ -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 }} diff --git a/devbox.json b/devbox.json new file mode 100644 index 00000000..e282c438 --- /dev/null +++ b/devbox.json @@ -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" + ] + } + } +} diff --git a/devbox.lock b/devbox.lock new file mode 100644 index 00000000..9c500257 --- /dev/null +++ b/devbox.lock @@ -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" + } + } +}