mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +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"
|
name: "Setup Node"
|
||||||
description: |
|
description: |
|
||||||
Sets up the node environment for tests, builds, etc.
|
Sets up the node environment for tests, builds, etc.
|
||||||
|
inputs:
|
||||||
|
directory:
|
||||||
|
description: |
|
||||||
|
The directory to run the setup in.
|
||||||
|
required: false
|
||||||
|
default: "site"
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@ -10,8 +16,8 @@ runs:
|
|||||||
node-version: 16.20.1
|
node-version: 16.20.1
|
||||||
# See https://github.com/actions/setup-node#caching-global-packages-data
|
# See https://github.com/actions/setup-node#caching-global-packages-data
|
||||||
cache: "yarn"
|
cache: "yarn"
|
||||||
cache-dependency-path: "site/yarn.lock"
|
cache-dependency-path: ${{ inputs.directory }}/yarn.lock
|
||||||
- name: Install node_modules
|
- name: Install node_modules
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ../scripts/yarn_install.sh
|
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 }}
|
ts: ${{ steps.filter.outputs.ts }}
|
||||||
k8s: ${{ steps.filter.outputs.k8s }}
|
k8s: ${{ steps.filter.outputs.k8s }}
|
||||||
ci: ${{ steps.filter.outputs.ci }}
|
ci: ${{ steps.filter.outputs.ci }}
|
||||||
|
offlinedocs-only: ${{ steps.filter.outputs.offlinedocs_count == steps.filter.outputs.all_count }}
|
||||||
|
offlinedocs: ${{ steps.filter.outputs.offlinedocs }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@ -85,7 +87,6 @@ jobs:
|
|||||||
ts:
|
ts:
|
||||||
- "site/**"
|
- "site/**"
|
||||||
- "Makefile"
|
- "Makefile"
|
||||||
- "offlinedocs/**"
|
|
||||||
k8s:
|
k8s:
|
||||||
- "helm/**"
|
- "helm/**"
|
||||||
- "scripts/Dockerfile"
|
- "scripts/Dockerfile"
|
||||||
@ -94,11 +95,16 @@ jobs:
|
|||||||
ci:
|
ci:
|
||||||
- ".github/actions/**"
|
- ".github/actions/**"
|
||||||
- ".github/workflows/ci.yaml"
|
- ".github/workflows/ci.yaml"
|
||||||
|
offlinedocs:
|
||||||
|
- "offlinedocs/**"
|
||||||
|
|
||||||
- id: debug
|
- id: debug
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJSON(steps.filter )}}"
|
echo "${{ toJSON(steps.filter )}}"
|
||||||
|
|
||||||
lint:
|
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' }}
|
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -194,6 +200,8 @@ jobs:
|
|||||||
run: ./scripts/check_unstaged.sh
|
run: ./scripts/check_unstaged.sh
|
||||||
|
|
||||||
fmt:
|
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' }}
|
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
@ -590,9 +598,68 @@ jobs:
|
|||||||
projectToken: 695c25b6cb65
|
projectToken: 695c25b6cb65
|
||||||
workingDir: "./site"
|
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:
|
required:
|
||||||
runs-on: ubuntu-latest
|
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
|
# Allow this job to run even if the needed jobs fail, are skipped or
|
||||||
# cancelled.
|
# cancelled.
|
||||||
if: always()
|
if: always()
|
||||||
|
@ -7,7 +7,12 @@
|
|||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"export": "yarn copy-images && next build && next export",
|
"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": {
|
"dependencies": {
|
||||||
"@chakra-ui/react": "2.8.0",
|
"@chakra-ui/react": "2.8.0",
|
||||||
@ -27,11 +32,14 @@
|
|||||||
"remark-gfm": "3.0.1"
|
"remark-gfm": "3.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@react-native-community/eslint-config": "^3.2.0",
|
||||||
|
"@react-native-community/eslint-plugin": "^1.3.0",
|
||||||
"@types/node": "18.0.0",
|
"@types/node": "18.0.0",
|
||||||
"@types/react": "18.0.14",
|
"@types/react": "18.0.14",
|
||||||
"@types/react-dom": "18.0.5",
|
"@types/react-dom": "18.0.5",
|
||||||
"eslint": "8.45.0",
|
"eslint": "8.45.0",
|
||||||
"eslint-config-next": "13.4.10",
|
"eslint-config-next": "13.4.10",
|
||||||
|
"prettier": "3.0.0",
|
||||||
"typescript": "4.7.3"
|
"typescript": "4.7.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user