mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
ci: fmt, lint and build offlinedocs (#8642)
Co-authored-by: Dean Sheather <dean@deansheather.com>
This commit is contained in:
committed by
GitHub
parent
87f07b9f2f
commit
757ea68d4a
10
.github/actions/setup-node/action.yaml
vendored
10
.github/actions/setup-node/action.yaml
vendored
@ -1,6 +1,12 @@
|
||||
name: "Setup Node"
|
||||
description: |
|
||||
Sets up the node environment for tests, builds, etc.
|
||||
inputs:
|
||||
directory:
|
||||
description: |
|
||||
The directory to run the setup in.
|
||||
required: false
|
||||
default: "site"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
@ -10,8 +16,8 @@ runs:
|
||||
node-version: 16.20.1
|
||||
# See https://github.com/actions/setup-node#caching-global-packages-data
|
||||
cache: "yarn"
|
||||
cache-dependency-path: "site/yarn.lock"
|
||||
cache-dependency-path: ${{ inputs.directory }}/yarn.lock
|
||||
- name: Install node_modules
|
||||
shell: bash
|
||||
run: ../scripts/yarn_install.sh
|
||||
working-directory: site
|
||||
working-directory: ${{ inputs.directory }}
|
||||
|
71
.github/workflows/ci.yaml
vendored
71
.github/workflows/ci.yaml
vendored
@ -35,6 +35,8 @@ jobs:
|
||||
ts: ${{ steps.filter.outputs.ts }}
|
||||
k8s: ${{ steps.filter.outputs.k8s }}
|
||||
ci: ${{ steps.filter.outputs.ci }}
|
||||
offlinedocs-only: ${{ steps.filter.outputs.offlinedocs_count == steps.filter.outputs.all_count }}
|
||||
offlinedocs: ${{ steps.filter.outputs.offlinedocs }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@ -85,7 +87,6 @@ jobs:
|
||||
ts:
|
||||
- "site/**"
|
||||
- "Makefile"
|
||||
- "offlinedocs/**"
|
||||
k8s:
|
||||
- "helm/**"
|
||||
- "scripts/Dockerfile"
|
||||
@ -94,11 +95,16 @@ jobs:
|
||||
ci:
|
||||
- ".github/actions/**"
|
||||
- ".github/workflows/ci.yaml"
|
||||
offlinedocs:
|
||||
- "offlinedocs/**"
|
||||
|
||||
- id: debug
|
||||
run: |
|
||||
echo "${{ toJSON(steps.filter )}}"
|
||||
|
||||
lint:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.offlinedocs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
|
||||
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
@ -194,6 +200,8 @@ jobs:
|
||||
run: ./scripts/check_unstaged.sh
|
||||
|
||||
fmt:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.offlinedocs-only == 'false' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
|
||||
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
@ -590,9 +598,68 @@ jobs:
|
||||
projectToken: 695c25b6cb65
|
||||
workingDir: "./site"
|
||||
|
||||
offlinedocs:
|
||||
name: offlinedocs
|
||||
needs: changes
|
||||
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
|
||||
if: needs.changes.outputs.offlinedocs == 'true' || needs.changes.outputs.ci == 'true'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node
|
||||
uses: ./.github/actions/setup-node
|
||||
with:
|
||||
directory: offlinedocs
|
||||
|
||||
- name: Setup Go
|
||||
uses: ./.github/actions/setup-go
|
||||
|
||||
- name: Install go tools
|
||||
run: |
|
||||
go install github.com/golang/mock/mockgen@v1.6.0
|
||||
|
||||
- name: Setup sqlc
|
||||
uses: sqlc-dev/setup-sqlc@v3
|
||||
with:
|
||||
sqlc-version: "1.19.1"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
cd offlinedocs
|
||||
yarn
|
||||
# Install prettier globally
|
||||
prettier_version=$(jq -r '.devDependencies.prettier' < package.json)
|
||||
yarn global add "prettier@${prettier_version}"
|
||||
|
||||
- name: Format
|
||||
run: |
|
||||
cd offlinedocs
|
||||
yarn format:check
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
cd offlinedocs
|
||||
yarn lint
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
version="$(./scripts/version.sh)"
|
||||
make -j build/coder_docs_"$version".tgz
|
||||
|
||||
required:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [fmt, lint, gen, test-go, test-go-pg, test-go-race, test-js]
|
||||
needs:
|
||||
- fmt
|
||||
- lint
|
||||
- gen
|
||||
- test-go
|
||||
- test-go-pg
|
||||
- test-go-race
|
||||
- test-js
|
||||
- offlinedocs
|
||||
# Allow this job to run even if the needed jobs fail, are skipped or
|
||||
# cancelled.
|
||||
if: always()
|
||||
|
@ -7,7 +7,12 @@
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"export": "yarn copy-images && next build && next export",
|
||||
"copy-images": "sh ./scripts/copyImages.sh"
|
||||
"copy-images": "sh ./scripts/copyImages.sh",
|
||||
"lint": "yarn run lint:types",
|
||||
"lint:fix": "FIX=true yarn lint",
|
||||
"lint:types": "tsc --noEmit",
|
||||
"format:check": "prettier --cache --check './**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'",
|
||||
"format:write": "prettier --cache --write './**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@chakra-ui/react": "2.8.0",
|
||||
@ -27,11 +32,14 @@
|
||||
"remark-gfm": "3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native-community/eslint-config": "^3.2.0",
|
||||
"@react-native-community/eslint-plugin": "^1.3.0",
|
||||
"@types/node": "18.0.0",
|
||||
"@types/react": "18.0.14",
|
||||
"@types/react-dom": "18.0.5",
|
||||
"eslint": "8.45.0",
|
||||
"eslint-config-next": "13.4.10",
|
||||
"prettier": "3.0.0",
|
||||
"typescript": "4.7.3"
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user