Merge pull request #8796 from nextcloud/ci/noid/ci-improvements

ci(macOS): split up jobs to allow retrying from a specific step
This commit is contained in:
Matthieu Gallien 2025-09-26 11:46:25 +02:00 committed by GitHub
commit 9e9b680a9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 164 additions and 41 deletions

View File

@ -1,25 +1,32 @@
# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-2.0-or-later
name: macOS Build and Test
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_call:
inputs:
CRAFT_TARGET:
type: string
required: true
CRAFT_MASTER_LOCATION:
type: string
required: true
CRAFT_MASTER_CONFIG:
type: string
required: true
PYTHON_VERSION:
type: string
required: true
buildFileProviderModule:
type: string
required: true
jobs:
build:
name: macOS Build and Test
name: Build nextcloud-client
timeout-minutes: 60
runs-on: macos-15
strategy:
matrix:
craft_options: [
'--options nextcloud-client.buildFileProviderModule=False',
'--options nextcloud-client.buildFileProviderModule=True'
]
env:
CRAFT_TARGET: macos-clang-arm64
CRAFT_MASTER_LOCATION: ${{ github.workspace }}/CraftMaster
CRAFT_MASTER_CONFIG: ${{ github.workspace }}/craftmaster.ini
CRAFT_BLUEPRINT_OPTIONS: ${{ matrix.craft_options }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
@ -27,48 +34,58 @@ jobs:
- name: List Xcode installations
run: sudo ls -1 /Applications | grep "Xcode"
- name: Select Xcode 16.2
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Restore cache
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ~/cache
key: macos-latest-${{ env.CRAFT_TARGET }}
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ inputs.PYTHON_VERSION }}
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: 3.12
python-version: ${{ inputs.PYTHON_VERSION }}
- name: Install Homebrew dependencies
run: |
brew install homebrew/cask/inkscape
- name: Download Craft
run: |
git clone -q --depth=1 https://invent.kde.org/packaging/craftmaster.git ${{ env.CRAFT_MASTER_LOCATION }}
- name: Restore cached Craft directories
uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: |
${{ inputs.CRAFT_MASTER_LOCATION }}
${{ github.workspace }}/craft-clone
${{ github.workspace }}/${{ inputs.CRAFT_TARGET }}
key: ${{ runner.os }}-craft-${{ hashFiles(inputs.CRAFT_MASTER_CONFIG) }}
- name: Add required blueprint repositories
- name: Build nextcloud-client
run: |
python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --add-blueprint-repository "https://github.com/nextcloud/craft-blueprints-kde.git|next|"
python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --add-blueprint-repository "https://github.com/nextcloud/desktop-client-blueprints.git|next|"
python "${{ inputs.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ inputs.CRAFT_MASTER_CONFIG }}" --target ${{ inputs.CRAFT_TARGET }} -c --options nextcloud-client.srcDir=${{ github.workspace }} --options nextcloud-client.buildFileProviderModule=${{ inputs.buildFileProviderModule }} nextcloud-client
- name: Setup Craft
run: |
python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c craft
- name: Cache Craft directories containing the built client
uses: actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: |
${{ inputs.CRAFT_MASTER_LOCATION }}
${{ github.workspace }}/craft-clone
${{ github.workspace }}/${{ inputs.CRAFT_TARGET }}
key: ${{ runner.os }}-craft-build-${{ github.sha }}-${{ inputs.buildFileProviderModule }}
- name: Install Craft Nextcloud client dependencies
run: |
python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --install-deps nextcloud-client
- name: Build client
run: |
python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --options nextcloud-client.srcDir=${{ github.workspace }} ${{ env.CRAFT_BLUEPRINT_OPTIONS }} nextcloud-client
test:
name: Run tests
needs: build
timeout-minutes: 60
runs-on: macos-15
steps:
- name: Restore cached Craft directories containing the built client
uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: |
${{ inputs.CRAFT_MASTER_LOCATION }}
${{ github.workspace }}/craft-clone
${{ github.workspace }}/${{ inputs.CRAFT_TARGET }}
key: ${{ runner.os }}-craft-build-${{ github.sha }}-${{ inputs.buildFileProviderModule }}
- name: Run tests
run: |
cd ${{ github.workspace }}/${{ env.CRAFT_TARGET }}/build/nextcloud-client/work/build
cd ${{ github.workspace }}/${{ inputs.CRAFT_TARGET }}/build/nextcloud-client/work/build
ctest --output-on-failure --output-junit testResult.xml

106
.github/workflows/macos-craft-ci.yml vendored Normal file
View File

@ -0,0 +1,106 @@
# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-2.0-or-later
name: macOS CI
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
setup_craft:
name: Set up Craft and install dependencies
timeout-minutes: 60
runs-on: macos-15
env:
CRAFT_TARGET: macos-clang-arm64
CRAFT_MASTER_LOCATION: ${{ github.workspace }}/CraftMaster
CRAFT_MASTER_CONFIG: ${{ github.workspace }}/craftmaster.ini
PYTHON_VERSION: 3.12
outputs:
# workaround for `env` not being usable from within `jobs.:id.with`: republish those variables as outputs
CRAFT_TARGET: ${{ env.CRAFT_TARGET }}
CRAFT_MASTER_LOCATION: ${{ env.CRAFT_MASTER_LOCATION }}
CRAFT_MASTER_CONFIG: ${{ env.CRAFT_MASTER_CONFIG }}
PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 1
- name: Discover cached Craft directories
id: cache-craft-restore
uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: |
${{ env.CRAFT_MASTER_LOCATION }}
${{ github.workspace }}/craft-clone
${{ github.workspace }}/${{ env.CRAFT_TARGET }}
key: ${{ runner.os }}-craft-${{ hashFiles(env.CRAFT_MASTER_CONFIG) }}
lookup-only: true
- name: List Xcode installations
if: steps.cache-craft-restore.outputs.cache-hit != 'true'
run: sudo ls -1 /Applications | grep "Xcode"
- name: Select Xcode 16.2
if: steps.cache-craft-restore.outputs.cache-hit != 'true'
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Set up Python ${{ env.PYTHON_VERSION }}
if: steps.cache-craft-restore.outputs.cache-hit != 'true'
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Homebrew dependencies
if: steps.cache-craft-restore.outputs.cache-hit != 'true'
run: |
brew install homebrew/cask/inkscape
- name: Download Craft
if: steps.cache-craft-restore.outputs.cache-hit != 'true'
run: |
git clone -q --depth=1 https://invent.kde.org/packaging/craftmaster.git ${{ env.CRAFT_MASTER_LOCATION }}
- name: Add required blueprint repositories
if: steps.cache-craft-restore.outputs.cache-hit != 'true'
run: |
python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --add-blueprint-repository "https://github.com/nextcloud/craft-blueprints-kde.git|next|"
python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --add-blueprint-repository "https://github.com/nextcloud/desktop-client-blueprints.git|next|"
- name: Setup Craft
if: steps.cache-craft-restore.outputs.cache-hit != 'true'
run: |
python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c craft
- name: Install Craft Nextcloud client dependencies
if: steps.cache-craft-restore.outputs.cache-hit != 'true'
run: |
python "${{ env.CRAFT_MASTER_LOCATION }}/CraftMaster.py" --config "${{ env.CRAFT_MASTER_CONFIG }}" --target ${{ env.CRAFT_TARGET }} -c --install-deps nextcloud-client
- name: Cache Craft directories
if: steps.cache-craft-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: |
${{ env.CRAFT_MASTER_LOCATION }}
${{ github.workspace }}/craft-clone
${{ github.workspace }}/${{ env.CRAFT_TARGET }}
key: ${{ runner.os }}-craft-${{ hashFiles(env.CRAFT_MASTER_CONFIG) }}
build:
name: Build and test ${{ matrix.buildFileProviderModule == 'True' && 'File Provider' || 'classic' }} client
needs: setup_craft
strategy:
fail-fast: false
matrix:
buildFileProviderModule: ["True", "False"]
uses: ./.github/workflows/macos-build-and-test.yml
with:
CRAFT_TARGET: ${{ needs.setup_craft.outputs.CRAFT_TARGET }}
CRAFT_MASTER_CONFIG: ${{ needs.setup_craft.outputs.CRAFT_MASTER_CONFIG }}
CRAFT_MASTER_LOCATION: ${{ needs.setup_craft.outputs.CRAFT_MASTER_LOCATION }}
PYTHON_VERSION: ${{ needs.setup_craft.outputs.PYTHON_VERSION }}
buildFileProviderModule: ${{ matrix.buildFileProviderModule }}