Skip to content

[remove nixpkgs] bug fix: update only the user's sysInfo, rather than for all systems #3560

[remove nixpkgs] bug fix: update only the user's sysInfo, rather than for all systems

[remove nixpkgs] bug fix: update only the user's sysInfo, rather than for all systems #3560

Workflow file for this run

name: cli-tests
# Runs the Devbox CLI tests
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- main
merge_group:
branches:
- main
workflow_call:
inputs:
run-mac-tests:
type: boolean
workflow_dispatch:
inputs:
run-example-tests:
type: boolean
run-mac-tests:
type: boolean
# run the example tests with DEVBOX_DEBUG=1
example-debug:
type: boolean
permissions:
contents: read
pull-requests: read
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}"
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_EMOJI: 1
HOMEBREW_NO_ENV_HINTS: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
DEVBOX_DEBUG: 1
jobs:
typos:
name: Spell Check with Typos
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: crate-ci/[email protected]
golangci-lint:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: ./go.mod
- name: golangci-lint
uses: golangci/[email protected]
with:
args: "--out-${NO_FUTURE}format colored-line-number --timeout=10m"
skip-cache: true
test:
strategy:
matrix:
is-main:
- ${{ github.ref == 'refs/heads/main' }}
os: [ubuntu-latest, macos-latest]
# This is an optimization that runs tests twice, with and without
# the examples. We can require non-example tests to complete before
# merging, while keeping the others as an additional non-required signal
run-example-tests: [true, false]
exclude:
- is-main: false
os: "${{ inputs.run-mac-tests && 'dummy' || 'macos-latest' }}"
- is-main: true
run-example-tests: false
- run-example-tests: true
os: macos-latest
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && 37 || 20 }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: ./go.mod
- name: Build devbox
run: go install ./cmd/devbox
- name: Install additional shells (dash, zsh)
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update
sudo apt-get install dash zsh
elif [ "$RUNNER_OS" == "macOS" ]; then
brew update
brew install dash zsh
fi
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
with:
logger: pretty
nix-build-user-count: 4
- name: Run tests
env:
# For example tests, we default to non-debug mode since the debug output is less useful than for unit testscripts.
# But we allow overriding via inputs.example-debug
DEVBOX_DEBUG: ${{ (!matrix.run-example-tests || inputs.example-debug) && '1' || '0' }}
DEVBOX_EXAMPLE_TESTS: ${{ matrix.run-example-tests }}
# Used in `go test -timeout` flag. Needs a value that time.ParseDuration can parse.
DEVBOX_GOLANG_TEST_TIMEOUT: "${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && '35m' || '15m' }}"
run: |
go test -v -timeout $DEVBOX_GOLANG_TEST_TIMEOUT ./...
auto-nix-install: # ensure Devbox installs nix and works properly after installation.
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: ./go.mod
- name: Build devbox
run: go install ./cmd/devbox
- name: Install nix and devbox packages
run: |
export NIX_INSTALLER_NO_CHANNEL_ADD=1
# Setup github authentication to ensure Github's rate limits are not hit.
# If this works, we can consider refactoring this into a reusable github action helper.
mkdir -p ~/.config/nix
echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
devbox run echo "Installing packages..."