Skip to content

Commit 9f836fd

Browse files
committed
WIP: Add sync check
1 parent 3471925 commit 9f836fd

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Sync shared Freedesktop SDK files
2+
inputs:
3+
fsdk-element:
4+
description: Freedesktop SDK BuildStream element
5+
default: freedesktop-sdk.bst
6+
outputs:
7+
fsdk-element:
8+
description: Freedesktop SDK BuildStream element
9+
value: ${{ inputs.fsdk-element }}
10+
version:
11+
description: Version of Freedesktop SDK
12+
value: ${{ steps.sync.outputs.version }}
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Parse ref
17+
id: parse-ref
18+
shell: bash
19+
run: |
20+
python .github/scripts/parse-bst-git-tag-ref.py elements/${{ inputs.fsdk-element }}
21+
22+
- name: Sync shared files
23+
id: sync
24+
shell: bash
25+
run: |
26+
git clone --branch=${{ steps.parse-ref.outputs.tag }} --depth=1 https://gitlab.com/freedesktop-sdk/freedesktop-sdk
27+
28+
for file in elements/plugins/*; do
29+
if [ -f "freedesktop-sdk/$file" ]; then
30+
cp freedesktop-sdk/$file $file
31+
else
32+
rm $file
33+
fi
34+
done
35+
36+
cp freedesktop-sdk/include/strip.yml include/strip.yml
37+
sed -i "s/strip-binaries/strip-binaries-base/g" include/strip.yml
38+
39+
tag="${{ steps.parse-ref.outputs.tag }}"
40+
prefix="freedesktop-sdk-"
41+
version="${tag#$prefix}"
42+
43+
echo "version=$version" >> $GITHUB_OUTPUT

.github/workflows/check-code.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,37 @@ jobs:
2929
uses: astral-sh/ruff-action@v3
3030
with:
3131
args: "format --check"
32+
33+
fsdk:
34+
name: Re-sync shared files
35+
runs-on: ubuntu-24.04
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
41+
42+
- name: Check for Changed Files
43+
id: check
44+
uses: obsproject/obs-studio/.github/actions/check-changes@19646f9434857120625524fbf15f254efa1afecc
45+
with:
46+
checkGlob: "'${{ env.WORKFLOW_FILEPATH }}' 'elements/plugins/*' 'elements/freedesktop-sdk.bst' 'include/strip.yml'"
47+
diffFilter: 'ACM'
48+
49+
- name: Sync shared Freedesktop SDK files
50+
id: sync
51+
if: ${{ fromJSON(steps.check.outputs.hasChangedFiles) }}
52+
uses: ./.github/actions/sync-shared-fsdk-files
53+
54+
- name: Check files have changed
55+
if: ${{ !cancelled() && fromJSON(steps.check.outputs.hasChangedFiles) }}
56+
shell: bash
57+
run: |
58+
: Check if the element has changed
59+
60+
if [[ -z "$(git status --porcelain" ]]; then
61+
echo "::notice::Files are in sync"
62+
else
63+
echo "::error::Files are not in sync"
64+
exit 2
65+
fi

0 commit comments

Comments
 (0)