Skip to content

Commit a883e15

Browse files
authored
[direnv] Fix version path, run example tests on PRs (#832)
## Summary This fixed a bad path (was missing root dir) when writing `.devbox/version` file. I also changed out cli-tests so that it runs example tests in PRs (but we should not require them) ## How was it tested? Untested
1 parent 172452d commit a883e15

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

.github/workflows/cli-tests.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,18 @@ jobs:
7777
test:
7878
strategy:
7979
matrix:
80+
is-main:
81+
- ${{ github.ref == 'refs/heads/main' }}
8082
os: [ubuntu-latest, macos-latest]
83+
# This is an optimization that runs tests twice, with and without
84+
# the examples. We can require non-example tests to complete before
85+
# merging, while keeping the others as an additional non-required signal
86+
run-example-tests: [true, false]
8187
exclude:
82-
# This expression basically says run mac tests if on main branch or
83-
# if this job is triggered by another workflow with "with: run-mac-tests: true"
84-
- os: ${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && 'dummy' || 'macos-latest' }}
88+
- is-main: false
89+
os: macos-latest
90+
- is-main: true
91+
run-example-tests: false
8592
runs-on: ${{ matrix.os }}
8693
timeout-minutes: ${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && 20 || 10 }}
8794
steps:
@@ -108,7 +115,7 @@ jobs:
108115
nix-build-user-count: 4
109116
- name: Run tests
110117
env:
111-
DEVBOX_EXAMPLE_TESTS: "${{ (github.ref == 'refs/heads/main' || inputs.run-example-tests) && 1 || 0 }}"
118+
DEVBOX_EXAMPLE_TESTS: ${{ matrix.run-example-tests }}
112119
run: |
113120
go test ./...
114121

internal/impl/generate.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ func generateForShell(rootPath string, plan *plansdk.ShellPlan, pluginManager *p
6161
}
6262
}
6363

64-
return os.WriteFile(".devbox/version", []byte(build.Version), 0644)
64+
return os.WriteFile(
65+
filepath.Join(rootPath, ".devbox/version"),
66+
[]byte(build.Version),
67+
0644,
68+
)
6569
}
6670

6771
// Cache and buffers for generating templated files.

0 commit comments

Comments
 (0)