Skip to content

Commit

Permalink
add env for allure
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisLys committed Dec 3, 2024
1 parent 030ddbc commit 18eed58
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions scripts/create_allure_environment.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 18eed58

Please sign in to comment.