Skip to content

Hardening the CI in relation to PRs #689

Hardening the CI in relation to PRs

Hardening the CI in relation to PRs #689

Workflow file for this run

name: Build
on:
push:
pull_request_target:
types: [labeled]
jobs:
build:
name: Build and test
runs-on: [self-hosted, macOS, ARM64]
env:
DERIVED_DATA_PATH: 'DerivedData'
DEVICE: 'iPhone 15 Pro'
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Install SwiftLint
run: brew install swiftlint
- name: Run process.sh script
run: |
./Scripts/process.sh
exit $?
- name: Select Xcode 15.3
run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Build
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild clean build-for-testing -scheme 'CryptomatorCloudAccess' -destination "name=$DEVICE" -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES | xcpretty
- name: Test
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild test-without-building -xctestrun $(find . -type f -name "*.xctestrun") -destination "name=$DEVICE" -derivedDataPath $DERIVED_DATA_PATH | xcpretty
- name: Upload code coverage report
run: |
gem install slather
slather coverage -x --build-directory $DERIVED_DATA_PATH --ignore "$DERIVED_DATA_PATH/SourcePackages/*" --scheme CryptomatorCloudAccess CryptomatorCloudAccess.xcodeproj
bash <(curl -Ls https://coverage.codacy.com/get.sh)
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
continue-on-error: true
integration-tests:
name: Run integration tests for ${{ matrix.name }}
runs-on: [self-hosted, macOS, ARM64]
needs: build
if: startsWith(github.ref, 'refs/tags/')
env:
DERIVED_DATA_PATH: 'DerivedData'
DEVICE: 'iPhone 15 Pro'
strategy:
fail-fast: false
matrix:
include:
- name: Common
scheme-name: CommonIntegrationTests
- name: Dropbox
scheme-name: DropboxIntegrationTests
- name: Google Drive
scheme-name: GoogleDriveIntegrationTests
- name: Local File System
scheme-name: LocalFileSystemIntegrationTests
- name: OneDrive
scheme-name: OneDriveIntegrationTests
- name: pCloud
scheme-name: PCloudIntegrationTests
- name: S3
scheme-name: S3IntegrationTests
- name: WebDAV
scheme-name: WebDAVIntegrationTests
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Select Xcode 15.3
run: sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Run integration tests
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme '${{ matrix.scheme-name }}' -destination "name=$DEVICE" -derivedDataPath $DERIVED_DATA_PATH test | xcpretty
env:
DROPBOX_ACCESS_TOKEN: ${{ secrets.DROPBOX_ACCESS_TOKEN }}
GOOGLE_DRIVE_CLIENT_ID: ${{ secrets.GOOGLE_DRIVE_CLIENT_ID }}
GOOGLE_DRIVE_REFRESH_TOKEN: ${{ secrets.GOOGLE_DRIVE_REFRESH_TOKEN }}
ONEDRIVE_CLIENT_ID: ${{ secrets.ONEDRIVE_CLIENT_ID }}
ONEDRIVE_REDIRECT_URI_SCHEME: ${{ secrets.ONEDRIVE_REDIRECT_URI_SCHEME }}
ONEDRIVE_REFRESH_TOKEN: ${{ secrets.ONEDRIVE_REFRESH_TOKEN }}
PCLOUD_APP_KEY: ${{ secrets.PCLOUD_APP_KEY }}
PCLOUD_ACCESS_TOKEN: ${{ secrets.PCLOUD_ACCESS_TOKEN }}
PCLOUD_HTTP_API_HOST_NAME: ${{ secrets.PCLOUD_HTTP_API_HOST_NAME }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
S3_URL: ${{ secrets.S3_URL }}
S3_BUCKET: ${{ secrets.S3_BUCKET }}
S3_REGION: ${{ secrets.S3_REGION }}
WEBDAV_BASE_URL: ${{ secrets.WEBDAV_BASE_URL }}
WEBDAV_USERNAME: ${{ secrets.WEBDAV_USERNAME }}
WEBDAV_PASSWORD: ${{ secrets.WEBDAV_PASSWORD }}
release:
name: Deploy and draft a release
runs-on: macos-14
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Draft release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
:construction: Work in Progress
draft: true
prerelease: false