clean: add log if task is not defined #223
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/natario1/CameraView/blob/master/.github/workflows/build.yml | |
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions | |
# https://dev.to/edvinasbartkus/running-react-native-detox-tests-for-ios-and-android-on-github-actions-2ekn | |
# https://github.com/wix/Detox/issues/2617 | |
name: Test on Devices | |
on: [push] | |
jobs: | |
IOS_SIMULATOR_TESTS: | |
# https://github.community/t/how-to-stop-github-actions-workflow-to-trigger-when-the-pull-request-is-from-dependabot-preview/116486 | |
if: github.actor != 'dependabot[bot]' | |
name: iOS Simulator Tests | |
runs-on: macOS-14 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'yarn' | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2' | |
bundler-cache: true | |
- name: Configure Sentry | |
run: | | |
sed 's/%token%/${{ secrets.SENTRY_API_TOKEN }}/' ios/sentry.properties.dist > ios/sentry.properties | |
- name: Install dependencies to compile node-canvas | |
run: brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman imagemagick | |
- name: Install dependencies | |
run: yarn install --no-progress --network-timeout 100000 --network-concurrency 1 | |
- name: Install applesimutils | |
run: | | |
brew tap wix/brew | |
brew install applesimutils | |
- name: Configure Firebase | |
run: | | |
brew install xmlstarlet | |
cp GoogleService-Info.plist.dist ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="CLIENT_ID"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_CLIENT_ID }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="REVERSED_CLIENT_ID"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_REVERSED_CLIENT_ID }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="API_KEY"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_API_KEY }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="GCM_SENDER_ID"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_GCM_SENDER_ID }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="PROJECT_ID"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_PROJECT_ID }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="STORAGE_BUCKET"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_STORAGE_BUCKET }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="GOOGLE_APP_ID"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_GOOGLE_APP_ID }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="DATABASE_URL"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_DATABASE_URL }}' ios/GoogleService-Info.plist | |
- name: Install CocoaPods plugins | |
run: gem install cocoapods-user-defined-build-types | |
- name: Cache Pods | |
uses: actions/cache@v2 | |
id: cache-pods | |
with: | |
path: ios/Pods | |
key: pods-${{ hashFiles('**/Podfile.lock') }} | |
- name: Install Pods | |
working-directory: ios/ | |
run: USE_FRAMEWORKS=static NO_FLIPPER=1 bundle exec pod install | |
- name: Configure .env variables | |
run: | | |
cp .env.dist .env | |
sed -i '' -e 's/GOOGLE_MAPS_BROWSER_KEY=/GOOGLE_MAPS_BROWSER_KEY=${{ secrets.GOOGLE_MAPS_BROWSER_KEY }}/' .env | |
sed -i '' -e 's/GOOGLE_MAPS_ANDROID_KEY=/GOOGLE_MAPS_ANDROID_KEY=${{ secrets.GOOGLE_MAPS_ANDROID_KEY }}/' .env | |
# https://vojtastavik.com/2018/09/02/what-is-inside-derived-data-xcode/ | |
# https://discuss.circleci.com/t/sharing-xcode-derived-data-folder-across-jobs-workflows/31363/5 | |
# https://medium.com/@bitrise/60-faster-builds-force-xcode-to-use-caching-on-bitrise-af8979ca39a6 | |
- name: Cache XCode derived data | |
uses: actions/cache@v2 | |
id: cache-xcode-derived-data | |
with: | |
path: ios/build | |
key: xcode-derived-data-${{ hashFiles('**/Podfile.lock') }} | |
- name: Build app for Detox | |
run: node node_modules/.bin/detox build -c ios.sim.release | |
- name: Run Detox tests | |
run: node node_modules/.bin/detox test -c ios.sim.release -l debug | |
# Run 'applesimutils --list' to list your supported devices. | |
# It is advised only to specify a device type, e.g., "iPhone Xʀ" and avoid explicit search by OS version. | |
- name: List supported devices | |
if: false # useful only for debugging | |
run: applesimutils --list | |
# See screenshot specifications | |
# https://help.apple.com/app-store-connect/#/devd274dd925 | |
# - name: Take App Store screenshots | |
# if: github.ref == 'refs/heads/master' | |
# run: | | |
# node node_modules/.bin/detox test -c ios.sim.release -o e2e/screenshots.config.json --take-screenshots manual --cleanup --device-name="iPhone 11" --artifacts-location ./artifacts/6.5-inch | |
# node node_modules/.bin/detox test -c ios.sim.release -o e2e/screenshots.config.json --take-screenshots manual --cleanup --device-name="iPhone 8 Plus" --artifacts-location ./artifacts/5.5-inch | |
# node node_modules/.bin/detox test -c ios.sim.release -o e2e/screenshots.config.json --take-screenshots manual --cleanup --device-name="iPad Pro (12.9-inch) (4th generation)" --artifacts-location ./artifacts/12.9-inch | |
- name: Upload screenshots artifacts | |
# if: github.ref == 'refs/heads/master' | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: detox-screenshots-ios | |
path: artifacts | |
ANDROID_EMULATOR_TESTS: | |
# https://github.community/t/how-to-stop-github-actions-workflow-to-trigger-when-the-pull-request-is-from-dependabot-preview/116486 | |
if: github.actor != 'dependabot[bot]' | |
name: Android Emulator Tests | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: coopcycle-app | |
env: | |
GEOCODE_EARTH_API_KEY: ${{ secrets.GEOCODE_EARTH_API_KEY }} | |
STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }} | |
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }} | |
STRIPE_CONNECT_CLIENT_ID: ${{ secrets.STRIPE_CONNECT_CLIENT_ID }} | |
AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
strategy: | |
# Allow tests to continue on other devices if they fail on one device. | |
fail-fast: false | |
matrix: | |
EMULATOR_API_LEVEL: | |
# - 21 | |
- 28 | |
# - 33 | |
steps: | |
# setup local coopcycle-web instance; FIXME: disabled for now as it's not enough space to run both; android build fails with 'No space left on device.' | |
# - uses: actions/checkout@v3 | |
# with: | |
# repository: coopcycle/coopcycle-web | |
# path: coopcycle-web | |
# - name: Create .env file | |
# run: cp .env.dist .env | |
# working-directory: coopcycle-web | |
# - name: Pull Docker images | |
# run: docker compose pull --ignore-pull-failures | |
# working-directory: coopcycle-web | |
# - name: Prepare OSRM data | |
# run: | | |
# docker compose run -T --rm osrm wget --no-check-certificate https://coopcycle-assets.sfo2.digitaloceanspaces.com/osm/paris-france.osm.pbf -O /data/data.osm.pbf | |
# docker compose run -T --rm osrm osrm-extract -p /opt/bicycle.lua /data/data.osm.pbf | |
# docker compose run -T --rm osrm osrm-partition /data/data.osrm | |
# docker compose run -T --rm osrm osrm-customize /data/data.osrm | |
# working-directory: coopcycle-web | |
# # Cypress GitHub Action uses npm ci, and it causes a "permission denied" error, | |
# # because it tries to remove the node_modules/ folder, which is mounted with root:root | |
# # We create the node_modules/ folder *BEFORE* starting the containers, | |
# # so that it can be removed without problems. | |
# - name: Create node_modules directory | |
# run: mkdir node_modules | |
# working-directory: coopcycle-web | |
# - name: Start Docker containers | |
# run: docker compose up -d | |
# working-directory: coopcycle-web | |
# - name: Wait for PHP-FPM | |
# run: until docker inspect --format='{{ .State.Health.Status }}' $(docker compose ps -q php) | grep -wq healthy; do sleep 5; done | |
# working-directory: coopcycle-web | |
# - name: Create database | |
# run: docker compose exec -T php bin/console doctrine:schema:create --env=test | |
# working-directory: coopcycle-web | |
# - name: Create typesense collections | |
# run: docker compose exec -T php bin/console typesense:create --env=test | |
# working-directory: coopcycle-web | |
# - name: Setup CoopCycle | |
# run: docker compose exec -T php bin/console coopcycle:setup --env=test | |
# working-directory: coopcycle-web | |
- uses: actions/checkout@v3 | |
with: | |
path: coopcycle-app | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
# https://github.com/jlumbroso/free-disk-space?tab=readme-ov-file#example | |
android: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
# Temporary disable yarn caching | |
# cache: 'yarn' | |
# cache-dependency-path: "coopcycle-app" | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Decode sentry.properties file | |
uses: timheuer/[email protected] | |
with: | |
fileDir: "./coopcycle-app/android/" | |
fileName: "sentry.properties" | |
encodedString: ${{ secrets.SENTRY_PROPERTIES_BASE64 }} | |
- name: Install dependencies (yarn) | |
run: yarn install --no-progress --network-timeout 100000 --network-concurrency 1 | |
- run: cp google-services.json.dist android/app/google-services.json | |
- name: Enable clear text traffic in release builds | |
run: | | |
sudo apt install xmlstarlet | |
xmlstarlet ed --inplace --ps --insert "/manifest/application" --type attr -n "android:usesCleartextTraffic" -v "true" android/app/src/main/AndroidManifest.xml | |
- name: Configure .env variables | |
run: | | |
cp .env.dist .env | |
sed -i -e 's/FACEBOOK_APP_ID=/FACEBOOK_APP_ID=${{ secrets.FACEBOOK_APP_ID }}/' .env | |
sed -i -e 's/FACEBOOK_CLIENT_TOKEN=/FACEBOOK_CLIENT_TOKEN=${{ secrets.FACEBOOK_CLIENT_TOKEN }}/' .env | |
- name: Enable KVM (reactivecircus) | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- run: sudo apt-get install libpulse0 | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@v3 | |
# disable AVD caching for now; trying to solve 'No space left on device.' issue | |
# - name: AVD cache | |
# uses: actions/cache@v4 | |
# id: avd-cache | |
# with: | |
# path: | | |
# ~/.android/avd/* | |
# ~/.android/adb* | |
# key: avd-${{ matrix.EMULATOR_API_LEVEL }} | |
# | |
# - name: create AVD and generate snapshot for caching | |
# if: steps.avd-cache.outputs.cache-hit != 'true' | |
# uses: reactivecircus/android-emulator-runner@v2 | |
# with: | |
# api-level: ${{ matrix.EMULATOR_API_LEVEL }} | |
# target: google_apis | |
# arch: x86_64 | |
# profile: pixel_6 | |
# force-avd-creation: false | |
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
# disable-animations: false | |
# script: echo "Generated AVD snapshot for caching." | |
- name: Build app for Detox | |
run: node node_modules/.bin/detox build -c android.emu.release | |
env: | |
googleMapsApiKey: ${{ secrets.googleMapsApiKey }} | |
SENTRY_DISABLE_AUTO_UPLOAD: true | |
- name: Disk usage (filesystem) | |
run: df -h | |
- name: Disk usage | |
run: du -h -a --max-depth=1 | sort -rh | |
- name: Run Detox tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.EMULATOR_API_LEVEL }} | |
target: google_apis | |
arch: x86_64 | |
profile: pixel_6 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: | | |
node node_modules/.bin/detox test -c android.emu.release --device-name="test" -l debug | |
# node node_modules/.bin/detox test -c android.att.release --device-name="test" --take-screenshots all | |
# node node_modules/.bin/detox test -c android.att.release --device-name="test" --take-screenshots manual -o e2e/screenshots.config.json | |
- name: List supported devices | |
if: false # useful only for debugging | |
run: avdmanager list device | |
- name: List emulators | |
if: false # useful only for debugging | |
run: avdmanager list avd | |
- name: Upload screenshots artifacts | |
# if: github.ref == 'refs/heads/master' | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: detox-screenshots-android | |
path: artifacts |