-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions workflow to verify NIC files match source (#35)
* Update iphone_preference_bundle.nic.tar to pass integrity_check.sh
- Loading branch information
1 parent
78f54b9
commit 6075a85
Showing
3 changed files
with
63 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: NIC Integrity | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
env: | ||
THEOS: ${{ github.workspace }}/theos | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
path: templates | ||
|
||
- name: Checkout theos/theos | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: theos/theos | ||
submodules: recursive | ||
path: ${{ env.THEOS }} | ||
|
||
- name: Check | ||
run: | | ||
cd templates | ||
./integrity_check.sh |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
WORKSPACE_DIR=$(mktemp -d --tmpdir='' "templates.XXXXXXXXXX") | ||
TEMPLATES_DIR=$(pwd) | ||
|
||
# For each directory containing a valid NIC templates' source | ||
TEMPLATES_SOURCES=$(find "${TEMPLATES_DIR}" -type d -name NIC -exec dirname {} \;) | ||
|
||
cd "${WORKSPACE_DIR}" | ||
|
||
EXIT_CODE=0 | ||
|
||
for TEMPLATES_SOURCE in $TEMPLATES_SOURCES; do | ||
"${THEOS}/bin/nicify.pl" "${TEMPLATES_SOURCE}" 2> /dev/null | ||
RESULT_FILE=$(ls *.nic.tar) | ||
EXTRACT_DIR=$(mktemp -d -p . "${RESULT_FILE}.XXXXXXXXXX") | ||
tar -xf "${TEMPLATES_DIR}/${RESULT_FILE}" -C "${EXTRACT_DIR}" | ||
# thanks to https://stackoverflow.com/a/49633090 | ||
if ! diff -r --no-dereference --brief -x '.keep' "${TEMPLATES_SOURCE}" "${EXTRACT_DIR}"; then | ||
EXIT_CODE=1 | ||
# per https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables | ||
if [[ "${GITHUB_ACTIONS}" = "true" ]]; then | ||
# per https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message | ||
echo "::error file=${RESULT_FILE},title=Mismatch::The NIC file does not match the template directory" | ||
fi | ||
fi | ||
rm -r "${EXTRACT_DIR}" | ||
rm "${RESULT_FILE}" | ||
done | ||
|
||
rm -r "${WORKSPACE_DIR}" | ||
|
||
exit "${EXIT_CODE}" |
Binary file not shown.