Skip to content

Commit 2dd3d02

Browse files
authored
[lagobot] properly extend timeout for macos tests (#831)
1 parent 6127e63 commit 2dd3d02

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

.github/workflows/cli-tests.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ on:
2121
inputs:
2222
run-example-tests:
2323
type: boolean
24+
run-mac-tests:
25+
type: boolean
2426

2527
permissions:
2628
contents: read
@@ -49,7 +51,7 @@ jobs:
4951
matrix:
5052
os: [ubuntu-latest, macos-latest]
5153
runs-on: ${{ matrix.os }}
52-
timeout-minutes: 15
54+
timeout-minutes: 10
5355
steps:
5456
- uses: actions/checkout@v3
5557
- uses: actions/[email protected]
@@ -86,11 +88,11 @@ jobs:
8688
run-example-tests: [true, false]
8789
exclude:
8890
- is-main: false
89-
os: macos-latest
91+
os: "${{ inputs.run-mac-tests && 'dummy' || 'macos-latest' }}"
9092
- is-main: true
9193
run-example-tests: false
9294
runs-on: ${{ matrix.os }}
93-
timeout-minutes: ${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && 20 || 10 }}
95+
timeout-minutes: ${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && 25 || 10 }}
9496
steps:
9597
- uses: actions/checkout@v3
9698
- uses: actions/[email protected]
@@ -116,8 +118,10 @@ jobs:
116118
- name: Run tests
117119
env:
118120
DEVBOX_EXAMPLE_TESTS: ${{ matrix.run-example-tests }}
121+
# Used in `go test -timeout` flag. Needs a value that time.ParseDuration can parse.
122+
DEVBOX_GOLANG_TEST_TIMEOUT: "${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && '25m' || '10m' }}"
119123
run: |
120-
go test ./...
124+
go test -timeout $DEVBOX_GOLANG_TEST_TIMEOUT ./...
121125
122126
auto-nix-install: # ensure Devbox installs nix and works properly after installation.
123127
strategy:

devbox.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"packages": [
33
"go_1_19",
4-
"golangci-lint"
4+
"golangci-lint",
5+
"actionlint"
56
],
67
"env": {
78
"PATH": "$PATH:$PWD/dist"

testscripts/testrunner/examplesrunner.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"os"
77
"os/exec"
88
"path/filepath"
9+
"runtime"
10+
"strconv"
911
"strings"
1012
"testing"
1113

@@ -41,22 +43,25 @@ func RunExamplesTestscripts(t *testing.T, examplesDir string) {
4143
return nil
4244
}
4345

44-
// TODO savil. Resolve these.
45-
skipList := []string{
46+
if strings.Contains(path, "pipenv") {
47+
// pipenv takes 1100 seconds on CICD
4648

47-
// pipenv: is enabled since it passes but it is slow, and we should examine why.
48-
49-
// drupal:
50-
// https://gist.github.com/savil/9c67ffa50a2c51d118f3a4ce29ab920d
51-
"drupal",
52-
}
53-
for _, toSkip := range skipList {
54-
if strings.Contains(path, toSkip) {
55-
t.Logf("skipping due to skipList (%s), config at: %s\n", toSkip, path)
49+
// CI env var is always true in Github Actions
50+
// https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
51+
ciEnv, err := strconv.ParseBool(os.Getenv("CI"))
52+
isInCI := ciEnv && err == nil
53+
if isInCI && runtime.GOOS == "darwin" {
54+
t.Logf("skipping pipenv on darwin in CI. config at: %s\n", path)
5655
return nil
5756
}
5857
}
5958

59+
if strings.Contains(path, "drupal") {
60+
// drupal has errors like: https://gist.github.com/savil/9c67ffa50a2c51d118f3a4ce29ab920d
61+
t.Logf("skipping drupal, config at: %s\n", path)
62+
return nil
63+
}
64+
6065
t.Logf("running testscript for example: %s\n", path)
6166
runSingleExampleTestscript(t, examplesDir, path)
6267
return nil

0 commit comments

Comments
 (0)