Skip to content

Commit

Permalink
WIP: fix: CI jobs for ios/android e2e-tests
Browse files Browse the repository at this point in the history
Signed-off-by: clegirar <clemntgirard@gmail.com>
  • Loading branch information
clegirar committed Jan 10, 2023
1 parent adc993f commit 00f9fc5
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 16 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: e2e-tests
on:
push:
tags:
- v*
branches:
- master
paths:
- "go/**"
- "!go/**.md"
- "go.*"
- "**.go"
- "js/**"
- ".github/workflows/ios.yml"
pull_request:
paths:
- "go/**"
- "!go/**.md"
- "go.*"
- "**.go"
- "js/**"
- "!js/packages/i18n/locale/*/*.json"
- ".github/workflows/ios.yml"
workflow_run:
workflows: ["Android", "iOS"]
types:
- completed
jobs:
build:
name: e2e-tests
runs-on: ${{ matrix.runner }}
env:
E2E_TESTING_IOS_DEVICE: iPhone 11
E2E_TESTING_IOS_VERSION: 15.5
CACHE_DIRS: js/android/.gomobile-cache; js/ios/.gomobile-cache; js/ios/.xcodegen-cache
strategy:
fail-fast: false
matrix: ${{fromJson(needs.mac_runner_matrix_builder.outputs.matrix)}}
steps:
- name: Run e2e-tests
working-directory: js
run: |
make e2e-tests.ci-flow
20 changes: 7 additions & 13 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ jobs:
asdf install yarn
- name: Get XCode version from version file
run:
echo "xcode_version=$(cat js/ios/.xcode-version)" >> $GITHUB_ENV
run: echo "xcode_version=$(cat js/ios/.xcode-version)" >> $GITHUB_ENV

- name: Setup XCode version (Github runners)
# Disabled on self-hosted because it requires authentication
Expand All @@ -150,21 +149,21 @@ jobs:
uses: actions/cache@v2.1.6
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('go/**/go.sum') }}
key: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-${{ hashFiles('go/**/go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ env.go_version }}-${{ env.json_cache-versions_go }}-

- name: Cache ruby modules
uses: actions/cache@v2.1.6
with:
path: js/ios/vendor/bundle
key: ${{ runner.os }}-ruby-${{ env.ruby_version }}-${{ env.json_cache-versions_ruby }}-${{ hashFiles('js/ios/Gemfile*') }}
key: ${{ runner.os }}-ruby-${{ env.ruby_version }}-${{ env.json_cache-versions_ruby }}-${{ hashFiles('js/ios/Gemfile*') }}
restore-keys: ${{ runner.os }}-ruby-${{ env.ruby_version }}-${{ env.json_cache-versions_ruby }}-

- name: Cache node modules
uses: actions/cache@v2.1.6
with:
path: js/node_modules
key: ${{ runner.OS }}-node-${{ env.node_version }}-${{ env.json_cache-versions_node }}-${{ hashFiles('js/yarn.lock') }}
key: ${{ runner.OS }}-node-${{ env.node_version }}-${{ env.json_cache-versions_node }}-${{ hashFiles('js/yarn.lock') }}
restore-keys: ${{ runner.OS }}-node-${{ env.node_version }}-${{ env.json_cache-versions_node }}-

- name: Cache Bertybridge framework
Expand Down Expand Up @@ -193,7 +192,7 @@ jobs:
path: |
js/ios/Berty.xcodeproj
js/ios/.xcodegen-cache
key: ios-xcodeproject-${{ env.xcodegen_version }}-${{ env.json_cache-versions_xcodeproject }}-${{ hashFiles('js/ios/*.yaml') }}
key: ios-xcodeproject-${{ env.xcodegen_version }}-${{ env.json_cache-versions_xcodeproject }}-${{ hashFiles('js/ios/*.yaml') }}
restore-keys: ios-xcodeproject-${{ env.xcodegen_version }}-${{ env.json_cache-versions_xcodeproject }}-

- name: Cache Pods and XCode workspace
Expand All @@ -202,7 +201,7 @@ jobs:
path: |
js/ios/Berty.xcworkspace
js/ios/Pods
key: ios-xcodeworkspace-${{ env.ruby_version }}-${{ env.json_cache-versions_xcodeworkspace }}-${{ hashFiles('js/ios/Podfile.lock', 'js/ios/Gemfile*', 'js/yarn.lock') }}
key: ios-xcodeworkspace-${{ env.ruby_version }}-${{ env.json_cache-versions_xcodeworkspace }}-${{ hashFiles('js/ios/Podfile.lock', 'js/ios/Gemfile*', 'js/yarn.lock') }}
restore-keys: ios-xcodeworkspace-${{ env.ruby_version }}-${{ env.json_cache-versions_xcodeworkspace }}-

- name: Fetch node modules
Expand All @@ -219,16 +218,11 @@ jobs:
working-directory: js
run: GOMOBILE_IOS_TARGET=iossimulator make ios.gomobile

- name: Build the app for e2e testing
- name: Build iOS app for e2e testing
working-directory: js/ios
run: |
xcodebuild \
-workspace Berty.xcworkspace \
-configuration "AppStore Release" \
-scheme "Berty AppStore" \
-destination "name=$E2E_TESTING_IOS_DEVICE"
- name: Run e2e-tests
working-directory: js
run: |
make e2e-tests.ci-flow
5 changes: 3 additions & 2 deletions js/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ YOLO_SUFFIX ?= Yolo
E2E_TESTING_IOS_DEVICE ?= iPhone 11
E2E_TESTING_IOS_VERSION ?= 15.5
E2E_GET_IOS_APP ?= $(shell ls -ladt1 "$(HOME)/Library/Developer/Xcode/DerivedData/"*"/Build/Products/AppStore Release-iphonesimulator/Berty.app" | head -n 1)

E2E_GET_ANDROID_APP ?= $(shell ls -ladt1 "$(HOME)/.android/app/build/outputs/apk/debug/app-x86-debug.apk")
## Internal variables

rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
Expand Down Expand Up @@ -92,6 +92,7 @@ e2e-tests.tests:
IOS_DEVICE="$(E2E_TESTING_IOS_DEVICE)" \
IOS_APP="$(if $(IOS_APP),$(IOS_APP),$(E2E_GET_IOS_APP))" \
IOS_VERSION="$(E2E_TESTING_IOS_VERSION)" \
ANDROID_APP="$(if $(ANDROID_APP),$(ANDROID_APP),$(E2E_GET_ANDROID_APP))" \
cd e2e-tests && npm test

.PHONY: e2e-tests.ci-flow
Expand All @@ -100,7 +101,7 @@ e2e-tests.ci-flow: e2e-tests/node_modules
npx concurrently --kill-others -n server,tests -s 'command-tests' 'make e2e-tests.server' 'sleep 10; make e2e-tests.tests'

.PHONY: test
test: node_modules
test: node_modules e2e-tests/node_modules
$(call check-program, yarn)
yarn test --coverage

Expand Down
3 changes: 2 additions & 1 deletion js/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 00f9fc5

Please sign in to comment.