Skip to content

ci: Enable forks to run CI #910

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 2 commits into from
Apr 7, 2022
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
10 changes: 6 additions & 4 deletions .github/workflows/chromatic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# by storing snapshots.
#
# SEE: https://www.chromatic.com/docs/ci
name: "Chromatic"
name: chromatic

# Chromatic works best with push events, not pull_request or other event types.
on: push

jobs:
chromatic-deployment:
deploy:
# REMARK: this is only used to build storybook and deploy it to Chromatic.
runs-on: ubuntu-latest

Expand All @@ -33,7 +33,9 @@ jobs:
with:
buildScriptName: "storybook:build"
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"

# This is a separate step for mainline only that auto accepts and changes
Expand All @@ -48,5 +50,5 @@ jobs:
with:
autoAcceptChanges: true
buildScriptName: "storybook:build"
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
projectToken: 695c25b6cb65
workingDir: "./site"
98 changes: 0 additions & 98 deletions .github/workflows/coder-test-stability.yaml

This file was deleted.

31 changes: 9 additions & 22 deletions .github/workflows/coder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ name: coder

on:
push:
branches:
- main
- "release/*"
tags:
- "*"

pull_request:
branches:
- "*"

workflow_dispatch:

Expand Down Expand Up @@ -178,7 +169,7 @@ jobs:
-timeout=3m -count=$GOCOUNT -short -failfast

- name: Upload DataDog Trace
if: (success() || failure()) && github.actor != 'dependabot[bot]'
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_DATABASE: fake
Expand All @@ -187,7 +178,7 @@ jobs:
run: go run scripts/datadog-cireport/main.go gotests.xml

- uses: codecov/codecov-action@v2
if: github.actor != 'dependabot[bot]'
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./gotests.coverage
Expand Down Expand Up @@ -264,25 +255,25 @@ jobs:
-count=1 -parallel=2 -race -failfast

- name: Upload DataDog Trace
if: (success() || failure()) && github.actor != 'dependabot[bot]'
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
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@v2
if: github.actor != 'dependabot[bot]'
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./gotests.coverage
flags: unittest-go-${{ matrix.os }}
flags: unittest-go-postgres-${{ matrix.os }}
fail_ci_if_error: true

deploy:
name: "deploy"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
permissions:
contents: read
id-token: write
Expand Down Expand Up @@ -391,15 +382,15 @@ jobs:
working-directory: site

- uses: codecov/codecov-action@v2
if: github.actor != 'dependabot[bot]'
if: github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./site/coverage/lcov.info
flags: unittest-js
fail_ci_if_error: true

- name: Upload DataDog Trace
if: (success() || failure()) && github.actor != 'dependabot[bot]'
if: (success() || failure()) && github.actor != 'dependabot[bot]' && github.repository_owner == 'coder'
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_CATEGORY: unit
Expand All @@ -413,10 +404,6 @@ jobs:
matrix:
os:
- ubuntu-latest
- macos-latest
# TODO: Get `make build` running on Windows 2022
# https://github.com/coder/coder/issues/384
# - windows-2022
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -483,7 +470,7 @@ jobs:
working-directory: site

- 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:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_CATEGORY: e2e
Expand Down
7 changes: 7 additions & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ comment:

coverage:
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:
default:
url: secret:v1::ALa1/e2X+k36fPseab5D7+kBFc9bJyIoIQioD0IMA5jr+0HXVpBRNDCHZhHjCdGc67yff6PPixPEOLwEZpxC37rM23RBZOYlqAq9A5e0MeZVlEoVq19aOYN4Xel17hMJ6GGm7n17wrYpCpcvlVSqNrN0+cr3guVDyG10kQyfh2Y=
Expand Down