-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scheduled build improvements #71
Conversation
Updated the PR. After all, we still need to make use of
|
Updated PR once again. Fixed an issue where the build would be triggered during the "sync cron tab" (0 4 * * *) although there were no new commits. The culprit seems to have been the usage of github expressions
This was fixed. Test runs see here:
|
Reworked this PR after discussions on Zulip chat around opt-out vs. opt-in for automated builds. The workflow now takes as much configuration as possible out of the Looper's hands and an added check for
I think there currently are two limitations:
Happy to receive feedback. |
.github/workflows/build_loop.yml
Outdated
- name: Check for alive branch | ||
if: steps.workflow-permission.outputs.has_permission == 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you avoid overwriting GITHUB_TOKEN? GH_PAT and GITHUB_TOKEN are two different things. It'd be nice to keep them separate in this file to avoid confusion about what's being used where.
Ideally we could even rename GH_PAT to be more explicit about how it is different from GITHUB_TOKEN. Something like MATCH_REPO_ACCESS_TOKEN, or something like that. But that's adding even more changes for the user to deal with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the impression, that gh
CLI requires the environment variable to be named GITHUB_TOKEN
but just double-checked and GH_PAT
is fine and even what is instructed in the manual. Change commit coming in.
Edit: The token does much more now than just provide access to the Match-Secrets
repo. It is used for checking workflow
permissions, checking for alive
branch existence and conditionally creating it, etc. It is, in a way, a real GH access token.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the documentation, for the PAT creation this used to be named GH_PAT
and has since been changed to Fastlane Access Token
(the name of the token, not so much the menu item, since secret is still named that way). We can change GH_PAT
to FASTLANE_ACCESS_TOKEN
if you want, but I feel like that may cause issues when people can't differentiate what secrets are based on Apple Developer information / keys / IDs and what is GitHub-based.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I liked the change to use the built in GITHUB_TOKEN where possible. Can we allow it to have workflow permissions, do the sync and checking for alive branch? Just didn't want to overwrite it in the env with GH_PAT. Then GH_PAT has a smaller set of responsibilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot use GITHUB_TOKEN
to check the workflow permission, cause the cURL request we send to check for x-oauth-scopes
must contain the token to-be-checked. We also cannot use it for any syncing, because whenever we sync, there are possible changes to workflow files, and GITHUB_TOKEN
unfortunately cannot hold workflow
permissions, so we need the Looper-created GH_PAT
with repo
and workflow
scopes for that.
I misunderstood your initial comment, so I'll change that back. We can use the standardized GITHUB_TOKEN
to check for alive
branch and, if not existent, create it. I will rename the environment variable in the permissions check so that it becomes more readable what actually happens there 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed now. Hope this is okay now 😄
Comment regarding testflight.md modification: The testflight.md is set up for an earlier version of the PR before the scope for GH_PAT was selected as a determining factor for actions if the two variables, SCHEDULED_BUILD and SCHEDULED_SYNC, are not configured. In other words - it is consistent with information in this comment:
Not this later comment:
The optional variables SCHEDULED_BUILD and SCHEDULED_SYNC can be configured to modify the default behavior - (assuming GH_PAT has workflow scope enabled): if new commits are found, then auto-sync and auto-build. |
Detailed testing (first of several comments): Start with dev branch at commit 868fcd7.
Repository: https://github.com/marionbarker/LoopWorkspace
Start by deleting my alive branch (as if coming from main). First test: alive branch does not exist, run Build Loop manually
Second test: create alive branch manually, run Build Loop manually
The other tests need to run at specific times (cron job). |
That is correct. As I wrote in this comment on Zulip I wanted to wait for "final okay" regarding my modifications and the scope of this PR before I changed
|
Modified several items (one commit at a time):
Leave the GH_PAT scope as workflow.
|
Expect it to skip the check for commits portion because of scope change Expectation - nothing will happen because the scope is repo (not workflow).
Reran this with alive branch deleted and GH_PAT set to repo (not workflow).
|
Realized I had not modified GH_PAT before - so still at workflow scope; add the variable SCHEDULED_SYNC to repository and set value to false.
|
Configuration for the test:
Expectation is buld_loop will:
|
Configuration for the test:
Expectation is buld_loop will - each expectation was met:
|
update SCHEDULED_SYNC and SCHEDULED_BUILD to true Expectation is build_loop will:
What really happened:
I tried that idea (see next comment and it did not work) |
Configuration:
This only did the creation of alive and adding the commit. |
Both cron statements are needed to allow the app to always be built on a monthly basis, see the if statement around line 166. |
In my opinion, the default behavior of build_loop.yml for users of main branch (after next release) should be to automatically check for updates and build once a month.
See this modification (where the cron time/date change is just for testing) Test Configuration (similar to someone coming from 3.2.2 with next release):
Test Expectation (and results matched expectations)
|
With the current infrastructure, we can let updates happen automatically, within the next day after a release. Your suggestion is to only make this happen once a month? Are there compelling reasons to not automatically update when new versions are released? Sometimes there are critical issues that should be fixed sooner than this. But having automated updates can certainly be controversial for some. Auto updates once a month is in principle the same thing though, but can optionally be disabled. I think we really should not propose changing the workflow file (or other parts of the code) unless absolutely necessary, as it might sometimes cause merge conflicts. Patching does alter the workflow file, but then there is specific support for this (and probably how to revert changes to fix merge issues). |
@bjornoleh I think Marion is proposing just to have a monthly scheduled build and that build will I agree with you, we should have builds as soon as there are changes and an additional build once a month. |
Agreed. Preferences about run frequency aside, no solution to this problem or disagreement should come with instructions to change the |
I am not aware of any method to pick up changes besides running a workflow. This can certainly happen on something like a weekly basis instead. It will just mean that updates will happen up to a week after release. But I am not sure if clutter in the workflow logs is of any concern, when things work properly, no one will look at those logs, and if it fails, the last one will probably be all you need to look at. There is one benefit of running the workflow on a lower cadence though: Sometimes we randomly get the "Could not install WWDR certificate" error. It has always resolved by a second run of the workflow, but reducing the volume of such events would be beneficial for everyone. Not sure if this specific error still happens though, I haven't seen it in a while. |
I agree completely with that position - editing build_loop.yml to change behavior is not desirable. I had not thought of that. A compromise position would be to modify
to (change to weekly)
I do think even if we leave it as daily, we should change time of the daily cron to separate the case where the update/alive check happens on the same day of the month as the scheduled build because you do get 2 jobs running at essentially the same time.
Edited my suggestion to make the check for updates cron later than monthly build cron. This avoids two builds on one day for rare cases. |
I agree it's not ideal for the two builds to happen at the same time. But perhaps not too big an issue. They could be moved a little further apart of course. And thinking about it, if the monthly one happens at an earlier time of day, the daily or weekly one will not produce a new build, but stop after checking for new commits, even if there happened to be a release this day. Creating two builds the same day might be confusing. Having two runs at the same day should mostly go unnoticed. |
Agreed. Edited my earlier comment. |
Two builds at one time will probably result in one failing. My experience is they both try to use the same TestFlight build number. |
Yes, I have also seen issues with build numbers. But if the monthly one runs an hour before the daily one, it will update the fork, and the daily run will then stop after the check for new commits, as there will be no new commits. Regarding timing of these runs, I have tried to ask before if 04 UTC is a good time. It was chosen for testing in an European setting where it corresponds to 05 or 06 local time, ie a time where there is a very low risk of having a set of incoming code changes to the upstream repository. I guess it's the local time zone/typical working hours for Pete that should form the basis for this with Loop. I don't know what that might be. |
Fully agree with where this conversation is headed. Following suggestion:
Why 2am EST? So that it is during the night for all Americans and also early morning for Europeans. What do you think? 🤓 |
I made an alternative version for testflight.md that can be reviewed here: https://github.com/marionbarker/LoopWorkspace/blob/dev_plus_pr71/fastlane/testflight.md
|
* Bring in MinimedKit project fix * Add debug log to TidepoolKit * TidepoolKit and TidepoolService updates * Fix double inclusion of ru, and add hi locale * Update LoopKit submodule * Remove TidepoolKitUI references * Ensure food entries have name set * Tidepool carb upload fix refinement * Add initialization error logging to TidepoolService * TidepoolService updates * Omnipod ref codes fixes * Bring in TidepoolService and NightscoutService changes * Fix tests * Update circleci job name * change default job name in circleci * Add version * Bring in RemoteCommands PRs * Ensure each submodule branch is at its HEAD before branching * Bring in latest translations * Readlink fix * Fastfile: Add time sensitive notifications to identifier setup (LoopKit#50) * Fastfile capabilities: add Time Sensitive Notifications to Loop target Spaceship::ConnectAPI::BundleIdCapability::Type::USERNOTIFICATIONS_TIMESENSITIVE * Remove instructions for manually adding Time Sensitive Notifications * G7SensorKit changes * Meal detection fixes for mmol/L * Reorg ps2 frameworks (LoopKit#53) * Update gitmodules to point to LoopKit repos instead of ps2 repos * Moving submodules * Add renamed projects * Nightscout remote cgm rename (LoopKit#54) * Update gitmodules * Update NightscoutRemoteCGM submodule references, and project references * Update submodule rev ro NightscoutRemoteCGM * Always upload artifacts * Changes from Tidepool (LoopKit#55) * Changes from Tidepool * Update to dev * Add merges for NightscoutRemoteCGM and G7SensorKit * Fix tests * Use MKRingProgressView from swift package * Update TidepoolKit * Add Minizip project back in * Update TidepoolKit * Update to ZipFoundation for providing zip file creation abilities (LoopKit#56) * Update to ZipFoundation for providing zip file creation abilities * Update Loop * Update to dev * Warnings cleanup * Tidepool sync (LoopKit#58) * Changes from Tidepool * Update to dev * Add merges for NightscoutRemoteCGM and G7SensorKit * Fix tests * Tidepool Merge * Fix merge issues * Update packages * Add branch name to build name (LoopKit#52) * G7 sensor reading age fix * Another G7 date issue fixed * Status wiget glucose age calc fix * Bring in latest submodule changes * Use current Xcode * Bump xcode version for github workflows * Update github actions to use macos 13, with latest Xcode * Bring in Loop and LoopKit changes * G7 HKDevice update * Bring in LoopKit crash fix * Algorithm experiments (LoopKit#62) * Turn on algorithm experiments * Loop updates * IRC added as experiment * Update Loop submodule * Bring in analytics changes * Bring in IRC fix * Analytics fix * Adding Libre Integration (LoopKit#51) * Libre testing branch * Update submodule * Update libre branch to latest dev * Fixes * Add NFC entitlement * Update LibreTransmitter to main branch * Update submodules to latest dev * update submodule * Add duration to suspend event * Update Nightscout service and LoopKit * Submodule updates * Add NFC_TAG_READING to fastlane bundle id configuration for Loop * Update ZipFoundation revision * Critical log export fix * Tidepool merge (LoopKit#65) * Removing TidepoolKit * Removing TidepoolKit * Update submodules * Add scheduled sync and build, and allow for customization of Loop with GitHub Actions / Fastlane builds (LoopKit#43) * Scheduled sync and build, with option to customize Loop Changed template for scheduled runs to every month Added env variables for - upstream and target repo/branches - sync upstream 'true'/'false' - customize app 'true'/'false' Added sync action (aormsby/Fork-Sync-With-Upstream-action) to the (sync and) build job Added gautamkrishnar/keepalive-workflow to avoid expiration of scheduled workflows due to repository inactivity (60 days max). Adds an empty commit to fork if no activity during the last 27 days. Added Customize Loop action, which - applies any patches located in the LoopWorkspace/patches/ directory (@billybooth) - downloads (wget) and applies submodule patches specified in build_loop.yml Added (commented-out) CustomTypeOne/LoopPatches as templates for Loop and LoopKit submodule patches. * Add ./patches/save_patches_here.md * build_loop.yml: update patch templates for submodules * build_loop.yml: comment out patch template for submodule Loop * build_loop.yml: patch template app name = CustomLoop * Update build_loop.yml: fix typo * Update save_patches_here.md: fix typo * build_loop.yml: delete test_mode * build_loop.yml: remove env CUSTOMIZE_APP * Update build_loop.yml: remove remaining env CUSTOMIZE_APP refs * build_loop.yml: remove '--exclude=' from 'git apply' * Create update.yml - runs on a frequent schedule - checks out LoopWorkspace `main` - compares and syncs with LoopKit/LoopWorkspace (unless owner = LoopKit) - keepalive action adds empty commits to LoopKit/LoopWorkspace `main` after `time_elapsed` days to to avoid inactivation of scheduled workflows, when these updates are passed on to forks (only if owner = LoopKit) - launches build_loop.yml workflow on forks to sync and build if new commits are found (unless owner = LoopKit) * Remove keepalive action from build_loop.yml - keepalive action moved to update.yml * Adapt build_loop.yml and update.yml to be run in an "actions" branch to be set as default, and used to trigger scheduled builds of the main branch. Empty commits are added to an "actions" branch only (must be created by the user and set as default) to keep this branch "alive" and allow scheduled workflows to run uninterrupted (max 60 days of inactivity). The empty commits will not be included in the resulting TestFlight builds of main. Removed conditionals regarding LoopKit repository. * build_loop.yml: Add job names for `secrets` and `upstream_sync_and_build` * update.yml: shorter job name for `check_latest_from_upstream`: Check upstream * build_loop.yml: use curl instead of wget for downloading patches * Changes to build_loop.yml and update.yml: build_loop.yml: -Remove sync action from build_loop.yml -build on schedule on the 1th every month for a predictable build schedule well within the 90 day TestFlight limit. The time of day should be chosen as a time where ongoing changes are unlikely during releases (nighttime). -rename env TARGET_BRANCH to BUILD_BRANCH - use current branch as BUILD_BRANCH for easy switching to building main or dev (manually insert alternative branch names as needed) update.yml: - check for updates every day - use current branch name for UPSTREAM_BRANCH and TARGET_BRANCH, to easily switch between dev and main by changing default branch, without any code changes. - do not run the upstream sync action on the upstream LoopKit repository - time_elapsed: 50 days for keepalive action * Add branch name to run-names - with round brackets around branch name for readability: (${{ github.ref_name }}) * Remove mention of setting TARGET_BRANCH as default, since its not fixed * Move update and keep alive features to build_loop.yml - Checks for updates nightly - Ensures repository activity - Launches Build job if new commits are found, or if run manually - Workflow file cleanup * Delete update.yml * testflight.md: update GH_PAT instructions * Change the Expiration selection to `No expiration`. * Select the `repo` and `workflow` permission scopes. * testflight.md instructions: Create a branch named "alive" * testflight.md: rephrase section on ‘Create a branch named "alive"’ * Added MixpanelService to Loop (LoopKit#63) * Added MixpanelService to Loop * Update module url * bump mixpanel * Xcode 15 Beta 3 fixes * Remove unused project refs, and update MixpanelService signing * build_loop.yml: Disable upstream sync with optional repository variable (LoopKit#67) Set an optional "SYNC_UPSTREAM" repository variable to 'false' to disable syncing of fork with the upstream repository * Update submodules (LoopKit#68) G7 Logging fix Libre Demo retain fix NightscoutRemoteCGM fix deployment target * build_loop.yml: Separate checkout repo for building (LoopKit#69) * build_loop.yml: build_loop.yml: Separate checkout repo for building Checkout for syncing without submodules: recursive * build_loop.yml: remove "submodules: recursive" from checkout for syncing, fix typo. * Bring in IRC changes and always use dynamic carbs * Bring in changes to move charts to LoopKit * Homescreen Medium Widget, and insulin suspension forecast preview * Fastlane widget bundleid updates (LoopKit#75) * Update build_loop.yml * Update build_loop.yml * Update Fastfile for widget extension bundle id change * Adding top-to-bottom algorithm test * Submodule updates * Fix for crash when running forecast previews * Tidepool Sync (LoopKit#80) * Sync script updates (LoopKit#81) * Tidepool Sync * Make sure diffs exist, merge in LoopKit updates * Bring in LoopDataManager race condition fix * Update translation repo list * Update translations from Lokalise (LoopKit#82) * Update translations from Lokalise * Bring in translations for more repos * Bring in translations for more repos * Scheduled build improvements (LoopKit#71) * Add conditional scheduled build and sync * Update testflight.md with instructions for scheduling setup * Fix typo * Remove GITHUB_TOKEN; use GH_PAT instead * Update testflight.md with instructions how to add workflow scope * Fixed conditions for scheduled build * Fix upstream repo owner * Refactor build to use workflow permissions and auto-create alive branch * Change GITHUB_TOKEN to GH_PAT * Change token to GITHUB_TOKEN where appropriate; Make env variable names more descriptive * Fix broken alive branch auto-creation * Update testflight.md with opt-out and new config info * Update cron for sync and schedule, update build condition * Fix typo… * Update testflight.md with suggestions and re-organized contents * Fix typo from PR74 * Browser Build "Validate Secrets" Improvements (LoopKit#77) * Added improved validation and more descriptive error messages * Add validations from suggestions and test feedback * Modify validate_secrets to run in readonly mode * Streamline naming 1/3 * Streamline naming 2/3 * Streamline naming 3/3, add back validation preceding build * Fix LoopWidgetExtension bundle identifier * Add fastlane patterns back after accidentally removing them * Fix Match-Secrets auto-creation and if-condition * validate_secrets.yml: Set pipefail option so that fastlane exit codes are handled correctly * workflows: Include branch in (run) names and use consistent capitalization across reusable job names * This commit is purely aesthetic and aims to make the display names of Jobs consistent across workflows. Likewise, makes spacing and validation error messages consistent. * validate_secrets.yml: Make annotations more "actionable". * validate_secrets.yml: Improve error annotations around GH_PAT permissions * Trivial changes to FASTLANE / ASC error annotations (mention 'Keys' tab) --------- Co-authored-by: Billy Booth <[email protected]> * Bump submodule refs * More carb entry fixes * Omnipod debug logging updates * Fixes for automated builds (LoopKit#83) * Fix broken upstream sync; Remove orphaned environment variable * Fix condition for automated alive branch creation * Disable meal detection when calibrations are present, and localization fix * Bring in fixes for negative duration dose prevention * Bring in functional algo support * Bring in changes for app expiration warning for testflight builds * Tidepool sync * Fix cron schedule for automated sync and build (LoopKit#87) * Fix cron schedule for sync and build * Update cron tab descriptions in testflight.md * Fix typo in comment * Adding missing hindi translations for app intents * Update build destinations * GH Actions: Improve secrets validation (LoopKit#86) * validate_secrets.yml: Pass a "Could not install WWDR certificate" error through validation * validate_secrets.yml: Improve annotation when a public Match-Secrets repo exists * validate_secrets.yml: Rewrite Match-Secrets validation to be explicit about the Match-Secrets repository that will be used When the GH account that the GH_PAT token was created under does not match the repository_owner of the LoopWorkspace repository, the validation routine used a different Match-Secrets repository than fastlane. * validate_secrets.yml: Rewrite GH_PAT validation to capture scopes and distinguish between classic and fine-grained access tokens * validate_secrets.yml: Fix syntax error in Match-Secrets validation job * validate_secrets.yml: Depend less on patterns / read scopes from any token that provides them * Provide HAS_WORKFLOW_PERMISSION as an output * validate_secrets.yml: Annotate failures from unaccepted Apple PLAs * validate_secrets.yml: Fix typo and improve annotation when GH_PAT is invalid * validate_secrets.yml: Improve annotation when authorization fails and token format is unknown * validate_secrets.yml: Minor wording tweak * Update Fastlane to 2.215.0 (LoopKit#88) * Update Gemfile.lock for Fastlane to 2.215.0 Among other improvements, this should fix the WWDR issue. * build_loop.yml: Install bundle, bundle exec - bundle install - bundle exec fastlane build_loop - bundle exec fastlane release * Update Gemfile.lock Commands used to install bundler and update dependencies: sudo gem pristine ffi sudo gem install bundler sudo bundle install sudo bundle update fastlane * Don't install bundler, which comes with Ruby 2.7+ * Install dependencies and use bundler to exec fastlane across workflows --------- Co-authored-by: Billy Booth <[email protected]> * Bring in CGM Event Store * Add Mixpanel service to sync * Bring in Tidepool sync * Bump Loop submodule rev * Service state restoration fix * Upload pod changes to Nightscout as Site Change treatments, for the cannula age (CAGE) pill * MDT Set change upload * Bug fix for mdt set change detection, and upload pump alarms to NS * Add widget fixes * Update circleci build to xcode 15 (LoopKit#89) * Update circleci build to xcode 15 * Update workflow to build with Xcode 15 * Bump device * Fix iphone version * Run tests on iOS 16.4 until iOS 17 simulators are working * Include pending insulin in dosing decision * Update build settings to avoid macos build during translation import * Bump RileyLinkKit rev * heartbeat setup fix, and OmniKit translations * Add slide button cannula insertion * Disable autolock during pod pairing (Dash) * Sync the GitHub runner clock with the Windows time server (LoopKit#98) Adding a step to workflow jobs that interface Apple servers, as a workaround for build issues caused by runner clocks being out of sync. See https://github.com/actions/runner issue number 2996 for details. name: Sync clock run: sudo sntp -sS time.windows.com Added to the following workflows / jobs: validate_secrets.yml / validate-fastlane-secrets add_identifiers.yml / identifiers build_loop.yml / build create_certs.yml / certificates * Update submodules * update to rev of SlideButton package that handles rtl languages (LoopKit#103) * Bump submodule revs * Bring in test updates for iOS 17 * include flag for DEBUG_FEATURES_ENABLED by default (LoopKit#111) * Update submodules for guardrails crash, simulator settings access, and pod pairing UI resumption * Bring in OmniBLE updates * Bring in latest submodule revs * Update browser build action dependencies to meet GH node version requirements (LoopKit#120) * Bump submodule refs * Change GITHUB_TOKEN to user-created GH_PAT (LoopKit#125) Fixes permission issues where GH api responds with: ```swift gh: Resource not accessible by integration (HTTP 403) {"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/git/refs#create-a-reference"} Error: Process completed with exit code 1. ``` because the default, auto-created GITHUB_TOKEN cannot be given appropriate content write permissions to create branches in the owner's repository * Update Gemfile.lock to bump Fastlane to 2.220.0 (LoopKit#126) * Update testflight.md - apple moved keys under integrations (LoopKit#112) * Update testflight.md - apple moved keys under integrations * Fix typo * Update fastlane and macOS (LoopKit#143) * update Fastlane to 2.221.1 * update runners to macOS 14 * Update submodules * Ps2/xcode15.4 (LoopKit#145) * Update to xcode15.4 * update ios version used in circleci builds * update ios version used in circleci builds * Update build_loop.yml (LoopKit#146) * Update submodule for CGMBLEKit * Update to Loop 3.4 Release * Fix browser build sync and alive behavior (LoopKit#164) * Fix browser build sync and alive behavior - Added logic to extend the alive check for the existence of either `alive-main` or `alive-dev` branches. - Resolved an issue where unexpected successes were occurring when failures were expected. - Implemented a check to determine the existence of the `alive-main` and `alive-dev` branches and create them if they do not exist. - Introduced a mechanism to identify the current branch being run (either `main` or `dev`). - Based on the current branch, the corresponding alive branch (`alive-main` or `alive-dev`) will be used to check for upstream changes. - Set a new variable `ABORT_SYNC` to `true` when the current branch is neither `dev` nor `main`. - The syncing attempt will proceed based on the `ABORT_SYNC` variable status. - Ensured proper branch synchronization to prevent build inconsistencies and failures - Addresses issue LoopKit/Loop#2192 - Updates app store connect link for validation error hints to new Apple URL scheme * 💚 Security Fix Co-Authored-By: ebouchut <[email protected]> --------- Co-authored-by: ebouchut <[email protected]> * Update for Loop 3.4.1 --------- Co-authored-by: Pete Schwamb <[email protected]> Co-authored-by: bjornoleh <[email protected]> Co-authored-by: Marion Barker <[email protected]> Co-authored-by: Cameron Ingham <[email protected]> Co-authored-by: Noah Brauner <[email protected]> Co-authored-by: Deniz Cengiz <[email protected]> Co-authored-by: Billy Booth <[email protected]> Co-authored-by: Marion Barker <[email protected]> Co-authored-by: ebouchut <[email protected]>
* Bring in MinimedKit project fix * Add debug log to TidepoolKit * TidepoolKit and TidepoolService updates * Fix double inclusion of ru, and add hi locale * Update LoopKit submodule * Remove TidepoolKitUI references * Ensure food entries have name set * Tidepool carb upload fix refinement * Add initialization error logging to TidepoolService * TidepoolService updates * Omnipod ref codes fixes * Bring in TidepoolService and NightscoutService changes * Fix tests * Update circleci job name * change default job name in circleci * Add version * Bring in RemoteCommands PRs * Ensure each submodule branch is at its HEAD before branching * Bring in latest translations * Readlink fix * Fastfile: Add time sensitive notifications to identifier setup (LoopKit#50) * Fastfile capabilities: add Time Sensitive Notifications to Loop target Spaceship::ConnectAPI::BundleIdCapability::Type::USERNOTIFICATIONS_TIMESENSITIVE * Remove instructions for manually adding Time Sensitive Notifications * G7SensorKit changes * Meal detection fixes for mmol/L * Reorg ps2 frameworks (LoopKit#53) * Update gitmodules to point to LoopKit repos instead of ps2 repos * Moving submodules * Add renamed projects * Nightscout remote cgm rename (LoopKit#54) * Update gitmodules * Update NightscoutRemoteCGM submodule references, and project references * Update submodule rev ro NightscoutRemoteCGM * Always upload artifacts * Changes from Tidepool (LoopKit#55) * Changes from Tidepool * Update to dev * Add merges for NightscoutRemoteCGM and G7SensorKit * Fix tests * Use MKRingProgressView from swift package * Update TidepoolKit * Add Minizip project back in * Update TidepoolKit * Update to ZipFoundation for providing zip file creation abilities (LoopKit#56) * Update to ZipFoundation for providing zip file creation abilities * Update Loop * Update to dev * Warnings cleanup * Tidepool sync (LoopKit#58) * Changes from Tidepool * Update to dev * Add merges for NightscoutRemoteCGM and G7SensorKit * Fix tests * Tidepool Merge * Fix merge issues * Update packages * Add branch name to build name (LoopKit#52) * G7 sensor reading age fix * Another G7 date issue fixed * Status wiget glucose age calc fix * Bring in latest submodule changes * Use current Xcode * Bump xcode version for github workflows * Update github actions to use macos 13, with latest Xcode * Bring in Loop and LoopKit changes * G7 HKDevice update * Bring in LoopKit crash fix * Algorithm experiments (LoopKit#62) * Turn on algorithm experiments * Loop updates * IRC added as experiment * Update Loop submodule * Bring in analytics changes * Bring in IRC fix * Analytics fix * Adding Libre Integration (LoopKit#51) * Libre testing branch * Update submodule * Update libre branch to latest dev * Fixes * Add NFC entitlement * Update LibreTransmitter to main branch * Update submodules to latest dev * update submodule * Add duration to suspend event * Update Nightscout service and LoopKit * Submodule updates * Add NFC_TAG_READING to fastlane bundle id configuration for Loop * Update ZipFoundation revision * Critical log export fix * Tidepool merge (LoopKit#65) * Removing TidepoolKit * Removing TidepoolKit * Update submodules * Add scheduled sync and build, and allow for customization of Loop with GitHub Actions / Fastlane builds (LoopKit#43) * Scheduled sync and build, with option to customize Loop Changed template for scheduled runs to every month Added env variables for - upstream and target repo/branches - sync upstream 'true'/'false' - customize app 'true'/'false' Added sync action (aormsby/Fork-Sync-With-Upstream-action) to the (sync and) build job Added gautamkrishnar/keepalive-workflow to avoid expiration of scheduled workflows due to repository inactivity (60 days max). Adds an empty commit to fork if no activity during the last 27 days. Added Customize Loop action, which - applies any patches located in the LoopWorkspace/patches/ directory (@billybooth) - downloads (wget) and applies submodule patches specified in build_loop.yml Added (commented-out) CustomTypeOne/LoopPatches as templates for Loop and LoopKit submodule patches. * Add ./patches/save_patches_here.md * build_loop.yml: update patch templates for submodules * build_loop.yml: comment out patch template for submodule Loop * build_loop.yml: patch template app name = CustomLoop * Update build_loop.yml: fix typo * Update save_patches_here.md: fix typo * build_loop.yml: delete test_mode * build_loop.yml: remove env CUSTOMIZE_APP * Update build_loop.yml: remove remaining env CUSTOMIZE_APP refs * build_loop.yml: remove '--exclude=' from 'git apply' * Create update.yml - runs on a frequent schedule - checks out LoopWorkspace `main` - compares and syncs with LoopKit/LoopWorkspace (unless owner = LoopKit) - keepalive action adds empty commits to LoopKit/LoopWorkspace `main` after `time_elapsed` days to to avoid inactivation of scheduled workflows, when these updates are passed on to forks (only if owner = LoopKit) - launches build_loop.yml workflow on forks to sync and build if new commits are found (unless owner = LoopKit) * Remove keepalive action from build_loop.yml - keepalive action moved to update.yml * Adapt build_loop.yml and update.yml to be run in an "actions" branch to be set as default, and used to trigger scheduled builds of the main branch. Empty commits are added to an "actions" branch only (must be created by the user and set as default) to keep this branch "alive" and allow scheduled workflows to run uninterrupted (max 60 days of inactivity). The empty commits will not be included in the resulting TestFlight builds of main. Removed conditionals regarding LoopKit repository. * build_loop.yml: Add job names for `secrets` and `upstream_sync_and_build` * update.yml: shorter job name for `check_latest_from_upstream`: Check upstream * build_loop.yml: use curl instead of wget for downloading patches * Changes to build_loop.yml and update.yml: build_loop.yml: -Remove sync action from build_loop.yml -build on schedule on the 1th every month for a predictable build schedule well within the 90 day TestFlight limit. The time of day should be chosen as a time where ongoing changes are unlikely during releases (nighttime). -rename env TARGET_BRANCH to BUILD_BRANCH - use current branch as BUILD_BRANCH for easy switching to building main or dev (manually insert alternative branch names as needed) update.yml: - check for updates every day - use current branch name for UPSTREAM_BRANCH and TARGET_BRANCH, to easily switch between dev and main by changing default branch, without any code changes. - do not run the upstream sync action on the upstream LoopKit repository - time_elapsed: 50 days for keepalive action * Add branch name to run-names - with round brackets around branch name for readability: (${{ github.ref_name }}) * Remove mention of setting TARGET_BRANCH as default, since its not fixed * Move update and keep alive features to build_loop.yml - Checks for updates nightly - Ensures repository activity - Launches Build job if new commits are found, or if run manually - Workflow file cleanup * Delete update.yml * testflight.md: update GH_PAT instructions * Change the Expiration selection to `No expiration`. * Select the `repo` and `workflow` permission scopes. * testflight.md instructions: Create a branch named "alive" * testflight.md: rephrase section on ‘Create a branch named "alive"’ * Added MixpanelService to Loop (LoopKit#63) * Added MixpanelService to Loop * Update module url * bump mixpanel * Xcode 15 Beta 3 fixes * Remove unused project refs, and update MixpanelService signing * build_loop.yml: Disable upstream sync with optional repository variable (LoopKit#67) Set an optional "SYNC_UPSTREAM" repository variable to 'false' to disable syncing of fork with the upstream repository * Update submodules (LoopKit#68) G7 Logging fix Libre Demo retain fix NightscoutRemoteCGM fix deployment target * build_loop.yml: Separate checkout repo for building (LoopKit#69) * build_loop.yml: build_loop.yml: Separate checkout repo for building Checkout for syncing without submodules: recursive * build_loop.yml: remove "submodules: recursive" from checkout for syncing, fix typo. * Bring in IRC changes and always use dynamic carbs * Bring in changes to move charts to LoopKit * Homescreen Medium Widget, and insulin suspension forecast preview * Fastlane widget bundleid updates (LoopKit#75) * Update build_loop.yml * Update build_loop.yml * Update Fastfile for widget extension bundle id change * Adding top-to-bottom algorithm test * Submodule updates * Fix for crash when running forecast previews * Tidepool Sync (LoopKit#80) * Sync script updates (LoopKit#81) * Tidepool Sync * Make sure diffs exist, merge in LoopKit updates * Bring in LoopDataManager race condition fix * Update translation repo list * Update translations from Lokalise (LoopKit#82) * Update translations from Lokalise * Bring in translations for more repos * Bring in translations for more repos * Scheduled build improvements (LoopKit#71) * Add conditional scheduled build and sync * Update testflight.md with instructions for scheduling setup * Fix typo * Remove GITHUB_TOKEN; use GH_PAT instead * Update testflight.md with instructions how to add workflow scope * Fixed conditions for scheduled build * Fix upstream repo owner * Refactor build to use workflow permissions and auto-create alive branch * Change GITHUB_TOKEN to GH_PAT * Change token to GITHUB_TOKEN where appropriate; Make env variable names more descriptive * Fix broken alive branch auto-creation * Update testflight.md with opt-out and new config info * Update cron for sync and schedule, update build condition * Fix typo… * Update testflight.md with suggestions and re-organized contents * Fix typo from PR74 * Browser Build "Validate Secrets" Improvements (LoopKit#77) * Added improved validation and more descriptive error messages * Add validations from suggestions and test feedback * Modify validate_secrets to run in readonly mode * Streamline naming 1/3 * Streamline naming 2/3 * Streamline naming 3/3, add back validation preceding build * Fix LoopWidgetExtension bundle identifier * Add fastlane patterns back after accidentally removing them * Fix Match-Secrets auto-creation and if-condition * validate_secrets.yml: Set pipefail option so that fastlane exit codes are handled correctly * workflows: Include branch in (run) names and use consistent capitalization across reusable job names * This commit is purely aesthetic and aims to make the display names of Jobs consistent across workflows. Likewise, makes spacing and validation error messages consistent. * validate_secrets.yml: Make annotations more "actionable". * validate_secrets.yml: Improve error annotations around GH_PAT permissions * Trivial changes to FASTLANE / ASC error annotations (mention 'Keys' tab) --------- Co-authored-by: Billy Booth <[email protected]> * Bump submodule refs * More carb entry fixes * Omnipod debug logging updates * Fixes for automated builds (LoopKit#83) * Fix broken upstream sync; Remove orphaned environment variable * Fix condition for automated alive branch creation * Disable meal detection when calibrations are present, and localization fix * Bring in fixes for negative duration dose prevention * Bring in functional algo support * Bring in changes for app expiration warning for testflight builds * Tidepool sync * Fix cron schedule for automated sync and build (LoopKit#87) * Fix cron schedule for sync and build * Update cron tab descriptions in testflight.md * Fix typo in comment * Adding missing hindi translations for app intents * Update build destinations * GH Actions: Improve secrets validation (LoopKit#86) * validate_secrets.yml: Pass a "Could not install WWDR certificate" error through validation * validate_secrets.yml: Improve annotation when a public Match-Secrets repo exists * validate_secrets.yml: Rewrite Match-Secrets validation to be explicit about the Match-Secrets repository that will be used When the GH account that the GH_PAT token was created under does not match the repository_owner of the LoopWorkspace repository, the validation routine used a different Match-Secrets repository than fastlane. * validate_secrets.yml: Rewrite GH_PAT validation to capture scopes and distinguish between classic and fine-grained access tokens * validate_secrets.yml: Fix syntax error in Match-Secrets validation job * validate_secrets.yml: Depend less on patterns / read scopes from any token that provides them * Provide HAS_WORKFLOW_PERMISSION as an output * validate_secrets.yml: Annotate failures from unaccepted Apple PLAs * validate_secrets.yml: Fix typo and improve annotation when GH_PAT is invalid * validate_secrets.yml: Improve annotation when authorization fails and token format is unknown * validate_secrets.yml: Minor wording tweak * Update Fastlane to 2.215.0 (LoopKit#88) * Update Gemfile.lock for Fastlane to 2.215.0 Among other improvements, this should fix the WWDR issue. * build_loop.yml: Install bundle, bundle exec - bundle install - bundle exec fastlane build_loop - bundle exec fastlane release * Update Gemfile.lock Commands used to install bundler and update dependencies: sudo gem pristine ffi sudo gem install bundler sudo bundle install sudo bundle update fastlane * Don't install bundler, which comes with Ruby 2.7+ * Install dependencies and use bundler to exec fastlane across workflows --------- Co-authored-by: Billy Booth <[email protected]> * Bring in CGM Event Store * Add Mixpanel service to sync * Bring in Tidepool sync * Bump Loop submodule rev * Service state restoration fix * Upload pod changes to Nightscout as Site Change treatments, for the cannula age (CAGE) pill * MDT Set change upload * Bug fix for mdt set change detection, and upload pump alarms to NS * Add widget fixes * Update circleci build to xcode 15 (LoopKit#89) * Update circleci build to xcode 15 * Update workflow to build with Xcode 15 * Bump device * Fix iphone version * Run tests on iOS 16.4 until iOS 17 simulators are working * Include pending insulin in dosing decision * Update build settings to avoid macos build during translation import * Bump RileyLinkKit rev * heartbeat setup fix, and OmniKit translations * Add slide button cannula insertion * Disable autolock during pod pairing (Dash) * Sync the GitHub runner clock with the Windows time server (LoopKit#98) Adding a step to workflow jobs that interface Apple servers, as a workaround for build issues caused by runner clocks being out of sync. See https://github.com/actions/runner issue number 2996 for details. name: Sync clock run: sudo sntp -sS time.windows.com Added to the following workflows / jobs: validate_secrets.yml / validate-fastlane-secrets add_identifiers.yml / identifiers build_loop.yml / build create_certs.yml / certificates * Update submodules * update to rev of SlideButton package that handles rtl languages (LoopKit#103) * Bump submodule revs * Bring in test updates for iOS 17 * include flag for DEBUG_FEATURES_ENABLED by default (LoopKit#111) * Update submodules for guardrails crash, simulator settings access, and pod pairing UI resumption * Bring in OmniBLE updates * Bring in latest submodule revs * Update browser build action dependencies to meet GH node version requirements (LoopKit#120) * Bump submodule refs * Change GITHUB_TOKEN to user-created GH_PAT (LoopKit#125) Fixes permission issues where GH api responds with: ```swift gh: Resource not accessible by integration (HTTP 403) {"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/rest/git/refs#create-a-reference"} Error: Process completed with exit code 1. ``` because the default, auto-created GITHUB_TOKEN cannot be given appropriate content write permissions to create branches in the owner's repository * Update Gemfile.lock to bump Fastlane to 2.220.0 (LoopKit#126) * Update testflight.md - apple moved keys under integrations (LoopKit#112) * Update testflight.md - apple moved keys under integrations * Fix typo * Update fastlane and macOS (LoopKit#143) * update Fastlane to 2.221.1 * update runners to macOS 14 * Update submodules * Ps2/xcode15.4 (LoopKit#145) * Update to xcode15.4 * update ios version used in circleci builds * update ios version used in circleci builds * Update build_loop.yml (LoopKit#146) * Update submodule for CGMBLEKit * Update to Loop 3.4 Release * Fix browser build sync and alive behavior (LoopKit#164) * Fix browser build sync and alive behavior - Added logic to extend the alive check for the existence of either `alive-main` or `alive-dev` branches. - Resolved an issue where unexpected successes were occurring when failures were expected. - Implemented a check to determine the existence of the `alive-main` and `alive-dev` branches and create them if they do not exist. - Introduced a mechanism to identify the current branch being run (either `main` or `dev`). - Based on the current branch, the corresponding alive branch (`alive-main` or `alive-dev`) will be used to check for upstream changes. - Set a new variable `ABORT_SYNC` to `true` when the current branch is neither `dev` nor `main`. - The syncing attempt will proceed based on the `ABORT_SYNC` variable status. - Ensured proper branch synchronization to prevent build inconsistencies and failures - Addresses issue LoopKit/Loop#2192 - Updates app store connect link for validation error hints to new Apple URL scheme * 💚 Security Fix Co-Authored-By: ebouchut <[email protected]> --------- Co-authored-by: ebouchut <[email protected]> * Update for Loop 3.4.1 * Xcode 16 updates. Loop 3.4.2 * Update Gemfile.lock for Fastlane 2.223.1 (LoopKit#208) * Update submodules for Loop 3.4.3 (LoopKit#211) * Update submodules * LoopKit: Improve selection choice visibility * LoopKit: fix locale for CarbEntry decimal separator * Loop: update version number to 3.4.3 * Loop 3.4.4 * Fix submodule refs for v3.4.4 * Restore main submodule ref for 3.4.4 --------- Co-authored-by: Pete Schwamb <[email protected]> Co-authored-by: bjornoleh <[email protected]> Co-authored-by: Marion Barker <[email protected]> Co-authored-by: Cameron Ingham <[email protected]> Co-authored-by: Noah Brauner <[email protected]> Co-authored-by: Deniz Cengiz <[email protected]> Co-authored-by: Billy Booth <[email protected]> Co-authored-by: Marion Barker <[email protected]> Co-authored-by: ebouchut <[email protected]>
This PR builds on the scheduled sync and build functionality introduced by @bjornoleh. It makes the feature truly opt-in rather than breaking existing browser build setups for Loop.
Proposed changes:
SCHEDULED_BUILD
andSCHEDULED_SYNC
and replacesSYNC_UPSTREAM
.(1) Scheduled build and (2) scheduled sync (with build).
Utilizes GH workflow permissions andsecrets.GITHUB_TOKEN
for any repo-based tasks during keepalive and scheduled sync, thereby avoiding changes toGH_PAT
access roles (addingworkflow
role no more necessary)The automated build will now run on the following conditions:
Required changes:
alive
branch based onLoopKit/LoopWorkspace:dev
SCHEDULED_BUILD
set totrue
SCHEDULED_SYNC
set totrue
Thanks to @bjornoleh for laying the groundwork and to @billybooth for being a great sparring partner