mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
ci: fmt, lint and build offlinedocs (#8642)
Co-authored-by: Dean Sheather <dean@deansheather.com>
This commit is contained in:
co-authored by
Dean Sheather
parent
87f07b9f2f
commit
757ea68d4a
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user