Skip to content

Commit

Permalink
Set a maximum duration for iOS 15 tests (#4229)
Browse files Browse the repository at this point in the history
We are not sure why but iOS 15 tests get sometimes stuck re-running
forever (see
https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/21864/workflows/7af8697c-aad3-4e1f-92ae-f55186a72f27/jobs/254961).
It looks like rerunning fixes it.

Until we find out what's up, we are going to set a max time for this
job. CircleCI recommends setting a sleep and calling an API to cancel
the job when that finishes
https://support.circleci.com/hc/en-us/articles/14114124583195-How-to-set-a-custom-maximum-job-duration
  • Loading branch information
vegaro authored Aug 29, 2024
1 parent b4379b1 commit 89c0410
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ aliases:
only: main

commands:
set-maximum-duration:
parameters:
seconds:
type: integer
default: 600
steps:
- run:
name: Set maximum job duration to << parameters.seconds >> seconds
background: true
command: |
sleep << parameters.seconds >>
curl --request POST \
--url https://circleci.com/api/v2/project/gh/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/job/$CIRCLE_BUILD_NUM/cancel \
--header "Circle-Token: $CIRCLECI_API_TOKEN"
install-runtime:
parameters:
runtime-name:
Expand Down Expand Up @@ -678,6 +692,7 @@ jobs:

steps:
- checkout
- set-maximum-duration
- install-dependencies:
install_swiftlint: false
- update-spm-installation-commit
Expand Down

0 comments on commit 89c0410

Please sign in to comment.