Skip to content

ci: optimize jobs with path filtering #3074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jul 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add needs
  • Loading branch information
ammario committed Jul 23, 2022
commit e9d7fa2b6de05a1aa2e01f2673a4662db6b3236c
36 changes: 25 additions & 11 deletions .github/workflows/coder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
changes:
runs-on: ubuntu-latest
outputs:
docs-only: ${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }}
docs-only: ${{ env.DOCS_ONLY }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
Expand All @@ -44,11 +44,15 @@ jobs:
- '**'
docs:
- 'docs/**'
- '.github/**'
- id: log
run: |
echo "${{ toJSON(steps.filter) }}"
echo "DOCS_ONLY=${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }} >> $GITHUB_ENV"
style-lint-golangci:
name: style/lint/golangci
timeout-minutes: 5
if: ${{ !needs.changes.outputs.docs_only }}
needs: changes
if: needs.changes.outputs.docs_only == 'false'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -64,7 +68,8 @@ jobs:
name: style/lint/shellcheck
timeout-minutes: 5
runs-on: ubuntu-latest
if: ${{ !needs.changes.outputs.docs_only }}
needs: changes
if: needs.changes.outputs.docs_only == 'false'
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
Expand All @@ -77,7 +82,8 @@ jobs:
style-lint-typescript:
name: "style/lint/typescript"
timeout-minutes: 5
if: ${{ !needs.changes.outputs.docs_only }}
needs: changes
if: needs.changes.outputs.docs_only == 'false'
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -105,7 +111,8 @@ jobs:
name: "style/gen"
timeout-minutes: 5
runs-on: ubuntu-latest
if: ${{ !needs.changes.outputs.docs_only }}
needs: changes
if: needs.changes.outputs.docs_only == 'false'
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -141,7 +148,8 @@ jobs:

style-fmt:
name: "style/fmt"
if: ${{ !needs.changes.outputs.docs_only }}
needs: changes
if: needs.changes.outputs.docs_only == 'false'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand Down Expand Up @@ -174,7 +182,8 @@ jobs:

test-go:
name: "test/go"
if: ${{ !needs.changes.outputs.docs_only }}
needs: changes
if: needs.changes.outputs.docs_only == 'false'
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
Expand Down Expand Up @@ -251,7 +260,8 @@ jobs:

test-go-postgres:
name: "test/go/postgres"
if: ${{ !needs.changes.outputs.docs_only }}
needs: changes
if: needs.changes.outputs.docs_only == 'false'
runs-on: ubuntu-latest
# This timeout must be greater than the timeout set by `go test` in
# `make test-postgres` to ensure we receive a trace of running
Expand Down Expand Up @@ -323,9 +333,10 @@ jobs:
name: "deploy"
runs-on: ubuntu-latest
timeout-minutes: 30
needs: changes
if: |
github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
&& !needs.changes.outputs.docs_only
&& needs.changes.outputs.docs_only == 'false'
permissions:
contents: read
id-token: write
Expand Down Expand Up @@ -431,7 +442,8 @@ jobs:

test-js:
name: "test/js"
if: ${{ !needs.changes.outputs.docs_only }}
needs: changes
if: needs.changes.outputs.docs_only == 'false'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
Expand Down Expand Up @@ -485,6 +497,8 @@ jobs:

test-e2e:
name: "test/e2e/${{ matrix.os }}"
needs: changes
if: needs.changes.outputs.docs_only == 'false'
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
Expand Down
6 changes: 6 additions & 0 deletions cli/ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func TestSSH(t *testing.T) {

// Shells on Mac, Windows, and Linux all exit shells with the "exit" command.
pty.WriteLine("exit")
// Read output to prevent hang on macOS, see:
// https://github.com/coder/coder/issues/2122
pty.ExpectMatch("exit")
<-cmdDone
})
t.Run("Stdio", func(t *testing.T) {
Expand Down Expand Up @@ -224,6 +227,9 @@ func TestSSH(t *testing.T) {

// And we're done.
pty.WriteLine("exit")
// Read output to prevent hang on macOS, see:
// https://github.com/coder/coder/issues/2122
pty.ExpectMatch("exit")
<-cmdDone
})
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ require (
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/afero v1.9.0
github.com/spf13/afero v1.9.2
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1699,8 +1699,8 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4=
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
github.com/spf13/afero v1.9.0 h1:sFSLUHgxdnN32Qy38hK3QkYBFXZj9DKjVjCUCtD7juY=
github.com/spf13/afero v1.9.0/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw=
github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dayjs.extend(timezone)

export const Language = {
errorNoDayOfWeek: "Must set at least one day of week if start time is set",
errorNoTime: "Start time is required",
errorNoTime: "Start time is required when days of the week are selected",
errorTime: "Time must be in HH:mm format (24 hours)",
errorTimezone: "Invalid timezone",
daysOfWeekLabel: "Days of Week",
Expand Down