Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: use names for all GitHub actions steps and use sqlc setup action #8495

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 7 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion .github/actions/setup-go/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ runs:
restore-keys: |
gotoolchain-${{ runner.os }}-

- uses: buildjet/setup-go@v4
- name: Setup Go
uses: buildjet/setup-go@v4
with:
# We do our own caching for implementation clarity.
cache: false
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/setup-node/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ description: |
runs:
using: "composite"
steps:
- uses: buildjet/setup-node@v3
- name: Setup Node
uses: buildjet/setup-node@v3
with:
node-version: 16.20.1
# See https://github.com/actions/setup-node#caching-global-packages-data
Expand Down
122 changes: 83 additions & 39 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ jobs:
k8s: ${{ steps.filter.outputs.k8s }}
ci: ${{ steps.filter.outputs.ci }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
- name: check changed files
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
Expand Down Expand Up @@ -101,9 +103,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- uses: ./.github/actions/setup-go
- name: Setup Node
uses: ./.github/actions/setup-node

- uses: ./.github/actions/setup-node
- name: Setup Go
uses: ./.github/actions/setup-go

- name: Get golangci-lint cache dir
run: |
Expand Down Expand Up @@ -149,14 +153,19 @@ jobs:
needs: changes
if: needs.changes.outputs.docs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- uses: ./.github/actions/setup-node
- uses: ./.github/actions/setup-go
- name: Setup Node
uses: ./.github/actions/setup-node

- name: Install sqlc
run: |
curl -sSL https://github.com/kyleconroy/sqlc/releases/download/v1.18.0/sqlc_1.18.0_linux_amd64.tar.gz | sudo tar -C /usr/bin -xz sqlc
- name: Setup Go
uses: ./.github/actions/setup-go

- name: Setup sqlc
uses: sqlc-dev/setup-sqlc@v3
with:
sqlc-version: "1.18.0"

- name: go install tools
run: |
Expand Down Expand Up @@ -192,9 +201,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- uses: ./.github/actions/setup-node
- name: Setup Node
uses: ./.github/actions/setup-node

- uses: buildjet/setup-go@v4
- name: Setup Go
uses: buildjet/setup-go@v4
with:
# This doesn't need caching. It's super fast anyways!
cache: false
Expand Down Expand Up @@ -235,10 +246,14 @@ jobs:
- macos-latest
- windows-2019
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- uses: ./.github/actions/setup-go
- uses: ./.github/actions/setup-tf
- name: Setup Go
uses: ./.github/actions/setup-go

- name: Setup Terraform
uses: ./.github/actions/setup-tf

- name: Test with Mock Database
id: test
Expand Down Expand Up @@ -269,12 +284,14 @@ jobs:
# so we need to print the test stats to the log.
go run ./scripts/ci-report/main.go gotests.json | tee gotests_stats.json

- uses: ./.github/actions/upload-datadog
- name: Upload test stats to Datadog
uses: ./.github/actions/upload-datadog
if: success() || failure()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}

- uses: codecov/codecov-action@v3
- name: Check code coverage
uses: codecov/codecov-action@v3
# This action has a tendency to error out unexpectedly, it has
# the `fail_ci_if_error` option that defaults to `false`, but
# that is no guarantee, see:
Expand All @@ -296,10 +313,14 @@ jobs:
# even if some of the preceding steps are slow.
timeout-minutes: 25
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Setup Go
uses: ./.github/actions/setup-go

- uses: ./.github/actions/setup-go
- uses: ./.github/actions/setup-tf
- name: Setup Terraform
uses: ./.github/actions/setup-tf

- name: Test with PostgreSQL Database
run: |
Expand All @@ -313,12 +334,14 @@ jobs:
# so we need to print the test stats to the log.
go run ./scripts/ci-report/main.go gotests.json | tee gotests_stats.json

- uses: ./.github/actions/upload-datadog
- name: Upload test stats to Datadog
uses: ./.github/actions/upload-datadog
if: success() || failure()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}

- uses: codecov/codecov-action@v3
- name: Check code coverage
uses: codecov/codecov-action@v3
# This action has a tendency to error out unexpectedly, it has
# the `fail_ci_if_error` option that defaults to `false`, but
# that is no guarantee, see:
Expand All @@ -336,16 +359,21 @@ jobs:
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
timeout-minutes: 25
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Setup Go
uses: ./.github/actions/setup-go

- uses: ./.github/actions/setup-go
- uses: ./.github/actions/setup-tf
- name: Setup Terraform
uses: ./.github/actions/setup-tf

- name: Run Tests
run: |
gotestsum --junitfile="gotests.xml" -- -race ./...

- uses: ./.github/actions/upload-datadog
- name: Upload test stats to Datadog
uses: ./.github/actions/upload-datadog
if: always()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
Expand All @@ -362,7 +390,8 @@ jobs:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -375,8 +404,11 @@ jobs:
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v1

- uses: ./.github/actions/setup-go
- uses: ./.github/actions/setup-node
- name: Setup Node
uses: ./.github/actions/setup-node

- name: Setup Go
uses: ./.github/actions/setup-go

- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
Expand Down Expand Up @@ -430,7 +462,8 @@ jobs:
echo "::endgroup::"
done

- uses: actions/upload-artifact@v3
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: coder
path: |
Expand All @@ -445,14 +478,17 @@ jobs:
if: needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- uses: ./.github/actions/setup-node
- name: Setup Node
uses: ./.github/actions/setup-node

- run: yarn test:ci --max-workers $(nproc)
working-directory: site

- uses: codecov/codecov-action@v3
- name: Check code coverage
uses: codecov/codecov-action@v3
# This action has a tendency to error out unexpectedly, it has
# the `fail_ci_if_error` option that defaults to `false`, but
# that is no guarantee, see:
Expand All @@ -470,11 +506,17 @@ jobs:
if: needs.changes.outputs.go == 'true' || needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: ./.github/actions/setup-node

- uses: ./.github/actions/setup-node
- uses: ./.github/actions/setup-go
- uses: ./.github/actions/setup-tf
- name: Setup Go
uses: ./.github/actions/setup-go

- name: Setup Terraform
uses: ./.github/actions/setup-tf

- name: Build
run: |
Expand Down Expand Up @@ -503,13 +545,15 @@ jobs:
needs: changes
if: needs.changes.outputs.ts == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3
with:
# Required by Chromatic for build-over-build history, otherwise we
# only get 1 commit on shallow checkout.
fetch-depth: 0

- uses: ./.github/actions/setup-node
- name: Setup Node
uses: ./.github/actions/setup-node

# This step is not meant for mainline because any detected changes to
# storybook snapshots will require manual approval/review in order for
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/contrib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v3
- name: auto-approve dependabot
uses: hmarr/auto-approve-action@v3
if: github.actor == 'dependabot[bot]'

cla:
Expand All @@ -52,7 +53,8 @@ jobs:
# Skip tagging for draft PRs.
if: ${{ github.event_name == 'pull_request_target' && success() && !github.event.pull_request.draft }}
steps:
- uses: actions/github-script@v6
- name: release-labels
uses: actions/github-script@v6
with:
# This script ensures PR title and labels are in sync:
#
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docker-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'coder'
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Docker login
uses: docker/login-action@v2
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/nightly-gauntlet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ jobs:
# so 0.016 * 240 = 3.84 USD per run.
timeout-minutes: 240
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- uses: ./.github/actions/setup-go
- uses: ./.github/actions/setup-tf
- name: Setup Go
uses: ./.github/actions/setup-go

- name: Setup Terraform
uses: ./.github/actions/setup-tf

- name: Run Tests
run: |
Expand All @@ -28,7 +32,8 @@ jobs:
# impact.
gotestsum --junitfile="gotests.xml" -- -timeout=240m -count=10 -race ./...

- uses: ./.github/actions/upload-datadog
- name: Upload test results to DataDog
uses: ./.github/actions/upload-datadog
if: always()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
Expand All @@ -38,14 +43,18 @@ jobs:
runs-on: "buildjet-2vcpu-ubuntu-2204"
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Setup Go
uses: ./.github/actions/setup-go

- uses: ./.github/actions/setup-go
- name: Run Tests
run: |
gotestsum --junitfile="gotests.xml" -- --tags="timing" -p=1 -run='_Timing/' ./...

- uses: ./.github/actions/upload-datadog
- name: Upload test results to DataDog
uses: ./.github/actions/upload-datadog
if: always()
with:
api-key: ${{ secrets.DATADOG_API_KEY }}
3 changes: 2 additions & 1 deletion .github/workflows/pr-auto-assign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/[email protected]
- name: Assign author
uses: toshimaru/[email protected]
Loading