Github actions kotlin8/31/2023 ![]() One of the biggest CI projects in Mercari is the Android client application, where we are continuously improving the app and pushing weekly updates on the Google Play Store. In this blog post, I will outline the multistep strategy we adopted over the years to transition our Android CI from being a mix of loosely coupled integrations to a consistent environment maintainable by any engineer familiar with Kotlin. Run: kotlin /path/in/repo/to/, my name is Pierrick, and I’m a member of the Architecture Team at Mercari. There is also a GitHub action called setup-kotlin that lets you install your desired version of Kotlin and also provides some more features. ![]() Val readmeFirstLine = input.readLines().first() Val input = File("README.md") // Assuming you ran checkout before ![]() Run: kotlin /path/in/repo/to/Īnd here is an example file: java.io.File main.kts scripts like this: name: Example Refer to the GitHub Actions runner images 1 to see all the installed software. Kotlin runner is now pre-installed on GitHub Actions environments ( GitHub issue, YouTube video). Note that if the script has the execute ( x) permission, as I told previously, you can remove the kotlinc -script part and it will still run.īonus: it is possible to have Kotlin code directly in the workflow file (though I'd not recommend doing it), by using kotlin as a shell. workflow file) that will take an input and pass it to your Kotlin script (usable in the args property/parameter) after it installed Kotlin: name: Run Kotlin script If you add the execute permission to the file ( chmod +x on Linux/macOS), you'll also be able to run it just like any other script, without having to type kotlinc -script before, and that will apply on GitHub Actions as well.įinally, here's an example manual GitHub Action (aka. That will be helpful to test the script locally before running in CI, as the IDE will show a run button in the gutter, next to the shebang. Second, ensure that its first line is the shebang pointing to the right place: #!/usr/bin/env kotlin IntelliJ IDEA, Android Studio), especially when it comes to autocompletion and type analysis. ![]() main.kts as that latter one will be recognized better by the IDE (e.g. UPDATE: Kotlin is now pre-installed on GitHub Actions runners, no need to install it beforehand anymore.įirst, ensure that you have a proper Kotlin script, ending in. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |