mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
ci: Enable forks to run CI (#910)
* ci: Enable forks to run CI All steps that require tokens are optional for forks, and will be skipped if the owner is not "coder". * Empty commit to force CI
This commit is contained in:
10
.github/workflows/chromatic.yaml
vendored
10
.github/workflows/chromatic.yaml
vendored
@ -4,13 +4,13 @@
|
|||||||
# by storing snapshots.
|
# by storing snapshots.
|
||||||
#
|
#
|
||||||
# SEE: https://www.chromatic.com/docs/ci
|
# SEE: https://www.chromatic.com/docs/ci
|
||||||
name: "Chromatic"
|
name: chromatic
|
||||||
|
|
||||||
# Chromatic works best with push events, not pull_request or other event types.
|
# Chromatic works best with push events, not pull_request or other event types.
|
||||||
on: push
|
on: push
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
chromatic-deployment:
|
deploy:
|
||||||
# REMARK: this is only used to build storybook and deploy it to Chromatic.
|
# REMARK: this is only used to build storybook and deploy it to Chromatic.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@ -33,7 +33,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
buildScriptName: "storybook:build"
|
buildScriptName: "storybook:build"
|
||||||
exitOnceUploaded: true
|
exitOnceUploaded: true
|
||||||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
# Chromatic states its fine to make this token public. See:
|
||||||
|
# https://www.chromatic.com/docs/github-actions#forked-repositories
|
||||||
|
projectToken: 695c25b6cb65
|
||||||
workingDir: "./site"
|
workingDir: "./site"
|
||||||
|
|
||||||
# This is a separate step for mainline only that auto accepts and changes
|
# This is a separate step for mainline only that auto accepts and changes
|
||||||
@ -48,5 +50,5 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
autoAcceptChanges: true
|
autoAcceptChanges: true
|
||||||
buildScriptName: "storybook:build"
|
buildScriptName: "storybook:build"
|
||||||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
|
projectToken: 695c25b6cb65
|
||||||
workingDir: "./site"
|
workingDir: "./site"
|
||||||
|
98
.github/workflows/coder-test-stability.yaml
vendored
98
.github/workflows/coder-test-stability.yaml
vendored
@ -1,98 +0,0 @@
|
|||||||
# This workflow (aka The Gauntlet) is a high-iteration run of our tests,
|
|
||||||
# used to evaluate stability and shake out intermittent failures.
|
|
||||||
name: coder-test-stability
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
# Run everyday around midnight Central.
|
|
||||||
- cron: "0 6 * * *"
|
|
||||||
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- .github/workflows/coder-test-stability.yaml
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
iterationCount:
|
|
||||||
description: "Iteration Count"
|
|
||||||
required: false
|
|
||||||
default: "10"
|
|
||||||
|
|
||||||
# Cancel in-progress runs for pull requests when developers push
|
|
||||||
# additional changes, and serialize builds in branches.
|
|
||||||
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
coder-test-stability:
|
|
||||||
name: "test/go/stability/${{ matrix.os }}/${{ matrix.instance }}"
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
- ubuntu-latest
|
|
||||||
- macos-latest
|
|
||||||
- windows-2022
|
|
||||||
instance:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
go-version: "~1.18"
|
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
# Go mod cache, Linux build cache, Mac build cache, Windows build cache
|
|
||||||
path: |
|
|
||||||
~/go/pkg/mod
|
|
||||||
~/.cache/go-build
|
|
||||||
~/Library/Caches/go-build
|
|
||||||
%LocalAppData%\go-build
|
|
||||||
key: ${{ matrix.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ matrix.os }}-go-
|
|
||||||
|
|
||||||
- run: go install gotest.tools/gotestsum@latest
|
|
||||||
|
|
||||||
- uses: hashicorp/setup-terraform@v1
|
|
||||||
with:
|
|
||||||
terraform_version: 1.1.2
|
|
||||||
terraform_wrapper: false
|
|
||||||
|
|
||||||
- name: Test with Mock Database
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
GOCOUNT: ${{ github.event.inputs.iterationCount || 10 }}
|
|
||||||
GOMAXPROCS: ${{ runner.os == 'Windows' && 1 || 2 }}
|
|
||||||
run: gotestsum --junitfile="gotests.xml" --packages="./..." --
|
|
||||||
-covermode=atomic -coverprofile="gotests.coverage"
|
|
||||||
-timeout=15m -count=$GOCOUNT -race -short -failfast
|
|
||||||
|
|
||||||
- name: Upload DataDog Trace
|
|
||||||
if: (success() || failure()) && github.actor != 'dependabot[bot]'
|
|
||||||
env:
|
|
||||||
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
|
||||||
DD_DATABASE: fake
|
|
||||||
GIT_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
||||||
run: go run scripts/datadog-cireport/main.go gotests.xml
|
|
||||||
|
|
||||||
- name: Test with PostgreSQL Database
|
|
||||||
if: runner.os == 'Linux'
|
|
||||||
env:
|
|
||||||
GOCOUNT: ${{ github.event.inputs.iterationCount || 10 }}
|
|
||||||
run: DB=true gotestsum --junitfile="gotests.xml" --packages="./..." --
|
|
||||||
-covermode=atomic -coverprofile="gotests.coverage" -timeout=30m
|
|
||||||
-count=$GOCOUNT -race -parallel=2 -failfast
|
|
||||||
|
|
||||||
- name: Upload DataDog Trace
|
|
||||||
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux'
|
|
||||||
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
|
|
31
.github/workflows/coder.yaml
vendored
31
.github/workflows/coder.yaml
vendored
@ -2,15 +2,6 @@ name: coder
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- "release/*"
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- "*"
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@ -178,7 +169,7 @@ jobs:
|
|||||||
-timeout=3m -count=$GOCOUNT -short -failfast
|
-timeout=3m -count=$GOCOUNT -short -failfast
|
||||||
|
|
||||||
- name: Upload DataDog Trace
|
- name: Upload DataDog Trace
|
||||||
if: (success() || failure()) && github.actor != 'dependabot[bot]'
|
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
|
||||||
env:
|
env:
|
||||||
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
||||||
DD_DATABASE: fake
|
DD_DATABASE: fake
|
||||||
@ -187,7 +178,7 @@ jobs:
|
|||||||
run: go run scripts/datadog-cireport/main.go gotests.xml
|
run: go run scripts/datadog-cireport/main.go gotests.xml
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v2
|
- uses: codecov/codecov-action@v2
|
||||||
if: github.actor != 'dependabot[bot]'
|
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
files: ./gotests.coverage
|
files: ./gotests.coverage
|
||||||
@ -264,7 +255,7 @@ jobs:
|
|||||||
-count=1 -parallel=2 -race -failfast
|
-count=1 -parallel=2 -race -failfast
|
||||||
|
|
||||||
- name: Upload DataDog Trace
|
- name: Upload DataDog Trace
|
||||||
if: (success() || failure()) && github.actor != 'dependabot[bot]'
|
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
|
||||||
env:
|
env:
|
||||||
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
||||||
DD_DATABASE: postgresql
|
DD_DATABASE: postgresql
|
||||||
@ -272,17 +263,17 @@ jobs:
|
|||||||
run: go run scripts/datadog-cireport/main.go gotests.xml
|
run: go run scripts/datadog-cireport/main.go gotests.xml
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v2
|
- uses: codecov/codecov-action@v2
|
||||||
if: github.actor != 'dependabot[bot]'
|
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
files: ./gotests.coverage
|
files: ./gotests.coverage
|
||||||
flags: unittest-go-${{ matrix.os }}
|
flags: unittest-go-postgres-${{ matrix.os }}
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: "deploy"
|
name: "deploy"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
@ -391,7 +382,7 @@ jobs:
|
|||||||
working-directory: site
|
working-directory: site
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v2
|
- uses: codecov/codecov-action@v2
|
||||||
if: github.actor != 'dependabot[bot]'
|
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
files: ./site/coverage/lcov.info
|
files: ./site/coverage/lcov.info
|
||||||
@ -399,7 +390,7 @@ jobs:
|
|||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
|
||||||
- name: Upload DataDog Trace
|
- name: Upload DataDog Trace
|
||||||
if: (success() || failure()) && github.actor != 'dependabot[bot]'
|
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
|
||||||
env:
|
env:
|
||||||
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
||||||
DD_CATEGORY: unit
|
DD_CATEGORY: unit
|
||||||
@ -413,10 +404,6 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
|
||||||
# TODO: Get `make build` running on Windows 2022
|
|
||||||
# https://github.com/coder/coder/issues/384
|
|
||||||
# - windows-2022
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
@ -483,7 +470,7 @@ jobs:
|
|||||||
working-directory: site
|
working-directory: site
|
||||||
|
|
||||||
- name: Upload DataDog Trace
|
- name: Upload DataDog Trace
|
||||||
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux'
|
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && github.repository_owner == 'coder'
|
||||||
env:
|
env:
|
||||||
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
|
||||||
DD_CATEGORY: e2e
|
DD_CATEGORY: e2e
|
||||||
|
@ -6,6 +6,13 @@ comment:
|
|||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
notify:
|
notify:
|
||||||
|
flags:
|
||||||
|
# Wait to notify until coverage has properly been reported.
|
||||||
|
# This can prevent incorrect statuses.
|
||||||
|
- unittest-go-ubuntu-latest
|
||||||
|
- unittest-go-postgres-ubuntu-latest
|
||||||
|
- unittest-go-macos-latest
|
||||||
|
- unittest-go-windows-2022
|
||||||
slack:
|
slack:
|
||||||
default:
|
default:
|
||||||
url: secret:v1::ALa1/e2X+k36fPseab5D7+kBFc9bJyIoIQioD0IMA5jr+0HXVpBRNDCHZhHjCdGc67yff6PPixPEOLwEZpxC37rM23RBZOYlqAq9A5e0MeZVlEoVq19aOYN4Xel17hMJ6GGm7n17wrYpCpcvlVSqNrN0+cr3guVDyG10kQyfh2Y=
|
url: secret:v1::ALa1/e2X+k36fPseab5D7+kBFc9bJyIoIQioD0IMA5jr+0HXVpBRNDCHZhHjCdGc67yff6PPixPEOLwEZpxC37rM23RBZOYlqAq9A5e0MeZVlEoVq19aOYN4Xel17hMJ6GGm7n17wrYpCpcvlVSqNrN0+cr3guVDyG10kQyfh2Y=
|
||||||
|
Reference in New Issue
Block a user