ãã®è¨äºã¯Â BASE Advent Calendar 2023 ã®18æ¥ç®ã®è¨äºã§ãã
Pay ID Appã°ã«ã¼ãã®åå·ã§ããã·ã§ããã³ã°ã¢ããªãPay IDãã®éçºãã¼ã ã§ã¨ã³ã¸ãã¢ãªã³ã°ããã¼ã¸ã£ã¼ãæ å½ãã¦ãã¾ãã
iOSã¢ããªéçºã§ä¾å管çã«ä½¿ã£ã¦ãã Mint ã®ãã¼ã¸ã§ã³ã¢ãããã¼ãã GitHub Actions ã使ã£ã¦èªååãã話ããã¾ãã
Mint ã¨ã¯
Mint 㯠Swift 製ã®ã©ã¤ãã©ãªã®ããã±ã¼ã¸ããã¼ã¸ã£ã§ãã
https://github.com/yonaskolb/Mint
ç§ãã¡ã®iOSã¢ããªã®ããã¸ã§ã¯ãã§ã¯ã以ä¸ã®ãããªãã«ããã¼ã«ç³»ã®ã©ã¤ãã©ãªã®ä¾å管çã«1å¹´ã»ã©å©ç¨ãã¦ãã¾ãï¼ã¢ããªæ¬ä½ã®ä¾å管çã«ã¯ Swift Package Manager ã使ã£ã¦ãã¾ãï¼ã
- SwiftLint
- Mockolo
- IBLinter
- SwiftFormat
- XcodeGen
- periphery
- LicensePlist
- SwiftGen
ãã¨ãã¨ãããã¸ã§ã¯ããªãã¸ããªã®ä¸ã« BuildTools ã¨ãããã£ã¬ã¯ããªãã¤ããããã®ãªãã«ã¢ããªã±ã¼ã·ã§ã³æ¬ä½ã§ã¯å©ç¨ããªããã¼ã«ç¾¤ã Package.swift ã§å®ç¾©ããã«ããã¦ãã¾ããã
ããããè¤æ°ã®ã©ã¤ãã©ãªãå©ç¨ãã¦ããå ´åãããããã§å©ç¨ãã¦ããä¾åé¢ä¿ã®ãã¼ã¸ã§ã³ãè¡çªãããã¨ããã³ãã³ããããããã·ã³ãã«ãªæ¹æ³ãæ¤è¨ããçµæ Mint ãæ¡ç¨ãããã¨ã«ãã¾ããã
ãµã¼ããã¼ãã£è£½ã®ã©ã¤ãã©ãªã§ã¯ããã¾ãããã·ã³ãã«ãªå®ç¾©ãã¡ã¤ã«ã§ãã¼ã¸ã§ã³ãåºå®ãããã¨ãã§ãããã¤ãã£ãã·ã¥ãæ±ãããããã¨ãã¡ãªããã¨æãã¦ãã¾ãã
åè£ã¨ãã¦ãã«ãä¸è¦ã§å©ç¨ã§ãã Homebrew ãä¸ããã¾ãããããã¼ã éçºãããä¸ã§åã¡ã³ãã®ãã·ã³ãå®è¡ç°å¢ã§å©ç¨ãããã¼ã¸ã§ã³ãåºå®ããããããç§ãã¡ã¯é¸æãã¾ããã§ããã
éè¦ãããã¤ã³ã | ãã¼ã¸ã§ã³åºå® | ä¾å管çé£æ度 | CIã§ã®ãã£ãã·ã¥ç®¡ç |
---|---|---|---|
SPM | âï¸ | â | âï¸ |
Homebrew | â | âï¸ | â |
Mint | âï¸ | âï¸ | âï¸ |
ã¡ãªã¿ã« Mint èªä½ãã©ããã£ã¦ã¤ã³ã¹ãã¼ã«ãããã¨ãã課é¡ãããã®ã§ããããã㯠Homebrew ã使ã£ã¦ã¤ã³ã¹ãã¼ã«ãããã¨ã§å¦¥åãã¦ãã¾ãã
ãã¼ã¸ã§ã³ã®æ´æ°ãèªååããã
ãã¦ãMint ã§ã¯ Mintfile ã¨ãããã¡ã¤ã«ã§ããã±ã¼ã¸ã®ãã¼ã¸ã§ã³ãåºå®ãããã¨ãã§ãã¾ãã
yonaskolb/[email protected] yonaskolb/[email protected]
ãããã®ããã±ã¼ã¸ã¯å®æçã«ã¢ãããã¼ãããããã¨ã¯æãã¤ã¤ã Linter ãªã©ã管çãããããã±ã¼ã¸ã§ãã£ãã®ã§ã¢ãããã¼ãããªãã¨ãããç¨åº¦åãããå¾åãã«ãªããã¡ã¨ãã課é¡ãããã¾ããã
Renovate ã使ã£ã¦ã¢ãããã¼ãããPRãä½ãããã ã¨ãããã¾ããããå¼ç¤¾ã§ã¯ç¾æç¹ã§å°å ¥ãã¦ãããã å¥ã®æ¹æ³ãæ¤è¨ãã¾ããã
Mintfile èªä½ã¯ã·ã³ãã«ãªãã©ã¼ãããã§ãããSwift Package Manager ã tag ã使ã£ã¦ãã¼ã¸ã§ã³ç®¡çãè¡ãä»çµã¿ãªã®ã§ãGitHub Action ã§æååæä½ã¨ GitHub API ãçµã¿åããããã¨ã§ãµã¯ãã¨å®ç¾ã§ããã®ã§ã¯ã¨èãã¾ããã
ããã±ã¼ã¸ã®åã ãæ´æ°ãã§ãã¯ãããããã«åçã« matrix ãè¨å®ãã
ãã¼ã ã§ã¯éå»ã« CocoaPods ã Swift Package Manager ã§ç®¡çãã¦ããã©ã¤ãã©ãªã®å®æçãªæ´æ°ãã§ãã¯ã CI ã§èªåã§å®ç¾ãã¦ããã®ã§ãããè¤æ°ã®ã©ã¤ãã©ãªã®ã¢ãããã¼ãã1ã¤ã® Pull Request ã§è¡ããããªä»çµã¿ã«ãªã£ã¦ãã¾ããã
ãã®ãããªä»çµã¿ã ã¨ãAãBã¨ããæ´æ°å¯è½ãªã©ã¤ãã©ãªããããAã¯æ´æ°ã容æã ãBã¯ããã«ã¯æ´æ°ã§ããªããã¨ãããããªå ´åã«Aãæ´æ°ã§ããªããã¨ããç¹ã§ä½¿ãã¥ãããæãã¦ãã¾ããã
ããã§ã以ä¸ã®ã¹ãããã®ããã«åããã±ã¼ã¸æ¯ã«æ´æ°ããã§ãã¯ãå¿ è¦ãªã Pull Request ãä½æã§ããããã«ããä»çµã¿ãç®æãã¾ããã
- Mintfile ã«å®ç¾©ããã¦ããä¾åãåãåºã
- 1ã§åãåºããããã±ã¼ã¸æ¯ã«ã¸ã§ããå®è¡ãã
- åã¸ã§ãã§ããã±ã¼ã¸ã®ææ°ãã¼ã¸ã§ã³ããã§ãã¯
Using a matrix for your jobs - GitHub Docs
GitHub Actions ã«ã¯ matrix ãã¼ã¯ã¼ãã使ã£ã¦ãå®ç¾©ããããã¿ã¼ã³åã®å¤æ°ã使ã£ã¦ã¸ã§ããå®è¡ãããã¨ãã§ãã¾ãã
jobs: example_matrix: strategy: matrix: version: [10, 12, 14] os: [ubuntu-latest, windows-latest]
ãã® matrix ã¯åçã«è¨å®ãããã¨ãã§ããã®ã§ã Mintfile ã§å®ç¾©ããåã®ããã±ã¼ã¸ã matrix ã¨ãã¦è¨å®ããããã«ãã¾ãã
ã¾ãã Mintfile ã1è¡æ¯ã«åå²ãé åã® JSON å½¢å¼ã«ãã¾ãã
jobs: # Mintfile ããä¾åé¢ä¿ãåå¾ãã¦ãããã Matrix ã«ããããã« JSON ã«å¤æãã¦åºåãã prepare-mint-dependencies: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: make matrix for each mint dependencies id: set-matrix run: | MINT_DEPENDENCIES=$(cat Mintfile | sed -e 's/#.*$//' | sed -e '/^$/d' | jq -R -s -c 'split("\n") | map(select(. != ""))') echo "dependencies=${MINT_DEPENDENCIES}" >> $GITHUB_OUTPUT outputs: dependencies: ${{ steps.set-matrix.outputs.dependencies }}
ä¾ã¨ã㦠JSON ã¯ãã®ããã«ãªã£ã¦ããã¤ã¡ã¼ã¸ã§ãã
["realm/[email protected]","IBDecodable/[email protected]","nicklockwood/[email protected]","yonaskolb/[email protected]","uber/[email protected]","mono0926/[email protected]","peripheryapp/[email protected]","SwiftGen/[email protected]"]
次ã«ãåºåãã outputs ã使ã£ã¦ matrix ãå®ç¾©ãã¾ãã
# åä¾åé¢ä¿ã®ãªãã¸ããªãåç §ãã¦ãææ°ã®ãã¼ã¸ã§ã³ãåå¾ãã check-update: runs-on: ubuntu-latest needs: prepare-mint-dependencies strategy: matrix: mint-dependency: ${{fromJson(needs.prepare-mint-dependencies.outputs.dependencies)}} fail-fast: false steps: - name: print dependencies run: | echo ${{ matrix.mint-dependency }}
ãããããã¨ã§1åã®ã¯ã¼ã¯ããã¼ãèµ·ç¹ã«ä¾åãã¦ããããã±ã¼ã¸æ¯ã«æ´æ°ããã§ãã¯ãããã¨ãã§ããããã«ãªãã¾ãã
ãã¨ã¯ãåã©ã¤ãã©ãªã®ãªãã¸ããªãè¦ã«è¡ã£ã¦ææ°ãã¼ã¸ã§ã³ãããã確èªãå¿ è¦ãªã PR ãä½æããã°è¯ãã¨ããæµãã«ãªãã¾ãã
ã¡ãªã¿ã«ãææ°ãã¼ã¸ã§ã³ãåå¾ããå ´å㯠github-script ã便å©ã§ãã
# GitHub Scriptã§ææ°ã®ãã¼ã¸ã§ã³ãåå¾ãã - name: find latest version from GitHub API id: get-latest-version uses: actions/github-script@v7 with: script: | const { data } = await github.repos.getLatestRelease({ owner: '${{ env.REPO_OWNER }}', repo: '${{ env.REPO_NAME }}', }) return data.tag_name result-encoding: string
ãããã«
ãã®ããã«ã㦠Mint ã§ç®¡çãã¦ããããã±ã¼ã¸ã®æ´æ°ãã§ãã¯ã GitHub Actions ã使ã£ã¦å®ç¾ãããã¨ãã§ãã¾ããã matrix ã使ããã¨ã§ãã種ããã°ã©ãã³ã°çã«ã¯ã¼ã¯ããã¼ãå¶å¾¡ã§ããã®ã§ãèªååã®å¹ ãåºããã¨æãã¦ãã¾ãã
ææ¥ã®19æ¥ç®ã¯ ImazekiShota ããã®è¨äºã§ããã楽ãã¿ã«ï¼