Skip to content

[Infra] certification file changed #23

[Infra] certification file changed

[Infra] certification file changed #23

Workflow file for this run

name: unitTest
on:
push:
branches: [ "develop" ]
pull_request:
jobs:
run-unitTest:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Mise
run: |
curl https://mise.run | sh
mise install
- name: Install Tuist dependencies
run: mise x -- tuist install
- name: Generate Xcworkspace
run: mise x -- tuist generate
- name: Run unit tests
run: |
xcodebuild test -scheme three-days-UnitTest -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' | tee result.log
continue-on-error: true
- name: Parse test results
id: parse_test_results
run: |
TOTAL_TESTS=$(grep -oE 'Test Suite .* executed ([0-9]+) tests' result.log | grep -oE '[0-9]+' | head -n 1)
FAILED_TESTS=$(grep -oE 'Failing tests:.*' -A 20 result.log | grep -oE '[0-9]+' | head -n 1)
FAILED_TEST_NAMES=$(grep -oE '^[[:space:]]+[0-9]+\) (.*)' result.log | awk '{$1=""; print $0}')
echo "Total tests: $TOTAL_TESTS"
echo "Failed tests: $FAILED_TESTS"
echo "Failed test names: $FAILED_TEST_NAMES"
echo "TOTAL_TESTS=$TOTAL_TESTS" >> $GITHUB_ENV
echo "FAILED_TESTS=$FAILED_TESTS" >> $GITHUB_ENV
echo "FAILED_TEST_NAMES=$FAILED_TEST_NAMES" >> $GITHUB_ENV
- name: Notify Discord
if: ${{ always() }}
run: |
if [ "${{ env.FAILED_TESTS }}" -eq "0" ]; then
MESSAGE="All tests passed! Total tests: ${{ env.TOTAL_TESTS }}"
else
MESSAGE="Some tests failed. Total tests: ${{ env.TOTAL_TESTS }}, Failed tests: ${{ env.FAILED_TESTS }}. Failed tests: ${{ env.FAILED_TEST_NAMES }}"
fi
curl -H "Content-Type: application/json" \
-d "{\"content\": \"$MESSAGE\"}" \
-X POST ${{ secrets.DISCORD_WEBHOOK_URL }}