Skip to content
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

Optimise coins asset files #87

Closed
wants to merge 18 commits into from
Closed

Optimise coins asset files #87

wants to merge 18 commits into from

Conversation

takenagain
Copy link
Collaborator

@takenagain takenagain commented Dec 12, 2023

Optimise repository size by removing coins asset files and replacing them with a Python script that downloads the assets in CI/CD pipelines and local developer build steps.

Changes:

  • Add a Python script to download the coins asset files from the coins repository.
  • Remove the copies of the coin asset files from this repository to reduce the repository size.
  • Update the GitHub build-android action and the README.md to use the Python script to download the coins asset files.

Load coins config files and icons from the github repository and
branch specified in coins_ci.json
Exclude coin files from the repository as they
will be downloaded using the python script
when setting up dev environment or deploying
Cleans existing coin asset files and redownloads assets
@takenagain takenagain changed the title Optimise coins asset files sourcing Optimise coins asset files Dec 13, 2023
@CharlVS
Copy link
Member

CharlVS commented Dec 13, 2023

@takenagain thanks, it's looking good. Can you write a Flutter test that checks that all loaded coins have a corresponding coin icon? You won't be able to simply scan through the json coin data files and check that each entry has a matching file in the icons folder. You will need to use the app's logic to filter out coins that are not shown in the app (not all coins are supported) and then use the app's function for mapping coin ticker to the icon file name.

@CharlVS
Copy link
Member

CharlVS commented Dec 13, 2023

@takenagain we have the runtime update parameters specified here.

Please make the following changes:

  1. Refactor the coins_updater.dart and your CI script to read from a revised coins_ci.json.

The revised coins_ci.json file should have the following format. Feel free to improve on it if you see any opportunities.

{
    "bundled_coins_repo_commit": "8cb5983ab858dde915e8de3175c15cd0f5572356",
    "coins_repo_url": "https://raw.githubusercontent.com/KomodoPlatform/coins",
    "coins_repo_branch": "master",
    "runtime_updates_enabled": true,
    "mapped_files": {
        "assets/coins_config.json": "utils/coins_config.json",
        "assets/coins.json": "coins"
    },
    "mapped_folders": {
        "assets/coin-icons/": "icons/"
    }
}
  1. Update the bundled commit hash in coins_ci.json when the script runs. If the script is running in a GH action then fail the check if the downloaded files' commit doesn't match the commit hash in bundled_coins_repo_commit. I.e. There are uncommitted changes to coins_ci.json after the script runs.

CharlVS added a commit that referenced this pull request Dec 17, 2023
Even though coin config files are updated at runtime, it’s a good idea to keep the bundled version up to date since it’s used on the first launch and is used as a fallback if update fails.

NB: In the near future, these files will be dropped from the repo and instead rather fetched at CI build time in PR #87 (#87).
@takenagain
Copy link
Collaborator Author

This approach was abandoned in favour of asset transformation, which is integrated into Flutter's build process.

@takenagain takenagain closed this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants