Skip to content

fix build to use more recent plistlib #128

fix build to use more recent plistlib

fix build to use more recent plistlib #128

Workflow file for this run

name: Screenshot
on:
push:
branches: [ main ]
workflow_dispatch: {}
jobs:
screenshot:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Dismiss upgrade dialog if present
run: |
for opt in AutomaticCheckEnabled AutomaticDownload AutomaticallyInstallMacOSUpdates; do
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate "$opt" -boolean FALSE
done
- name: Set dark mode
if: false
run: |
sudo osascript -e 'tell app "System Events" to tell appearance preferences to set dark mode to true'
- name: Get screen resolution
run: |
printf '::notice title=resolution::%s\n' "$(system_profiler SPDisplaysDataType | grep Resolution | sed 's/.*: *//')"
- name: Install xcparse
run: brew install chargepoint/xcparse/xcparse
- name: Save current time zone
# Save the current time zone.
# systemsetup returns e.g. "Time Zone: US/New_York", and we just
# want the "US/New_York" bit.
id: initial
run: 'echo "::set-output name=timezone::$(sudo systemsetup -gettimezone | cut -d " " -f 3)"'
- name: Set time zone
run: |
# Find a time zone such that it's 6 or 7pm.
# (tail -n +2 drops the first line, which is a header)
for tz in $(sudo systemsetup -listtimezones | tail -n +2); do
sudo systemsetup -settimezone "$tz"
now_hr="$(date +%H)"
if [[ $now_hr -ge 18 && $now_hr -le 19 ]]; then
break
fi
done
- name: Build and run screenshot generator
run: xcodebuild clean test -scheme whatdid-ui-test -only-testing whatdidUITests/ScreenshotGenerator -resultBundlePath ${{ runner.temp }}/test-results/bundle
- name: Restore time zone
if: ${{ always() }}
run: |
sudo systemsetup -settimezone "${{ steps.initial.outputs.timezone }}"
- name: Gather screenshots
if: ${{ always() }}
run: |
mkdir -p "${{ runner.temp }}/screenshots/all"
mkdir -p "${{ runner.temp }}/screenshots/export/screenshots-${{ github.run_number }}"
# export the screenshots, organized by test
xcparse screenshots --test '${{ runner.temp }}/test-results/bundle' '${{ runner.temp }}/screenshots/all'
for screenshot_file in $(find '${{ runner.temp }}/screenshots/all/ScreenshotGenerator' -name '*.png' -or -name '*.jpg'); do
# screenshot_file will be something like:
# .../screenshots/ScreenshotGenerator/testDailyReport()/daily-report_1_1A98890B-2184-400D-97D2-A5B51E3B25FB.png
# We want to turn that into t just "daily-report.png"
short_name="$(basename "$screenshot_file" | sed 's/_.*\.png$/.png/')"
if [[ -f "${{ runner.temp }}/screenshots/export/$short_name" ]]; then
# This guards against a bug where multiple actions write to the same simple name.
# In that case, just use the original, uuid'd name.
short_name="$(basename "$screenshot_file")"
fi
mv "$screenshot_file" "${{ runner.temp }}/screenshots/export/screenshots-${{ github.run_number }}/$short_name"
done
- name: Upload screenshots
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: screenshots-${{ github.run_number }}
path: ${{ runner.temp }}/screenshots/export
- name: Gather logs (if failed)
if: ${{ failure() }}
run: |
mkdir "${{ runner.temp }}/export"
mv "$(readlink ${{ runner.temp }}/test-results/bundle)" "${{ runner.temp }}/export/whatdid-uitest-failures-${{ github.run_number }}.xcresult"
- name: Upload test artifacts (if failed)
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: whatdid-ui-tests-${{ github.run_number }}
path: ${{ runner.temp }}/export