mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-12 03:27:55 +00:00
feat: update preset validator to validate against older generated presets
This commit is contained in:
108
.github/workflows/check_profiles.yml
vendored
108
.github/workflows/check_profiles.yml
vendored
@@ -63,11 +63,109 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
working-directory: ${{ github.workspace }}
|
working-directory: ${{ github.workspace }}
|
||||||
run: |
|
run: |
|
||||||
set +e
|
fixtures_dir="${{ runner.temp }}/profile-fixtures"
|
||||||
curl -LJO https://github.com/OrcaSlicer/OrcaSlicer/releases/download/nightly-builds/orca_custom_preset_tests.zip
|
output_dir="${{ runner.temp }}/custom-preset-validation"
|
||||||
unzip -q ./orca_custom_preset_tests.zip -d ${{ github.workspace }}/resources/profiles
|
combined_log="${{ runner.temp }}/validate_custom.log"
|
||||||
./OrcaSlicer_profile_validator -p ${{ github.workspace }}/resources/profiles -l 2 2>&1 | tee ${{ runner.temp }}/validate_custom.log
|
summary="${output_dir}/summary.md"
|
||||||
exit ${PIPESTATUS[0]}
|
release_url="https://github.com/OrcaSlicer/OrcaSlicer-profile-validator/releases/download/fixture-archive"
|
||||||
|
|
||||||
|
rm -rf "${fixtures_dir}" "${output_dir}"
|
||||||
|
mkdir -p "${fixtures_dir}" "${output_dir}"
|
||||||
|
|
||||||
|
curl -fsSL -o "${fixtures_dir}/manifest.json" "${release_url}/manifest.json"
|
||||||
|
|
||||||
|
MANIFEST_PATH="${fixtures_dir}/manifest.json" python3 <<'PY' > "${fixtures_dir}/fixtures.tsv"
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
with open(os.environ["MANIFEST_PATH"], encoding="utf-8") as fh:
|
||||||
|
manifest = json.load(fh)
|
||||||
|
|
||||||
|
if isinstance(manifest, dict):
|
||||||
|
entries = manifest.get("fixtures", [])
|
||||||
|
else:
|
||||||
|
entries = manifest
|
||||||
|
|
||||||
|
for entry in entries:
|
||||||
|
version = entry.get("version", "")
|
||||||
|
asset = entry.get("asset", "")
|
||||||
|
sha256 = entry.get("asset_sha256", "")
|
||||||
|
if not version or not asset:
|
||||||
|
continue
|
||||||
|
print(f"{version}\t{asset}\t{sha256}")
|
||||||
|
PY
|
||||||
|
|
||||||
|
if [ ! -s "${fixtures_dir}/fixtures.tsv" ]; then
|
||||||
|
echo "No custom preset fixtures found in ${release_url}/manifest.json" | tee "${combined_log}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "## Custom Preset Fixture Validation"
|
||||||
|
echo ""
|
||||||
|
echo "| Version | Status | Log |"
|
||||||
|
echo "| --- | --- | --- |"
|
||||||
|
} > "${summary}"
|
||||||
|
|
||||||
|
status=0
|
||||||
|
failed_logs=()
|
||||||
|
|
||||||
|
while IFS=$'\t' read -r version asset expected_sha256; do
|
||||||
|
fixture_zip="${fixtures_dir}/${asset}"
|
||||||
|
asset_url_name="$(python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1], safe=""))' "${asset}")"
|
||||||
|
profile_tree="${output_dir}/profiles-${version}"
|
||||||
|
log_path="${output_dir}/${version}.log"
|
||||||
|
|
||||||
|
curl -fsSL -o "${fixture_zip}" "${release_url}/${asset_url_name}"
|
||||||
|
|
||||||
|
if [ -n "${expected_sha256}" ] && [ "${expected_sha256}" != "<sha256>" ]; then
|
||||||
|
echo "${expected_sha256} ${fixture_zip}" | sha256sum -c -
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "${profile_tree}"
|
||||||
|
mkdir -p "${profile_tree}"
|
||||||
|
cp -a "${{ github.workspace }}/resources/profiles/." "${profile_tree}/"
|
||||||
|
rm -rf "${profile_tree}/user"
|
||||||
|
unzip -q "${fixture_zip}" -d "${profile_tree}"
|
||||||
|
|
||||||
|
set +e
|
||||||
|
./OrcaSlicer_profile_validator -p "${profile_tree}" -l 2 > "${log_path}" 2>&1
|
||||||
|
result=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "${result}" -eq 0 ]; then
|
||||||
|
echo "| ${version} | PASS | ${version}.log |" >> "${summary}"
|
||||||
|
else
|
||||||
|
echo "| ${version} | FAIL | ${version}.log |" >> "${summary}"
|
||||||
|
failed_logs+=("${log_path}")
|
||||||
|
status=1
|
||||||
|
fi
|
||||||
|
done < "${fixtures_dir}/fixtures.tsv"
|
||||||
|
|
||||||
|
{
|
||||||
|
cat "${summary}"
|
||||||
|
if [ "${#failed_logs[@]}" -gt 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "## Failed Fixture Logs"
|
||||||
|
for log_path in "${failed_logs[@]}"; do
|
||||||
|
echo ""
|
||||||
|
echo "### $(basename "${log_path}" .log)"
|
||||||
|
echo '```'
|
||||||
|
head -c 12000 "${log_path}" || echo "No output captured"
|
||||||
|
echo '```'
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
} | tee "${combined_log}"
|
||||||
|
|
||||||
|
exit "${status}"
|
||||||
|
|
||||||
|
- name: Upload custom preset validation logs
|
||||||
|
if: ${{ always() }}
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: custom-preset-validation-logs
|
||||||
|
path: ${{ runner.temp }}/custom-preset-validation/
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
- name: Prepare PR number for comment workflow
|
- name: Prepare PR number for comment workflow
|
||||||
if: ${{ always() && github.event_name == 'pull_request' }}
|
if: ${{ always() && github.event_name == 'pull_request' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user