ci: fmt, lint and build offlinedocs (#8642)

Co-authored-by: Dean Sheather <dean@deansheather.com>
This commit is contained in:
Muhammad Atif Ali
2023-07-24 10:54:08 +00:00
committed by GitHub
co-authored by Dean Sheather
parent 87f07b9f2f
commit 757ea68d4a
4 changed files with 945 additions and 674 deletions
+8 -2
View File
@@ -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 }}
+69 -2
View File
@@ -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()