mirror of
https://github.com/coder/coder.git
synced 2026-06-03 21:18:24 +00:00
b077f71015
This was breaking the release process. Namely it was running the `gen` targets due to the dependency tree, which was failing on macOS and Linux runners. This revert can be reverted once we fix that up.
733 lines
22 KiB
YAML
733 lines
22 KiB
YAML
name: coder
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "*"
|
|
|
|
pull_request:
|
|
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
actions: none
|
|
checks: none
|
|
contents: read
|
|
deployments: none
|
|
issues: none
|
|
packages: none
|
|
pull-requests: none
|
|
repository-projects: none
|
|
security-events: none
|
|
statuses: none
|
|
|
|
# Cancel in-progress runs for pull requests when developers push
|
|
# additional changes
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
typos:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: typos-action
|
|
uses: crate-ci/typos@master
|
|
with:
|
|
config: .github/workflows/typos.toml
|
|
- name: Fix Helper
|
|
if: ${{ failure() }}
|
|
run: |
|
|
echo "::notice:: you can automatically fix typos from your CLI:
|
|
cargo install typos-cli
|
|
typos -c .github/workflows/typos.toml -w"
|
|
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
docs-only: ${{ steps.filter.outputs.docs_count == steps.filter.outputs.all_count }}
|
|
sh: ${{ steps.filter.outputs.sh }}
|
|
ts: ${{ steps.filter.outputs.ts }}
|
|
k8s: ${{ steps.filter.outputs.k8s }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
# For pull requests it's not necessary to checkout the code
|
|
- uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
all:
|
|
- '**'
|
|
docs:
|
|
- 'docs/**'
|
|
# For testing:
|
|
# - '.github/**'
|
|
sh:
|
|
- "**.sh"
|
|
ts:
|
|
- 'site/**'
|
|
k8s:
|
|
- 'helm/**'
|
|
- Dockerfile
|
|
- scripts/helm.sh
|
|
- id: debug
|
|
run: |
|
|
echo "${{ toJSON(steps.filter )}}"
|
|
|
|
# Debug step
|
|
debug-inputs:
|
|
needs:
|
|
- changes
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- id: log
|
|
run: |
|
|
echo "${{ toJSON(needs) }}"
|
|
|
|
style-lint-golangci:
|
|
name: style/lint/golangci
|
|
timeout-minutes: 5
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: "~1.19"
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v3.2.0
|
|
with:
|
|
version: v1.48.0
|
|
|
|
check-enterprise-imports:
|
|
name: check/enterprise-imports
|
|
timeout-minutes: 5
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Check imports of enterprise code
|
|
run: ./scripts/check_enterprise_imports.sh
|
|
|
|
style-lint-shellcheck:
|
|
name: style/lint/shellcheck
|
|
timeout-minutes: 5
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Run ShellCheck
|
|
uses: ludeeus/action-shellcheck@1.1.0
|
|
env:
|
|
SHELLCHECK_OPTS: --external-sources
|
|
with:
|
|
ignore: node_modules
|
|
|
|
style-lint-typescript:
|
|
name: "style/lint/typescript"
|
|
timeout-minutes: 5
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Cache Node
|
|
id: cache-node
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
**/node_modules
|
|
.eslintcache
|
|
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
js-${{ runner.os }}-
|
|
|
|
- name: Install node_modules
|
|
run: ./scripts/yarn_install.sh
|
|
|
|
- name: "yarn lint"
|
|
run: yarn lint
|
|
working-directory: site
|
|
|
|
style-lint-k8s:
|
|
name: "style/lint/k8s"
|
|
timeout-minutes: 5
|
|
needs: changes
|
|
if: needs.changes.outputs.k8s == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install helm
|
|
uses: azure/setup-helm@v3
|
|
with:
|
|
version: v3.9.2
|
|
|
|
- name: cd helm && make lint
|
|
run: |
|
|
cd helm
|
|
make lint
|
|
|
|
gen:
|
|
name: "style/gen"
|
|
timeout-minutes: 8
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: needs.changes.outputs.docs-only == 'false'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Cache Node
|
|
id: cache-node
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
**/node_modules
|
|
.eslintcache
|
|
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
js-${{ runner.os }}-
|
|
|
|
- name: Install node_modules
|
|
run: ./scripts/yarn_install.sh
|
|
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: "~1.19"
|
|
|
|
- name: Echo Go Cache Paths
|
|
id: go-cache-paths
|
|
run: |
|
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
|
|
|
- name: Go Build Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
|
key: ${{ github.job }}-go-build-${{ hashFiles('**/go.sum', '**/**.go') }}
|
|
|
|
- name: Go Mod Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
|
key: ${{ github.job }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Install sqlc
|
|
run: |
|
|
curl -sSL https://github.com/kyleconroy/sqlc/releases/download/v1.13.0/sqlc_1.13.0_linux_amd64.tar.gz | sudo tar -C /usr/bin -xz sqlc
|
|
- name: Install protoc-gen-go
|
|
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
|
|
- name: Install protoc-gen-go-drpc
|
|
run: go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.26
|
|
- name: Install goimports
|
|
run: go install golang.org/x/tools/cmd/goimports@latest
|
|
|
|
- name: Install Protoc
|
|
run: |
|
|
# protoc must be in lockstep with our dogfood Dockerfile
|
|
# or the version in the comments will differ.
|
|
set -x
|
|
cd dogfood
|
|
DOCKER_BUILDKIT=1 docker build . --target proto -t protoc
|
|
protoc_path=/usr/local/bin/protoc
|
|
docker run --rm --entrypoint cat protoc /tmp/bin/protoc > $protoc_path
|
|
chmod +x $protoc_path
|
|
protoc --version
|
|
|
|
- name: make gen
|
|
run: "make --output-sync -j -B gen"
|
|
|
|
- name: Check for unstaged files
|
|
run: ./scripts/check_unstaged.sh
|
|
|
|
style-fmt:
|
|
name: "style/fmt"
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: true
|
|
|
|
- name: Cache Node
|
|
id: cache-node
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
**/node_modules
|
|
.eslintcache
|
|
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
js-${{ runner.os }}-
|
|
|
|
- name: Install node_modules
|
|
run: ./scripts/yarn_install.sh
|
|
|
|
- name: Install shfmt
|
|
run: go install mvdan.cc/sh/v3/cmd/shfmt@v3.5.0
|
|
|
|
- name: make fmt
|
|
run: |
|
|
export PATH=${PATH}:$(go env GOPATH)/bin
|
|
make --output-sync -j -B fmt
|
|
|
|
test-go:
|
|
name: "test/go"
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 20
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
- macos-latest
|
|
- windows-2022
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: "~1.19"
|
|
|
|
- name: Echo Go Cache Paths
|
|
id: go-cache-paths
|
|
run: |
|
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
|
|
|
- name: Go Build Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.**', '**.go') }}
|
|
|
|
- name: Go Mod Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Install gotestsum
|
|
uses: jaxxstorm/action-install-gh-release@v1.7.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
repo: gotestyourself/gotestsum
|
|
tag: v1.7.0
|
|
|
|
- uses: hashicorp/setup-terraform@v2
|
|
with:
|
|
terraform_version: 1.1.9
|
|
terraform_wrapper: false
|
|
|
|
- name: Test with Mock Database
|
|
id: test
|
|
shell: bash
|
|
run: |
|
|
# Code coverage is more computationally expensive and also
|
|
# prevents test caching, so we disable it on alternate operating
|
|
# systems.
|
|
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
|
|
echo ::set-output name=cover::true
|
|
export COVERAGE_FLAGS='-covermode=atomic -coverprofile="gotests.coverage" -coverpkg=./...'
|
|
else
|
|
echo ::set-output name=cover::false
|
|
fi
|
|
set -x
|
|
test_timeout=5m
|
|
if [[ "${{ matrix.os }}" == windows* ]]; then
|
|
test_timeout=10m
|
|
fi
|
|
gotestsum --junitfile="gotests.xml" --packages="./..." -- -parallel=8 -timeout=$test_timeout -short -failfast $COVERAGE_FLAGS
|
|
|
|
- name: Upload DataDog Trace
|
|
if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
|
|
env:
|
|
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
|
DD_DATABASE: fake
|
|
DD_CATEGORY: unit
|
|
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
run: go run scripts/datadog-cireport/main.go gotests.xml
|
|
|
|
- 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:
|
|
# https://github.com/codecov/codecov-action/issues/788
|
|
continue-on-error: true
|
|
if: steps.test.outputs.cover && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./gotests.coverage
|
|
flags: unittest-go-${{ matrix.os }}
|
|
|
|
test-go-postgres:
|
|
name: "test/go/postgres"
|
|
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
|
|
# goroutines. Setting this to the timeout +5m should work quite well
|
|
# even if some of the preceding steps are slow.
|
|
timeout-minutes: 25
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: "~1.19"
|
|
|
|
- name: Echo Go Cache Paths
|
|
id: go-cache-paths
|
|
run: |
|
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
|
|
|
- name: Go Build Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum', '**/**.go') }}
|
|
|
|
- name: Go Mod Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Install gotestsum
|
|
uses: jaxxstorm/action-install-gh-release@v1.7.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
repo: gotestyourself/gotestsum
|
|
tag: v1.7.0
|
|
|
|
- uses: hashicorp/setup-terraform@v2
|
|
with:
|
|
terraform_version: 1.1.9
|
|
terraform_wrapper: false
|
|
|
|
- name: Test with PostgreSQL Database
|
|
run: make test-postgres
|
|
|
|
- name: Upload DataDog Trace
|
|
if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
|
|
env:
|
|
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
|
DD_DATABASE: postgresql
|
|
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
run: go run scripts/datadog-cireport/main.go gotests.xml
|
|
|
|
- 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:
|
|
# https://github.com/codecov/codecov-action/issues/788
|
|
continue-on-error: true
|
|
if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./gotests.coverage
|
|
flags: unittest-go-postgres-${{ matrix.os }}
|
|
|
|
deploy:
|
|
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 == 'false'
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Authenticate to Google Cloud
|
|
uses: google-github-actions/auth@v0
|
|
with:
|
|
workload_identity_provider: projects/573722524737/locations/global/workloadIdentityPools/github/providers/github
|
|
service_account: coder-ci@coder-dogfood.iam.gserviceaccount.com
|
|
|
|
- name: Set up Google Cloud SDK
|
|
uses: google-github-actions/setup-gcloud@v0
|
|
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: "~1.19"
|
|
|
|
- name: Echo Go Cache Paths
|
|
id: go-cache-paths
|
|
run: |
|
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
|
|
|
- name: Go Build Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
|
key: ${{ runner.os }}-release-go-build-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Go Mod Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
|
key: ${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Cache Node
|
|
id: cache-node
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
**/node_modules
|
|
.eslintcache
|
|
key: js-${{ runner.os }}-release-node-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
js-${{ runner.os }}-
|
|
|
|
- name: Install goimports
|
|
run: go install golang.org/x/tools/cmd/goimports@latest
|
|
- name: Install nfpm
|
|
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.16.0
|
|
|
|
- name: Install zstd
|
|
run: sudo apt-get install -y zstd
|
|
|
|
- name: Build site
|
|
run: make -B site/out/index.html
|
|
|
|
- name: Build Release
|
|
run: |
|
|
set -euo pipefail
|
|
go mod download
|
|
|
|
mkdir -p ./dist
|
|
# build slim binaries
|
|
./scripts/build_go_slim.sh \
|
|
--output ./dist/ \
|
|
--compress 22 \
|
|
linux:amd64,armv7,arm64 \
|
|
windows:amd64,arm64 \
|
|
darwin:amd64,arm64
|
|
|
|
# build linux amd64 packages
|
|
./scripts/build_go_matrix.sh \
|
|
--output ./dist/ \
|
|
--package-linux \
|
|
linux:amd64 \
|
|
windows:amd64
|
|
|
|
- name: Install Release
|
|
run: |
|
|
gcloud config set project coder-dogfood
|
|
gcloud config set compute/zone us-central1-a
|
|
gcloud compute scp ./dist/coder_*_linux_amd64.deb coder:/tmp/coder.deb
|
|
gcloud compute ssh coder -- sudo dpkg -i --force-confdef /tmp/coder.deb
|
|
gcloud compute ssh coder -- sudo systemctl daemon-reload
|
|
|
|
- name: Start
|
|
run: gcloud compute ssh coder -- sudo service coder restart
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: coder
|
|
path: |
|
|
./dist/*.zip
|
|
./dist/*.exe
|
|
./dist/*.tar.gz
|
|
./dist/*.apk
|
|
./dist/*.deb
|
|
./dist/*.rpm
|
|
retention-days: 7
|
|
|
|
test-js:
|
|
name: "test/js"
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Cache Node
|
|
id: cache-node
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
**/node_modules
|
|
.eslintcache
|
|
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
js-${{ runner.os }}-
|
|
|
|
# Go is required for uploading the test results to datadog
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: "~1.19"
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "14"
|
|
|
|
- name: Install node_modules
|
|
run: ./scripts/yarn_install.sh
|
|
|
|
- run: yarn test:coverage
|
|
working-directory: site
|
|
|
|
- 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:
|
|
# https://github.com/codecov/codecov-action/issues/788
|
|
continue-on-error: true
|
|
if: github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./site/coverage/lcov.info
|
|
flags: unittest-js
|
|
|
|
- name: Upload DataDog Trace
|
|
if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork
|
|
env:
|
|
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
|
DD_CATEGORY: unit
|
|
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
run: go run scripts/datadog-cireport/main.go site/test-results/junit.xml
|
|
|
|
test-e2e:
|
|
name: "test/e2e/${{ matrix.os }}"
|
|
needs:
|
|
- changes
|
|
if: needs.changes.outputs.docs-only == 'false'
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 20
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Cache Node
|
|
id: cache-node
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
**/node_modules
|
|
.eslintcache
|
|
key: js-${{ runner.os }}-e2e-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
# Go is required for uploading the test results to datadog
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: "~1.19"
|
|
|
|
- uses: hashicorp/setup-terraform@v2
|
|
with:
|
|
terraform_version: 1.1.9
|
|
terraform_wrapper: false
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "14"
|
|
|
|
- name: Echo Go Cache Paths
|
|
id: go-cache-paths
|
|
run: |
|
|
echo "::set-output name=go-build::$(go env GOCACHE)"
|
|
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
|
|
|
|
- name: Go Build Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-build }}
|
|
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Go Mod Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ steps.go-cache-paths.outputs.go-mod }}
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
- name: Build
|
|
run: |
|
|
sudo npm install -g prettier
|
|
make -B site/out/index.html
|
|
|
|
- run: yarn playwright:install
|
|
working-directory: site
|
|
|
|
- run: yarn playwright:install-deps
|
|
working-directory: site
|
|
|
|
- run: yarn playwright:test
|
|
env:
|
|
DEBUG: pw:api
|
|
working-directory: site
|
|
|
|
- name: Upload Playwright Failed Tests
|
|
if: always() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: failed-test-videos
|
|
path: ./site/test-results/**/*.webm
|
|
retention:days: 7
|
|
|
|
- name: Upload DataDog Trace
|
|
if: always() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
|
|
env:
|
|
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
|
DD_CATEGORY: e2e
|
|
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
run: go run scripts/datadog-cireport/main.go site/test-results/junit.xml
|
|
chromatic:
|
|
# REMARK: this is only used to build storybook and deploy it to Chromatic.
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- changes
|
|
if: needs.changes.outputs.ts == 'true'
|
|
steps:
|
|
- 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
|
|
|
|
- name: Install dependencies
|
|
run: cd site && yarn
|
|
|
|
# This step is not meant for mainline because any detected changes to
|
|
# storybook snapshots will require manual approval/review in order for
|
|
# the check to pass. This is desired in PRs, but not in mainline.
|
|
- name: Publish to Chromatic (non-mainline)
|
|
if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder'
|
|
uses: chromaui/action@v1
|
|
with:
|
|
buildScriptName: "storybook:build"
|
|
exitOnceUploaded: true
|
|
# Chromatic states its fine to make this token public. See:
|
|
# https://www.chromatic.com/docs/github-actions#forked-repositories
|
|
projectToken: 695c25b6cb65
|
|
workingDir: "./site"
|
|
|
|
# This is a separate step for mainline only that auto accepts and changes
|
|
# instead of holding CI up. Since we squash/merge, this is defensive to
|
|
# avoid the same changeset from requiring review once squashed into
|
|
# main. Chromatic is supposed to be able to detect that we use squash
|
|
# commits, but it's good to be defensive in case, otherwise CI remains
|
|
# infinitely "in progress" in mainline unless we re-review each build.
|
|
- name: Publish to Chromatic (mainline)
|
|
if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
|
|
uses: chromaui/action@v1
|
|
with:
|
|
autoAcceptChanges: true
|
|
buildScriptName: "storybook:build"
|
|
projectToken: 695c25b6cb65
|
|
workingDir: "./site"
|