Skip to content

Commit 1ac76a9

Browse files
authored
Use reusable workflows (#605)
## Checklist <!-- Put an `x` in the boxes. All tasks must be completed and boxes checked before merging. --> - [x] 🤖 This change is covered by unit tests (if applicable). - [x] 🤹 Manual testing has been performed (if necessary). - [x] 🛡️ Security impacts have been considered (if relevant). - [x] 📖 Documentation updates are complete (if required). - [x] 🧠 Third-party dependencies and TPIP updated (if required).
1 parent 07a2237 commit 1ac76a9

File tree

7 files changed

+119
-343
lines changed

7 files changed

+119
-343
lines changed

.github/workflows/build.yml

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

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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-qlty-coverage: true
35+
36+
# Make sure local_repository.pidx is linted against PackIndex.xsd
37+
xmllint:
38+
name: Xmllint
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Harden Runner
42+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
43+
with:
44+
egress-policy: audit
45+
46+
- name: Check out repository code
47+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
48+
49+
- name: Install Go
50+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
51+
with:
52+
go-version-file: go.mod
53+
check-latest: true
54+
55+
- name: Install xmllint
56+
run: sudo apt-get update && sudo apt-get install libxml2-utils
57+
58+
- name: Check if local_repository.pidx is valid
59+
run: |
60+
make test-xmllint-localrepository
61+
62+
publish-test-results:
63+
name: "Publish Tests Results"
64+
needs: [ build-and-verify ]
65+
runs-on: ubuntu-latest
66+
permissions:
67+
checks: write
68+
pull-requests: write
69+
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' && github.workflow != 'Release' }}
70+
steps:
71+
- name: Harden Runner
72+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
73+
with:
74+
egress-policy: audit
75+
76+
- name: Download Artifacts
77+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
78+
with:
79+
path: artifacts
80+
81+
- name: publish test results
82+
uses: EnricoMi/publish-unit-test-result-action/linux@3a74b2957438d0b6e2e61d67b05318aa25c9e6c6 # v2.20.0
83+
with:
84+
files: artifacts/**/cpackget-testreport-*.xml
85+
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-qlty-coverage: 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)