diff options
| author | Steffen Ernst <steffen.ernst@mullvad.net> | 2025-05-13 09:02:08 +0200 |
|---|---|---|
| committer | Bug Magnet <marco.nikic@mullvad.net> | 2025-05-26 16:27:43 +0200 |
| commit | 119926e1bf8f71262c2841f3da37123e81e602b3 (patch) | |
| tree | 1b7a774b699e78a44f61f2b2c6ccf6a3cd200737 | |
| parent | a41a136cd715d9eaa96af81bbbebbb5f37c80a25 (diff) | |
| download | mullvadvpn-119926e1bf8f71262c2841f3da37123e81e602b3.tar.xz mullvadvpn-119926e1bf8f71262c2841f3da37123e81e602b3.zip | |
Refactor ios github actions
| -rw-r--r-- | .github/actions/ios/build-ios-e2e-tests/action.yml (renamed from .github/actions/build-ios-e2e-tests/action.yml) | 0 | ||||
| -rw-r--r-- | .github/actions/ios/configure-xcode/action.yml | 13 | ||||
| -rw-r--r-- | .github/actions/ios/run-ios-e2e-tests/action.yml (renamed from .github/actions/run-ios-e2e-tests/action.yml) | 0 | ||||
| -rw-r--r-- | .github/actions/ios/setup-project-toolchain/action.yml | 67 | ||||
| -rw-r--r-- | .github/workflows/ios-end-to-end-tests.yml | 4 | ||||
| -rw-r--r-- | .github/workflows/ios-screenshots-creation.yml | 30 | ||||
| -rw-r--r-- | .github/workflows/ios-screenshots-tests.yml | 43 | ||||
| -rw-r--r-- | .github/workflows/ios-validate-build-schemas.yml | 50 | ||||
| -rw-r--r-- | .github/workflows/ios.yml | 58 |
9 files changed, 99 insertions, 166 deletions
diff --git a/.github/actions/build-ios-e2e-tests/action.yml b/.github/actions/ios/build-ios-e2e-tests/action.yml index 4d65cfbe36..4d65cfbe36 100644 --- a/.github/actions/build-ios-e2e-tests/action.yml +++ b/.github/actions/ios/build-ios-e2e-tests/action.yml diff --git a/.github/actions/ios/configure-xcode/action.yml b/.github/actions/ios/configure-xcode/action.yml new file mode 100644 index 0000000000..17a1a8b52e --- /dev/null +++ b/.github/actions/ios/configure-xcode/action.yml @@ -0,0 +1,13 @@ +name: 'Setup and configure Xcode' +runs: + using: 'composite' + steps: + - name: Setup Xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '16.1' + + - name: Configure Xcode project + run: | + for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done + working-directory: ios/Configurations
\ No newline at end of file diff --git a/.github/actions/run-ios-e2e-tests/action.yml b/.github/actions/ios/run-ios-e2e-tests/action.yml index 9e9b077c26..9e9b077c26 100644 --- a/.github/actions/run-ios-e2e-tests/action.yml +++ b/.github/actions/ios/run-ios-e2e-tests/action.yml diff --git a/.github/actions/ios/setup-project-toolchain/action.yml b/.github/actions/ios/setup-project-toolchain/action.yml new file mode 100644 index 0000000000..4334b22d2c --- /dev/null +++ b/.github/actions/ios/setup-project-toolchain/action.yml @@ -0,0 +1,67 @@ +name: 'Setup project toolchain' +description: 'Setup Xcode project and install toolchain' +inputs: + ios_rust_target: + description: 'iOS target device' + type: choice + options: + - aarch64-apple-ios-sim + - aarch64-apple-ios + required: true + commit_hash: + type: string + required: false + +runs: + using: 'composite' + steps: + - name: Set commit hash or default to github.sha + id: set-commit-hash + run: | + # If the input has a value, it is filled by that value; otherwise, use github.sha + if [ -n "${{ inputs.commit_hash }}" ]; then + echo "COMMIT_HASH=${{ inputs.commit_hash }}" >> $GITHUB_ENV + else + echo "COMMIT_HASH=${{ github.sha }}" >> $GITHUB_ENV + fi + shell: bash + + - name: Checkout repository + uses: actions/checkout@v4 + with: + clean: true + ref: ${{ env.COMMIT_HASH }} + + - name: Checkout submodules + run: | + git config --global --add safe.directory '*' + git submodule update --init --recursive ios/wireguard-apple + + - name: Configure cache + uses: actions/cache@v3 + with: + path: ios/${{ env.SOURCE_PACKAGES_PATH }} + key: ${{ runner.os }}-spm-${{ hashFiles('ios/**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm- + + - name: Setup go-lang + uses: actions/setup-go@v3 + with: + go-version: 1.21.13 + + - name: Configure Rust + run: rustup target add ${{ inputs.ios_rust_target }} + + - name: Install xcbeautify + run: | + brew update + brew install xcbeautify + + - name: Install protobuf + run: | + brew update + brew install protobuf + + - name: Configure Xcode project + run: uses ./.github/actions/ios/configure-xcode
\ No newline at end of file diff --git a/.github/workflows/ios-end-to-end-tests.yml b/.github/workflows/ios-end-to-end-tests.yml index 496b8bb58c..8c9a8d13d0 100644 --- a/.github/workflows/ios-end-to-end-tests.yml +++ b/.github/workflows/ios-end-to-end-tests.yml @@ -107,7 +107,7 @@ jobs: run: rustup target add aarch64-apple-ios - name: Build iOS end to end tests action - uses: ./.github/actions/build-ios-e2e-tests + uses: ./.github/actions/ios/build-ios-e2e-tests with: test_name: ${{ github.event.inputs.user_supplied_test_name }} ios_device_pin_code: ${{ secrets.IOS_DEVICE_PIN_CODE }} @@ -149,7 +149,7 @@ jobs: test_suite: ${{fromJson(needs.define-test-suites-matrix.outputs.test_suites_json)}} steps: - name: Run iOS end to end tests action - uses: ./.github/actions/run-ios-e2e-tests + uses: ./.github/actions/ios/run-ios-e2e-tests with: test_name: "MullvadVPNUITests/${{ matrix.test_suite }}" test_device_udid: ${{ env.TEST_DEVICE_UDID }} diff --git a/.github/workflows/ios-screenshots-creation.yml b/.github/workflows/ios-screenshots-creation.yml index 289d0278e5..3e0e387e27 100644 --- a/.github/workflows/ios-screenshots-creation.yml +++ b/.github/workflows/ios-screenshots-creation.yml @@ -19,30 +19,15 @@ jobs: env: SOURCE_PACKAGES_PATH: .spm TEST_ACCOUNT: ${{ secrets.IOS_TEST_ACCOUNT_NUMBER }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Checkout submodules - run: | - git config --global --add safe.directory '*' - git submodule update --init --recursive ios/wireguard-apple - - - name: Setup go-lang - uses: actions/setup-go@v3 - with: - go-version: 1.21.13 - - name: Configure Xcode - uses: maxim-lobanov/setup-xcode@v1 + steps: + - name: Setup project + uses: ./.github/actions/ios/setup-project-toolchain with: - xcode-version: '16.1' - - name: Configure Rust - run: rustup target add aarch64-apple-ios-sim x86_64-apple-ios + ios_rust_target: aarch64-apple-ios-sim - - name: Configure Xcode project + - name: Add test account to config run: | - for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done sed -i "" \ "/HAS_TIME_ACCOUNT_NUMBER =/ s#= .*#= 1234123412341234#" \ UITests.xcconfig @@ -52,11 +37,6 @@ jobs: run: bundle install working-directory: ios - - name: Install protobuf - run: | - brew update - brew install protobuf - - name: Create screenshots run: bundle exec fastlane snapshot --cloned_source_packages_path "$SOURCE_PACKAGES_PATH" working-directory: ios diff --git a/.github/workflows/ios-screenshots-tests.yml b/.github/workflows/ios-screenshots-tests.yml index 74589e8f0a..7c0311f8ac 100644 --- a/.github/workflows/ios-screenshots-tests.yml +++ b/.github/workflows/ios-screenshots-tests.yml @@ -23,38 +23,15 @@ jobs: env: SOURCE_PACKAGES_PATH: .spm TEST_ACCOUNT: ${{ secrets.IOS_TEST_ACCOUNT_NUMBER }} + steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Checkout submodules - run: | - git config --global --add safe.directory '*' - git submodule update --init --recursive ios/wireguard-apple - - - name: Configure cache - uses: actions/cache@v3 - with: - path: ios/${{ env.SOURCE_PACKAGES_PATH }} - key: ${{ runner.os }}-spm-${{ hashFiles('ios/**/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-spm- - - - name: Setup go-lang - uses: actions/setup-go@v3 - with: - go-version: 1.21.13 - - - name: Configure Xcode - uses: maxim-lobanov/setup-xcode@v1 + - name: Setup project + uses: ./.github/actions/ios/setup-project-toolchain with: - xcode-version: '16.1' - - name: Configure Rust - run: rustup target add aarch64-apple-ios-sim + ios_rust_target: aarch64-apple-ios-sim - - name: Configure Xcode project + - name: Add test account to config run: | - for file in *.xcconfig.template ; do cp $file ${file//.template/} ; done sed -i "" \ "/HAS_TIME_ACCOUNT_NUMBER =/ s#= .*#= 1234123412341234#" \ UITests.xcconfig @@ -65,16 +42,6 @@ jobs: brew update brew install zip - - name: Install xcbeautify - run: | - brew update - brew install xcbeautify - - - name: Install protobuf - run: | - brew update - brew install protobuf - - name: Run screenshot tests run: | set -o pipefail && env NSUnbufferedIO=YES xcodebuild \ diff --git a/.github/workflows/ios-validate-build-schemas.yml b/.github/workflows/ios-validate-build-schemas.yml index c73a66d13b..4fe5cc9d5d 100644 --- a/.github/workflows/ios-validate-build-schemas.yml +++ b/.github/workflows/ios-validate-build-schemas.yml @@ -24,54 +24,12 @@ jobs: runs-on: macos-15-xlarge env: SOURCE_PACKAGES_PATH: .spm - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Checkout submodules - run: | - git config --global --add safe.directory '*' - git submodule update --init --recursive ios/wireguard-apple - - - name: Configure cache - uses: actions/cache@v3 - with: - path: ios/${{ env.SOURCE_PACKAGES_PATH }} - key: ${{ runner.os }}-spm-${{ hashFiles('ios/**/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-spm- - - - name: Setup go-lang - uses: actions/setup-go@v3 - with: - go-version: 1.21.13 - - name: Configure Xcode - uses: maxim-lobanov/setup-xcode@v1 + steps: + - name: Setup project + uses: ./.github/actions/ios/setup-project-toolchain with: - xcode-version: '16.1' - - name: Configure Rust - run: rustup target add aarch64-apple-ios-sim x86_64-apple-ios - - - name: Configure Xcode project - run: | - cp Base.xcconfig.template Base.xcconfig - cp App.xcconfig.template App.xcconfig - cp PacketTunnel.xcconfig.template PacketTunnel.xcconfig - cp Screenshots.xcconfig.template Screenshots.xcconfig - cp Api.xcconfig.template Api.xcconfig - cp UITests.xcconfig.template UITests.xcconfig - working-directory: ios/Configurations - - - name: Install xcbeautify - run: | - brew update - brew install xcbeautify - - - name: Install protobuf - run: | - brew update - brew install protobuf + ios_rust_target: aarch64-apple-ios-sim - name: Run build validation for Staging and MockRelease configurations as well as the MullvadVPNUITests target run: | diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 9c0bbc6f01..ecdad1e4e2 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -52,62 +52,10 @@ jobs: env: SOURCE_PACKAGES_PATH: .spm steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Checkout submodules - run: | - git config --global --add safe.directory '*' - git submodule update --init --recursive ios/wireguard-apple - - - - name: Configure cache - uses: actions/cache@v3 - with: - path: ios/${{ env.SOURCE_PACKAGES_PATH }} - key: ${{ runner.os }}-spm-${{ hashFiles('ios/**/Package.resolved') }} - restore-keys: | - ${{ runner.os }}-spm- - - - name: Setup go-lang - uses: actions/setup-go@v3 + - name: Setup project + uses: ./.github/actions/ios/setup-project-toolchain with: - go-version: 1.21.13 - - - name: Install xcbeautify - run: | - brew update - brew install xcbeautify - - - name: Install protobuf - run: | - brew update - brew install protobuf - - - name: Configure Xcode - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '16.1' - - name: Configure Rust - # Since the https://github.com/actions/runner-images/releases/tag/macos-13-arm64%2F20240721.1 release - # Brew does not install tools at the correct location anymore - # This update broke the rust build script which was assuming the cargo binary was located in ~/.cargo/bin/cargo - # The workaround is to fix brew paths by running brew bundle dump, and then brew bundle - # WARNING: This has to be the last brew "upgrade" commands that is ran, - # otherwise the brew path will be broken again. - run: | - brew bundle dump - brew bundle - rustup target add aarch64-apple-ios-sim - - - name: Configure Xcode project - run: | - cp Base.xcconfig.template Base.xcconfig - cp App.xcconfig.template App.xcconfig - cp PacketTunnel.xcconfig.template PacketTunnel.xcconfig - cp Screenshots.xcconfig.template Screenshots.xcconfig - cp Api.xcconfig.template Api.xcconfig - working-directory: ios/Configurations + ios_rust_target: aarch64-apple-ios-sim - name: Run unit tests run: | |
