-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci/cd: sync configuration with the go service template
- Loading branch information
Showing
6 changed files
with
79 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ on: | |
schedule: | ||
- cron: 0 7 1 * * # at 07:00 on day-of-month 1, UTC | ||
|
||
workflow_call: | ||
|
||
workflow_dispatch: | ||
inputs: | ||
reason: | ||
|
@@ -19,7 +21,7 @@ on: | |
required: true | ||
|
||
concurrency: | ||
group: pages | ||
group: docs | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
@@ -34,17 +36,25 @@ jobs: | |
- name: Set up Node.js environment | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 18 | ||
node-version: 20 | ||
cache: npm | ||
cache-dependency-path: docs/package-lock.json | ||
check-latest: true | ||
- name: Install dependencies | ||
run: ./Taskfile docs npm ci | ||
- name: Set up GitHub Pages | ||
uses: actions/[email protected] | ||
- name: Install dependencies | ||
run: ./Taskfile docs npm ci | ||
|
||
- name: Build static HTML with Next.js | ||
run: ./Taskfile docs publish | ||
- name: Build the documentation | ||
run: | | ||
path=$( | ||
gh api repos/${{ github.repository }}/pages \ | ||
--jq '.html_url' | | ||
awk -F'https?://[^/]+' '{print $2}' | ||
) | ||
TARGET=static BASE_PATH="${path%/}" ./Taskfile docs build | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
- name: Upload the documentation | ||
uses: actions/[email protected] | ||
with: { path: docs/dist } | ||
|
@@ -57,7 +67,6 @@ jobs: | |
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
permissions: | ||
contents: read | ||
id-token: write | ||
pages: write | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ on: | |
- 'go.{mod,sum}' | ||
- 'Makefile' | ||
- 'Taskfile' | ||
tags: [ '!*' ] | ||
tags: [ 'v*' ] | ||
|
||
schedule: | ||
- cron: 0 7 1 * * # at 07:00 on day-of-month 1, UTC | ||
|
@@ -46,15 +46,10 @@ jobs: | |
uses: actions/[email protected] | ||
with: | ||
go-version: 1.21.x | ||
cache-dependency-path: tools/go.sum | ||
check-latest: true | ||
- name: Set up environment | ||
run: make tools | ||
|
||
- name: Run linter | ||
run: make lint | ||
- name: Run fast check the state | ||
run: make fast-check | ||
uses: golangci/[email protected] | ||
|
||
test: | ||
name: Testing | ||
|
@@ -74,7 +69,9 @@ jobs: | |
with: { fetch-depth: 0 } | ||
- name: Set up Go environment | ||
uses: actions/[email protected] | ||
with: { go-version: '${{ matrix.go }}', check-latest: true } | ||
with: | ||
go-version: '${{ matrix.go }}' | ||
check-latest: true | ||
- name: Set up environment | ||
run: make env deps | ||
|
||
|
@@ -88,36 +85,50 @@ jobs: | |
if: matrix.go == '1.21.x' | ||
- name: Store code coverage report | ||
uses: actions/[email protected] | ||
if: matrix.go == '1.21.x' | ||
with: { name: code-coverage-report, path: c.out } | ||
if: matrix.go == '1.21.x' | ||
|
||
- name: Check installation | ||
run: | | ||
make install | ||
[ $(ls bin/linux/*/* | wc -l) = 1 ] | ||
publish: | ||
name: Documentation | ||
needs: [ test ] | ||
uses: ./.github/workflows/cd.docs.yml | ||
permissions: | ||
id-token: write | ||
pages: write | ||
if: true | ||
|
||
release: | ||
name: Distribution | ||
needs: [ test ] | ||
uses: ./.github/workflows/cd.dist.yml | ||
secrets: | ||
GORELEASER_TOKEN: ${{ secrets.GORELEASER_TOKEN }} | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
|
||
report: | ||
name: Reporting | ||
needs: [ test ] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the repository | ||
uses: actions/[email protected] | ||
with: { fetch-depth: 0 } | ||
|
||
- name: Fetch code coverage report | ||
uses: actions/[email protected] | ||
with: { name: code-coverage-report } | ||
- name: Send code coverage report to Codecov (codecov.io) | ||
- name: Send code coverage report to Codecov | ||
uses: codecov/[email protected] | ||
with: { files: c.out } | ||
|
||
notify: | ||
name: Notifying | ||
needs: [ lint, test ] | ||
needs: [ lint, report ] | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'pull_request' && (failure() || success()) | ||
if: github.event_name != 'pull_request' | ||
&& (failure() || success()) | ||
|
||
steps: | ||
- name: Checkout the repository | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ on: | |
schedule: | ||
- cron: 0 6 1 * * # at 06:00 on day-of-month 1, UTC | ||
|
||
workflow_call: | ||
|
||
workflow_dispatch: | ||
inputs: | ||
pattern: | ||
|
@@ -35,18 +37,25 @@ jobs: | |
delete: | ||
name: Deleting | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
|
||
steps: | ||
- name: Delete workflow runs | ||
uses: Mattraks/[email protected] | ||
with: | ||
token: ${{ github.token }} | ||
repository: ${{ github.repository }} | ||
delete_workflow_pattern: ${{ github.event.inputs.pattern || 'all' }} | ||
delete_workflow_pattern: >- | ||
${{ | ||
github.event.inputs.pattern != 'All' | ||
&& github.event.inputs.pattern | ||
|| '' | ||
}} | ||
dry_run: ${{ fromJSON('["", "true"]')[github.event.inputs.dry_run == 'true'] }} | ||
retain_days: 0 | ||
keep_minimum_runs: 0 | ||
- name: Cleanup workflow runs | ||
- name: Finishing workflow runs deletion | ||
run: | | ||
gh run list \ | ||
-R '${{ github.repository }}' \ | ||
|
@@ -55,9 +64,9 @@ jobs: | |
--json databaseId \ | ||
--jq '.[] | .databaseId' | | ||
xargs -n1 --no-run-if-empty gh run delete -R '${{ github.repository }}' | ||
if: github.event.inputs.pattern == 'All' | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
if: github.event.inputs.pattern == 'All' | ||
|
||
notify: | ||
name: Notifying | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,24 @@ jobs: | |
- name: Install dependencies | ||
run: make env deps | ||
|
||
docs: | ||
name: Caching docs deps | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the repository | ||
uses: actions/[email protected] | ||
with: { fetch-depth: 0 } | ||
- name: Set up Node.js environment | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 20 | ||
cache: npm | ||
cache-dependency-path: docs/package-lock.json | ||
check-latest: true | ||
- name: Install dependencies | ||
run: ./Taskfile docs npm ci | ||
|
||
tools: | ||
name: Caching tools | ||
runs-on: ubuntu-latest | ||
|