【问题标题】:How to commit file to github using REST API for CI integration如何使用 REST API 将文件提交到 github 以进行 CI 集成
【发布时间】:2022-01-20 06:25:00
【问题描述】:

我想通过 REST API 将我的 .apk 文件发送到 github 存储库。

文件正在转换为 base64 并作为 blob 发送:

BLOB_SHA=$(curl -X POST  https://api.github.com/repos/{user}/{repo}/git/blobs -H "Accept: application/vnd.github.v3.raw+json" -H "Authorization: Basic {token}" -d '{"content":{my app in base64},"encoding":"utf-8|base64"}' | jq '.sha')

但这里有一条消息:

bash: /mingw64/bin/curl: Argument list too long

我尝试实现的是:在 Codemagic 上构建 apk,将 apk 发送到 github,触发 appium 测试自动化。

也许还有其他连接 Codemagic 构建和 appium 测试的可能性?

【问题讨论】:

    标签: android bash github integration codemagic


    【解决方案1】:

    在您构建 apk 之后,使用 Codemagic 运行 Appium 测试可能会更好。在这种情况下,您不需要将任何二进制文件提交回存储库。检查此链接以查看如何运行 Appium 测试的示例https://docs.codemagic.io/yaml-testing/testing/#react-native-integration-tests-using-appium-and-emulator

    但是,如果您仍想提交文件,您可以只使用 git 命令,但请确保您具有写入权限(例如查看此链接 https://docs.codemagic.io/knowledge-base/add-a-git-tag-with-app-version/

    【讨论】:

    • Hej。谢谢你的回答。我想知道第一个链接中的选项是否仅适用于应用程序项目中的 appium 测试。在我的情况下,我有两个项目分开:1 用于颤振应用程序,2 用于 appium 测试 - 在这里我需要访问 apk 文件。我也尝试使用选项 2 中的 git 命令,但 LFS 存在问题,因为 codemagic 会推送所有生成的文件。
    • 您可以在构建期间使用 appium 测试克隆第二个 repo...无论如何它会更快且“更干净”的方法
    猜你喜欢
    • 2019-08-28
    • 2012-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-17
    • 2022-06-16
    相关资源
    最近更新 更多