Skip to content

Commit 90f132a

Browse files
committed
Use reusable workflows
1 parent 07a2237 commit 90f132a

File tree

7 files changed

+120
-343
lines changed

7 files changed

+120
-343
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: ci
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
push:
7+
branches: [ main ]
8+
pull_request:
9+
paths:
10+
- '.github/workflows/ci.yml'
11+
- '**/*.go'
12+
- testdata/**/*
13+
- 'makefile'
14+
- 'go.mod'
15+
- 'go.sum'
16+
- '!**/*.md'
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
build-and-verify:
27+
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/[email protected]
28+
secrets:
29+
QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }}
30+
with:
31+
program: cpackget
32+
test-matrix: '[{"platform":"windows-2022","arch":"amd64"},{"platform":"ubuntu-24.04","arch":"amd64"},{"platform":"macos-14","arch":"amd64"},{"platform":"ubuntu-24.04","arch":"arm64"}]'
33+
go-version-file: ./go.mod
34+
enable-code-climate: true
35+
artifact-retention-days: 7
36+
37+
# Make sure local_repository.pidx is linted against PackIndex.xsd
38+
xmllint:
39+
name: Xmllint
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Harden Runner
43+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
44+
with:
45+
egress-policy: audit
46+
47+
- name: Check out repository code
48+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
49+
50+
- name: Install Go
51+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
52+
with:
53+
go-version-file: go.mod
54+
check-latest: true
55+
56+
- name: Install xmllint
57+
run: sudo apt-get update && sudo apt-get install libxml2-utils
58+
59+
- name: Check if local_repository.pidx is valid
60+
run: |
61+
make test-xmllint-localrepository
62+
63+
publish-test-results:
64+
name: "Publish Tests Results"
65+
needs: [ build-and-verify ]
66+
runs-on: ubuntu-latest
67+
permissions:
68+
checks: write
69+
pull-requests: write
70+
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' && github.workflow != 'Release' }}
71+
steps:
72+
- name: Harden Runner
73+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
74+
with:
75+
egress-policy: audit
76+
77+
- name: Download Artifacts
78+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
79+
with:
80+
path: artifacts
81+
82+
- name: publish test results
83+
uses: EnricoMi/publish-unit-test-result-action/linux@3a74b2957438d0b6e2e61d67b05318aa25c9e6c6 # v2.20.0
84+
with:
85+
files: artifacts/**/cpackget-testreport-*.xml
86+
report_individual_runs: true

.github/workflows/markdown.yml

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,9 @@ on:
1111
permissions: read-all
1212

1313
jobs:
14-
linter:
15-
name: Lint markdown files
16-
runs-on: ubuntu-22.04
17-
steps:
18-
- name: Harden Runner
19-
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
20-
with:
21-
egress-policy: audit
22-
23-
- name: Checkout devtools
24-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25-
26-
- name: Register markdownlint warning matcher
27-
run: |
28-
echo "::add-matcher::.github/markdownlint.json"
29-
30-
- name: Lint markdown files
31-
uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb # v1.5.0
32-
with:
33-
args: '**/*.md'
34-
config: '.github/markdownlint.jsonc'
35-
ignore: 'third_party_licenses.md'
36-
37-
- name: Remove markdownlint warning matcher
38-
if: always()
39-
run: |
40-
echo "::remove-matcher owner=markdownlint::"
41-
42-
check-links:
43-
name: Check markdown links
44-
runs-on: ubuntu-latest
45-
steps:
46-
- name: Checkout devtools
47-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
48-
49-
- name: Check links
50-
uses: gaurav-nelson/github-action-markdown-link-check@3c3b66f1f7d0900e37b71eca45b63ea9eedfce31 # master
51-
# Checks all Markdown files, including those in subfolders,
52-
# as the PR may involve removing referenced Markdown files.
53-
with:
54-
use-quiet-mode: 'yes'
55-
use-verbose-mode: 'yes'
56-
base-branch: ${{ github.base_ref }}
57-
config-file: '.github/markdown-link-check.jsonc'
14+
markdown-check:
15+
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/[email protected]
16+
with:
17+
lint-config: '.github/markdownlint.jsonc'
18+
link-check-config: '.github/markdown-link-check.jsonc'
19+
ignore-files: 'third_party_licenses.md'

.github/workflows/release.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ on:
1212
- "v*"
1313

1414
jobs:
15-
test:
16-
uses: Open-CMSIS-Pack/cpackget/.github/workflows/test.yml@main
15+
build-and-verify:
16+
uses: Open-CMSIS-Pack/workflows-and-actions-collection/.github/workflows/[email protected]
17+
with:
18+
program: cpackget
19+
test-matrix: '[{"platform":"windows-2022","arch":"amd64"},{"platform":"ubuntu-24.04","arch":"amd64"},{"platform":"macos-14","arch":"amd64"},{"platform":"ubuntu-24.04","arch":"arm64"}]'
20+
go-version-file: ./go.mod
21+
enable-code-climate: false
1722

1823
goreleaser:
19-
needs: test
24+
needs: [build-and-verify]
2025
permissions:
2126
contents: write # for goreleaser/goreleaser-action to create a GitHub release
2227
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)