Skip to content

Commit c4177fa

Browse files
committed
ci: add verification and updates on ports
Signed-off-by: msclock <[email protected]>
1 parent 41566a1 commit c4177fa

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Setup Vcpkg
2+
description: Install a full vcpkg environment
3+
inputs:
4+
5+
vcpkgVersion:
6+
description: Enter vcpkg version tag or stable or latest
7+
required: false
8+
default: latest
9+
type: string
10+
11+
vcpkgRoot:
12+
description: Enter VCPKGROOT as vcpkg root path
13+
required: false
14+
default: /usr/local/vcpkg
15+
type: string
16+
17+
vcpkgDownload:
18+
description: Enter VCPKGDOWNLOAD as vcpkg download path
19+
required: false
20+
default: /usr/local/vcpkg-downloads
21+
type: string
22+
23+
runs:
24+
using: composite
25+
steps:
26+
- name: Setup vcpkg
27+
run: |
28+
git clone --depth 1 https://github.com/msclock/features.git /tmp/vcpkg
29+
30+
sudo USERNAME="$USER" VCPKGVERSION="${{ inputs.vcpkgVersion }}" VCPKGROOT="${{ inputs.vcpkgRoot }}" \
31+
VCPKGDOWNLOAD="${{ inputs.vcpkgDownload }}" /tmp/vcpkg/src/vcpkg/install.sh
32+
vcpkg --version
33+
shell: bash

.github/workflows/ci.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,91 @@ jobs:
3535
if: failure()
3636
with:
3737
commit_message: 'ci: auto fixes from pre-commit'
38+
39+
format_and_update_ports:
40+
runs-on: ubuntu-latest
41+
permissions:
42+
contents: write
43+
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v4
47+
with:
48+
token: ${{ secrets.GITHUB_TOKEN }}
49+
ref: ${{ github.head_ref }}
50+
fetch-depth: 2
51+
52+
- name: Setup vcpkg
53+
uses: ./.github/actions/setup-vcpkg
54+
with:
55+
vcpkgVersion: latest
56+
vcpkgRoot: /usr/local/vcpkg
57+
vcpkgDownload: /usr/local/vcpkg-downloads
58+
59+
- name: Format vcpkg.json
60+
run: |
61+
vcpkg format-manifest --all $(find . -name "vcpkg.json")
62+
63+
- name: Commit format vcpkg.json
64+
uses: stefanzweifel/git-auto-commit-action@v5
65+
if: success()
66+
with:
67+
commit_message: 'ci: format vcpkg configuration'
68+
file_pattern: vcpkg.json
69+
70+
- name: Exit 1 if vcpkg configuration changes have been detected
71+
if: steps.auto-commit-action.outputs.changes_detected == 'true'
72+
run: |
73+
exit 1
74+
75+
- name: Install all modules
76+
run: |
77+
for dir in ports/* ; do
78+
echo "Test to install $dir"
79+
vcpkg install ${dir##ports/} --overlay-ports=ports
80+
done
81+
82+
- name: Detect ports changes
83+
id: filter-ports
84+
uses: dorny/paths-filter@v2
85+
with:
86+
list-files: shell
87+
filters: |
88+
ports:
89+
- ports/**
90+
91+
- name: Update versions
92+
if: steps.filter-ports.outputs.ports == 'true'
93+
run: |
94+
for dir in ports/* ; do
95+
vcpkg x-add-version ${dir##ports/} --overlay-ports=./ports \
96+
--x-builtin-registry-versions-dir=./versions/ \
97+
--x-builtin-ports-root=./ports
98+
done
99+
100+
- name: Detect versions changes
101+
if: steps.filter-ports.outputs.ports == 'true'
102+
id: filter-versions
103+
uses: dorny/paths-filter@v2
104+
with:
105+
list-files: shell
106+
base: HEAD
107+
filters: |
108+
versions:
109+
- versions/**
110+
111+
- name: Get last commit message
112+
if: steps.filter-ports.outputs.versions == 'true'
113+
id: last-commit-message
114+
run: |
115+
echo "msg=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
116+
117+
- name: Commit versions
118+
if: steps.filter-versions.outputs.versions == 'true'
119+
uses: stefanzweifel/git-auto-commit-action@v5
120+
with:
121+
file_pattern: versions/*
122+
commit_message: ${{ steps.last-commit-message.outputs.msg }}
123+
push_options: --force
124+
commit_options: --amend --no-edit
125+
skip_fetch: true

0 commit comments

Comments
 (0)