From 18eed58418adb7eeee433d79d91c81389da926cf Mon Sep 17 00:00:00 2001 From: Boris Lysikov Date: Tue, 3 Dec 2024 22:17:12 +0700 Subject: [PATCH] add env for allure --- .github/workflows/test.yaml | 28 ++++++++++++++++------------ scripts/create_allure_environment.sh | 12 ++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 scripts/create_allure_environment.sh diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 99b408f..8fd6248 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,6 +26,8 @@ env: DERIVED_DATA_PATH: 'DerivedData' TEST_RESULTS: './TestResults.xcresult' ALLURE_RESULTS: 'allure-results' + SIMULATOR_VERSION: '18.0' + SIMULATOR_NAME: 'iPhone 16' jobs: build: @@ -36,24 +38,15 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 -# - name: Cache Derived Data -# uses: actions/cache@v4 -# with: -# path: TestData/DerivedData -# key: ${{ runner.os }}-deriveddata-${{ github.sha }} -# restore-keys: | -# ${{ runner.os }}-deriveddata- - - name: Build Project id: build -# if: steps.cache-step.outputs.cache-hit != 'true' run: | set -o pipefail xcodebuild build-for-testing \ -project ${{ env.PROJECT }} \ -scheme ${{ env.SCHEME }} \ -derivedDataPath ${{ env.DERIVED_DATA_PATH }} \ - -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.0' \ + -destination 'platform=iOS Simulator,name=${{ env.SIMULATOR_NAME }},OS=${{ env.SIMULATOR_VERSION }}' \ CODE_SIGNING_ALLOWED='NO' mkdir TestData @@ -96,22 +89,33 @@ jobs: if [ -z "${{ github.event.inputs.test_plan_type }}" ]; then xcodebuild test-without-building \ -xctestrun DerivedData/Build/Products/SwiftRadioUITests_Regression_iphonesimulator18.0-arm64.xctestrun \ - -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.0' \ + -destination 'platform=iOS Simulator,name=${{ env.SIMULATOR_NAME }},OS=${{ env.SIMULATOR_VERSION }}' \ -resultBundlePath ./TestResults.xcresult else xcodebuild test-without-building \ -xctestrun DerivedData/Build/Products/SwiftRadioUITests_${{ github.event.inputs.test_plan_type }}_iphonesimulator18.0-arm64.xctestrun \ - -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.0' \ + -destination 'platform=iOS Simulator,name=${{ env.SIMULATOR_NAME }},OS=${{ env.SIMULATOR_VERSION }}' \ -resultBundlePath ./TestResults.xcresult fi continue-on-error: true + - name: Set env for allure + run: | + MARKETING_VERSION=$(xcodebuild -showBuildSettings | grep MARKETING_VERSION | awk '{print $3}') + echo "MARKETING_VERSION=$MARKETING_VERSION" >> $GITHUB_ENV + BUILD_VERSION=$(xcodebuild -showBuildSettings | grep CURRENT_PROJECT_VERSION | awk '{print $3}') + echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV + ALLURE_VERSION=$(allure --version) + echo "ALLURE_VERSION=$ALLURE_VERSION" >> $GITHUB_ENV + - name: Generate Allure files run: | mkdir ${{ env.ALLURE_RESULTS }} ./xcresults export TestResults.xcresult -o ${{ env.ALLURE_RESULTS }} chmod +x scripts/testOpsReportFormatter.sh scripts/testOpsReportFormatter.sh + chmod +x scripts/create_allure_environment.sh + scripts/create_allure_environment.sh mkdir allure-report allure generate ${{ env.ALLURE_RESULTS }} --report-dir allure-report diff --git a/scripts/create_allure_environment.sh b/scripts/create_allure_environment.sh new file mode 100644 index 0000000..9b9e5f1 --- /dev/null +++ b/scripts/create_allure_environment.sh @@ -0,0 +1,12 @@ +OUTPUT_FILE="allure-results/environment.properties" + +# Создание и заполнение файла +echo "release_version = $MARKETING_VERSION" > $OUTPUT_FILE +echo "build_version = $BUILD_VERSION" >> $OUTPUT_FILE +echo "os_version = $SIMULATOR_VERSION" >> $OUTPUT_FILE +echo "simulator_model = $SIMULATOR_NAME" >> $OUTPUT_FILE +echo "allure_version = $ALLURE_VERSION" >> $OUTPUT_FILE + +# Вывод результата +echo "Файл $OUTPUT_FILE успешно создан:" +cat $OUTPUT_FILE