diff --git a/.github/workflows/ci-linter-license_checker.yml b/.github/workflows/ci-linter-license_checker.yml index 5ca1c8925..9c0997428 100644 --- a/.github/workflows/ci-linter-license_checker.yml +++ b/.github/workflows/ci-linter-license_checker.yml @@ -16,8 +16,13 @@ jobs: license_checker: name: lint runs-on: ubuntu-24.04 + permissions: + pull-requests: write steps: + - name: Collect Workflow Telemetry + uses: catchpoint/workflow-telemetry-action@v2 + - name: Checkout uses: actions/checkout@v4 with: diff --git a/.github/workflows/ci-linter-pre_commit_hooks.yml b/.github/workflows/ci-linter-pre_commit_hooks.yml index 1c5b04589..58cd0e1f6 100644 --- a/.github/workflows/ci-linter-pre_commit_hooks.yml +++ b/.github/workflows/ci-linter-pre_commit_hooks.yml @@ -15,19 +15,30 @@ concurrency: jobs: swift_format: name: pre-commit hooks - runs-on: [self-hosted, iOS] + runs-on: ubuntu-24.04 strategy: fail-fast: false matrix: files: [changed_files, all_files] + permissions: + pull-requests: write steps: + - name: Collect Workflow Telemetry + uses: catchpoint/workflow-telemetry-action@v2 + - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 2 lfs: true + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + cache: "pip" + - name: Set up mise uses: jdx/mise-action@v2 with: @@ -35,12 +46,25 @@ jobs: install: true cache: true - - uses: actions/cache@v4 + - name: Install pre-commit + run: | + python -m pip install --upgrade pip + pip install pre-commit + pre-commit --version + + - name: Install tools + run: | + npm install -g ajv-cli + pre-commit install + pre-commit autoupdate + + - name: Cache pre-commit + uses: actions/cache@v4 with: path: ~/.cache/pre-commit - key: pre-commit-${{ runner.name }}-${{ hashFiles('.pre-commit-config.yaml') }} + key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} restore-keys: | - pre-commit-${{ runner.name }}- + pre-commit-${{ runner.os }}- pre-commit- - name: Run pre-commit hooks --all-files @@ -52,4 +76,4 @@ jobs: - name: Run pre-commit hooks --files if: matrix.files == 'changed_files' run: | - pre-commit run --show-diff-on-failure --color=always --files $(git diff --name-only -r HEAD^1 HEAD) + pre-commit run --show-diff-on-failure --color=always --files $(git diff --name-only -r HEAD^1 HEAD --diff-filter=AMCR) diff --git a/.github/workflows/ci-linter-swiftformat.yml b/.github/workflows/ci-linter-swiftformat.yml index 60609d43a..1e92f7e60 100644 --- a/.github/workflows/ci-linter-swiftformat.yml +++ b/.github/workflows/ci-linter-swiftformat.yml @@ -17,9 +17,14 @@ concurrency: jobs: swift_format: name: swiftformat - runs-on: [self-hosted, iOS] + runs-on: [ubuntu-24.04] + permissions: + pull-requests: write steps: + - name: Collect Workflow Telemetry + uses: catchpoint/workflow-telemetry-action@v2 + - name: Checkout uses: actions/checkout@v4 with: @@ -34,9 +39,11 @@ jobs: cache: true - name: Setup mise - run: | - echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH - mise install + uses: jdx/mise-action@v2 + with: + version: 2024.12.4 + install: true + cache: true - name: Run swiftformat run: | diff --git a/.github/workflows/ci-linter-swiftlint.yml b/.github/workflows/ci-linter-swiftlint.yml index 242ac519f..1f40c8a6d 100644 --- a/.github/workflows/ci-linter-swiftlint.yml +++ b/.github/workflows/ci-linter-swiftlint.yml @@ -17,9 +17,14 @@ concurrency: jobs: swift_format: name: swiftlint - runs-on: [self-hosted, iOS] + runs-on: [ubuntu-24.04] + permissions: + pull-requests: write steps: + - name: Collect Workflow Telemetry + uses: catchpoint/workflow-telemetry-action@v2 + - name: Checkout uses: actions/checkout@v4 with: diff --git a/.github/workflows/ci-tuist-build-github_hosted.yml b/.github/workflows/ci-tuist-build-github_hosted.yml new file mode 100644 index 000000000..e8d40a89d --- /dev/null +++ b/.github/workflows/ci-tuist-build-github_hosted.yml @@ -0,0 +1,146 @@ +# Leka - iOS Monorepo +# Copyright APF France handicap +# SPDX-License-Identifier: Apache-2.0 + +name: Tuist - Build (GitHub Hosted) + +on: + push: + branches: + - develop + paths: + - "**/*.swift" + - ".mise.toml" + pull_request: + types: [opened, synchronize, reopened] + paths: + - "**/*.swift" + - ".mise.toml" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + TUIST_TURN_OFF_LINTERS: TRUE + TUIST_GENERATE_EXAMPLE_TARGETS: TRUE + TUIST_GENERATE_MODULES_AS_FRAMEWORKS_FOR_DEBUG: FALSE + +jobs: + build: + name: build + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + TUIST_DEVELOPER_MODE: [TRUE, FALSE] + permissions: + pull-requests: write + + steps: + - name: Collect Workflow Telemetry + uses: catchpoint/workflow-telemetry-action@v2 + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + + - name: Setup mise + uses: jdx/mise-action@v2 + with: + version: 2024.12.4 + install: true + cache: true + + - name: tuist version + run: | + which tuist + tuist version + + - name: Cache Xcode derived data + uses: irgaly/xcode-cache@v1 + with: + key: xcode-cache-tuist_build_github_hosted-DEVELOPER_MODE_${{ matrix.TUIST_DEVELOPER_MODE }}-${{ github.sha }} + restore-keys: | + xcode-cache-tuist_build_github_hosted-DEVELOPER_MODE_${{ matrix.TUIST_DEVELOPER_MODE }}- + xcode-cache-tuist_build_github_hosted- + xcode-cache- + delete-used-deriveddata-cache: true + swiftpm-package-resolved-file: Tuist/Package.resolved + use-default-mtime-targets: true + restore-mtime-targets: | + **/*.bin + **/*.gif + **/*.jpeg + **/*.jpg + **/*.mid + **/*.mp3 + **/*.pdf + **/*.png + **/*.svg + **/*.wav + **/*.json + **/*.xcstrings + **/*.mp4 + **/*.yml + + - name: Cache SPM data + uses: actions/cache@v4 + with: + path: | + ~/Library/Caches/org.swift.swiftpm + ~/Library/org.swift.swiftpm + key: spm-cache-tuist_build_github_hosted-DEVELOPER_MODE_${{ matrix.TUIST_DEVELOPER_MODE }}-${{ github.sha }} + restore-keys: | + spm-cache-tuist_build_github_hosted-DEVELOPER_MODE_${{ matrix.TUIST_DEVELOPER_MODE }}- + spm-cache-tuist_build_github_hosted- + spm-cache- + + - name: Cache tuist data + uses: actions/cache@v4 + with: + path: | + Tuist/.build/artifacts + Tuist/.build/checkouts + Tuist/.build/derived + Tuist/.build/workspace-state.json + key: spm-cache-tuist_build_github_hosted-DEVELOPER_MODE_${{ matrix.TUIST_DEVELOPER_MODE }}-${{ github.sha }} + restore-keys: | + spm-cache-tuist_build_github_hosted-DEVELOPER_MODE_${{ matrix.TUIST_DEVELOPER_MODE }}- + spm-cache-tuist_build_github_hosted- + spm-cache- + + - name: restore files' mtime + uses: chetan/git-restore-mtime-action@v2 + + - name: Config Xcode + run: | + xcodes select 16.1 + defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES + + - name: tuist install + run: | + TUIST_TURN_OFF_LINTERS=${{ env.TUIST_TURN_OFF_LINTERS }} \ + TUIST_GENERATE_EXAMPLE_TARGETS=${{ env.TUIST_GENERATE_EXAMPLE_TARGETS }} \ + TUIST_GENERATE_MODULES_AS_FRAMEWORKS_FOR_DEBUG=${{ env.TUIST_GENERATE_MODULES_AS_FRAMEWORKS_FOR_DEBUG }} \ + TUIST_DEVELOPER_MODE=${{ matrix.TUIST_DEVELOPER_MODE }} \ + tuist install + + - name: tuist generate + run: | + TUIST_TURN_OFF_LINTERS=${{ env.TUIST_TURN_OFF_LINTERS }} \ + TUIST_GENERATE_EXAMPLE_TARGETS=${{ env.TUIST_GENERATE_EXAMPLE_TARGETS }} \ + TUIST_GENERATE_MODULES_AS_FRAMEWORKS_FOR_DEBUG=${{ env.TUIST_GENERATE_MODULES_AS_FRAMEWORKS_FOR_DEBUG }} \ + TUIST_DEVELOPER_MODE=${{ matrix.TUIST_DEVELOPER_MODE }} \ + tuist generate --no-open + + - name: tuist build + run: | + + TUIST_TURN_OFF_LINTERS=${{ env.TUIST_TURN_OFF_LINTERS }} \ + TUIST_GENERATE_EXAMPLE_TARGETS=${{ env.TUIST_GENERATE_EXAMPLE_TARGETS }} \ + TUIST_GENERATE_MODULES_AS_FRAMEWORKS_FOR_DEBUG=${{ env.TUIST_GENERATE_MODULES_AS_FRAMEWORKS_FOR_DEBUG }} \ + TUIST_DEVELOPER_MODE=${{ matrix.TUIST_DEVELOPER_MODE }} \ + tuist build diff --git a/.github/workflows/ci-tuist-build.yml b/.github/workflows/ci-tuist-build.yml index 45cda7147..f7ca30884 100644 --- a/.github/workflows/ci-tuist-build.yml +++ b/.github/workflows/ci-tuist-build.yml @@ -34,8 +34,13 @@ jobs: fail-fast: false matrix: TUIST_DEVELOPER_MODE: [TRUE, FALSE] + permissions: + pull-requests: write steps: + - name: Collect Workflow Telemetry + uses: catchpoint/workflow-telemetry-action@v2 + - name: Checkout uses: actions/checkout@v4 with: @@ -49,6 +54,11 @@ jobs: install: true cache: true + - name: tuist version + run: | + time which tuist + time tuist version + - name: tuist install run: | TUIST_TURN_OFF_LINTERS=${{ env.TUIST_TURN_OFF_LINTERS }} \ diff --git a/.github/workflows/ci-tuist-unit_tests.yml b/.github/workflows/ci-tuist-unit_tests.yml index f000bd60c..fbaf19f6b 100644 --- a/.github/workflows/ci-tuist-unit_tests.yml +++ b/.github/workflows/ci-tuist-unit_tests.yml @@ -28,8 +28,13 @@ jobs: unit_tests: name: unit tests runs-on: [self-hosted, iOS] + permissions: + pull-requests: write steps: + - name: Collect Workflow Telemetry + uses: catchpoint/workflow-telemetry-action@v2 + - name: Checkout uses: actions/checkout@v4 with: