Skip to content

Merge pull request #1331 from wakmusic/1330-faq-numberoflines #1624

Merge pull request #1331 from wakmusic/1330-faq-numberoflines

Merge pull request #1331 from wakmusic/1330-faq-numberoflines #1624

Workflow file for this run

name: CI
on:
pull_request:
paths:
- ".github/workflows/CI.yml"
- "**/*.swift"
push:
branches:
- develop
- master
env:
CACHED_PACKAGE_DEPENDENCY_PATHS: ${{ github.workspace }}/.build
CACHED_CARTHAGE_DEPENDENCY_PATHS: ${{ github.workspace }}/Carthage
GOOGLE_SERVICE_INFO_PLIST_PATH: Projects/App/Resources/GoogleService-Info.plist
SECRET_XCCONFIG_PATH: Projects/App/XCConfig/Secrets.xcconfig
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prepare-ci:
name: ⚙️ Prepare CI
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Select Xcode 16.0
run: sudo xcode-select -s /Applications/Xcode_16.0.app/Contents/Developer
- name: Compute package dependency cache key
id: compute_package_hash
run: echo "package_hash=${{ hashFiles('Package.swift') }}" >> $GITHUB_OUTPUT
- name: Check package dependency cache
uses: actions/cache@v3
id: cache_package_dependencies
with:
path: ${{ env.CACHED_PACKAGE_DEPENDENCY_PATHS }}
key: ${{ steps.compute_package_hash.outputs.package_hash }}
- name: Compute carthage dependency cache key
id: compute_carthage_hash
run: echo "carthage_hash=${{ hashFiles('Cartfile') }}" >> $GITHUB_OUTPUT
- name: Check carthage dependency cache
uses: actions/cache@v3
id: cache_carthage_dependencies
with:
path: ${{ env.CACHED_CARTHAGE_DEPENDENCY_PATHS }}
key: ${{ steps.compute_carthage_hash.outputs.carthage_hash }}
- name: Echo dependency cache hit
run: |
echo "package cache hit = ${{ steps.cache_package_dependencies.outputs.cache-hit }}"
echo "carthage cache hit = ${{ steps.cache_carthage_dependencies.outputs.cache-hit }}"
- uses: jdx/mise-action@v2
if: steps.cache_package_dependencies.outputs.cache-hit == '' || steps.cache_carthage_dependencies.outputs.cache-hit == ''
- name: Install tuist
if: steps.cache_package_dependencies.outputs.cache-hit == '' || steps.cache_carthage_dependencies.outputs.cache-hit == ''
run: |
brew install carthage
mise install tuist
- name: Install dependencies needs
if: steps.cache_package_dependencies.outputs.cache-hit == '' || steps.cache_carthage_dependencies.outputs.cache-hit == ''
run: make install
outputs:
package_dependency_cache_key: ${{ steps.compute_package_hash.outputs.package_hash }}
carthage_dependency_cache_key: ${{ steps.compute_carthage_hash.outputs.carthage_hash }}
test:
name: 🧪 Test
runs-on: macos-15
needs: prepare-ci
steps:
- uses: actions/checkout@v3
- name: List Xcode installations
run: sudo ls -1 /Applications | grep "Xcode"
- name: Select Xcode 16.0
run: sudo xcode-select -s /Applications/Xcode_16.0.app/Contents/Developer
- name: Show swift version
run: swift --version
- uses: jdx/mise-action@v2
- name: Install tuist
run: |
brew install carthage
mise install tuist
- name: Check package dependency cache
uses: actions/cache@v3
id: cache_package_dependencies
with:
path: ${{ env.CACHED_PACKAGE_DEPENDENCY_PATHS }}
key: ${{ needs.prepare-ci.outputs.package_dependency_cache_key }}
- name: Check carthage dependency cache
uses: actions/cache@v3
id: cache_carthage_dependencies
with:
path: ${{ env.CACHED_CARTHAGE_DEPENDENCY_PATHS }}
key: ${{ needs.prepare-ci.outputs.carthage_dependency_cache_key }}
- name: Echo dependency cache hit
run: |
echo "package cache hit = ${{ steps.cache_package_dependencies.outputs.cache-hit }}"
echo "carthage cache hit = ${{ steps.cache_carthage_dependencies.outputs.cache-hit }}"
- name: Install needle
run: brew install needle
- name: Install dependencies needs
if: steps.cache_package_dependencies.outputs.cache-hit == '' || steps.cache_carthage_dependencies.outputs.cache-hit == ''
run: make install
- name: Make `Secrets.xcconfig`
run: |
mkdir Projects/App/XCConfig
touch ${{ env.SECRET_XCCONFIG_PATH }}
echo "" > ${{ env.SECRET_XCCONFIG_PATH }}
- name: Make `GoogleService-Info.plist`
run: |
touch ${{ env.GOOGLE_SERVICE_INFO_PLIST_PATH }}
echo "${{ secrets.GOOGLE_INFO_PLIST }}" > ${{ env.GOOGLE_SERVICE_INFO_PLIST_PATH }}
- name: Generate NeedleGenerated.swift
run: |
sh Scripts/NeedleRunScript.sh ci
echo finish NeedleRunScript
- name: Test with tuist
run: make test