Browse Source

Clean up github actions (#24984)

- Merge the file filters into `files-changed.yml`
- Remove unused yaml anchors like `&backend`
- Merge the `compliance-docs` workflow into `compliance`
- Add actions linting
- Misc cleanups for whitespace and step names
tags/v1.20.0-rc0
silverwind 1 year ago
parent
commit
d783384c19
No account linked to committer's email address

+ 0
- 15
.github/file-filters.yml View File

docs: &docs
- "**/*.md"
- "docs/**"

backend: &backend
- "**/*.go"
- "**/*.tmpl"
- "go.mod"
- "go.sum"

frontend: &frontend
- "**/*.js"
- "web_src/**"
- "package.json"
- "package-lock.json"

+ 32
- 11
.github/workflows/files-changed.yml View File

name: files changed
name: files-changed


on: on:
workflow_call: workflow_call:
outputs: outputs:
docs:
description: "whether docs files changed"
value: ${{ jobs.files-changed.outputs.docs }}
backend: backend:
description: "whether backend files changed" description: "whether backend files changed"
value: ${{ jobs.files-changed.outputs.backend }}
value: ${{ jobs.detect.outputs.backend }}
frontend: frontend:
description: "whether frontend files changed" description: "whether frontend files changed"
value: ${{ jobs.files-changed.outputs.frontend }}
value: ${{ jobs.detect.outputs.frontend }}
docs:
description: "whether docs files changed"
value: ${{ jobs.detect.outputs.docs }}
actions:
description: "whether actions files changed"
value: ${{ jobs.detect.outputs.actions }}


jobs: jobs:
files-changed:
detect:
name: detect which files changed name: detect which files changed
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 3 timeout-minutes: 3
# Map a step output to a job output # Map a step output to a job output
outputs: outputs:
docs: ${{ steps.changes.outputs.docs }}
backend: ${{ steps.changes.outputs.backend }} backend: ${{ steps.changes.outputs.backend }}
frontend: ${{ steps.changes.outputs.frontend }} frontend: ${{ steps.changes.outputs.frontend }}
docs: ${{ steps.changes.outputs.docs }}
actions: ${{ steps.changes.outputs.actions }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Check for backend file changes
uses: dorny/paths-filter@v2
- uses: dorny/paths-filter@v2
id: changes id: changes
with: with:
filters: .github/file-filters.yml
filters: |
backend:
- "**/*.go"
- "**/*.tmpl"
- "go.mod"
- "go.sum"

frontend:
- "**/*.js"
- "web_src/**"
- "package.json"
- "package-lock.json"

docs:
- "**/*.md"
- "docs/**"

actions:
- ".github/workflows/*"

+ 0
- 25
.github/workflows/pull-compliance-docs.yml View File

name: compliance-docs

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
files-changed:
uses: ./.github/workflows/files-changed.yml

compliance-docs:
if: needs.files-changed.outputs.docs == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- run: make deps-frontend
- run: make lint-md
- run: make docs # test if build could succeed

+ 27
- 0
.github/workflows/pull-compliance.yml View File

- run: make lint-backend - run: make lint-backend
env: env:
TAGS: bindata sqlite sqlite_unlock_notify TAGS: bindata sqlite sqlite_unlock_notify

lint-go-windows: lint-go-windows:
if: needs.files-changed.outputs.backend == 'true' if: needs.files-changed.outputs.backend == 'true'
needs: files-changed needs: files-changed
TAGS: bindata sqlite sqlite_unlock_notify TAGS: bindata sqlite sqlite_unlock_notify
GOOS: windows GOOS: windows
GOARCH: amd64 GOARCH: amd64

lint-go-gogit: lint-go-gogit:
if: needs.files-changed.outputs.backend == 'true' if: needs.files-changed.outputs.backend == 'true'
needs: files-changed needs: files-changed
- run: make lint-go - run: make lint-go
env: env:
TAGS: bindata gogit sqlite sqlite_unlock_notify TAGS: bindata gogit sqlite sqlite_unlock_notify

checks-backend: checks-backend:
if: needs.files-changed.outputs.backend == 'true' if: needs.files-changed.outputs.backend == 'true'
needs: files-changed needs: files-changed
check-latest: true check-latest: true
- run: make deps-backend deps-tools - run: make deps-backend deps-tools
- run: make --always-make checks-backend # ensure the "go-licenses" make target runs - run: make --always-make checks-backend # ensure the "go-licenses" make target runs

frontend: frontend:
if: needs.files-changed.outputs.frontend == 'true' if: needs.files-changed.outputs.frontend == 'true'
needs: files-changed needs: files-changed
- run: make deps-frontend - run: make deps-frontend
- run: make lint-frontend - run: make lint-frontend
- run: make checks-frontend - run: make checks-frontend

backend: backend:
if: needs.files-changed.outputs.backend == 'true' if: needs.files-changed.outputs.backend == 'true'
needs: files-changed needs: files-changed
env: env:
GOOS: linux GOOS: linux
GOARCH: 386 GOARCH: 386

docs:
if: needs.files-changed.outputs.docs == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- run: make deps-frontend
- run: make lint-md
- run: make docs # test if build could succeed

actions:
if: needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- run: make lint-actions

Loading…
Cancel
Save