Skip to content

Improve reliability of check translation workflow #494

Improve reliability of check translation workflow

Improve reliability of check translation workflow #494

name: Build and run extended tests
on:
# Allows manual execution
workflow_dispatch:
# Runs every day at midnight
schedule:
- cron: '0 0 * * *'
# Runs on PR to a release branch
pull_request:
types: [synchronize, review_requested]
branches:
- 'release/**'
- 'main'
concurrency:
group: nighlty-${{ github.head_ref }}
cancel-in-progress: true
env:
KDRIVE_TEST_CI_API_TOKEN: ${{ secrets.KDRIVE_TOKEN }}
KDRIVE_TEST_CI_ACCOUNT_ID: ${{ vars.KDRIVE_TEST_CI_ACCOUNT_ID }}
KDRIVE_TEST_CI_USER_ID: ${{ vars.KDRIVE_TEST_CI_USER_ID }}
KDRIVE_TEST_CI_DRIVE_ID: ${{ vars.KDRIVE_TEST_CI_DRIVE_ID }}
KDRIVE_TEST_CI_REMOTE_DIR_ID: ${{ vars.KDRIVE_TEST_CI_REMOTE_DIR_ID }}
KDRIVE_TEST_CI_LOCAL_PATH: "${{ github.workspace }}/test/test_ci"
KDRIVE_TEST_CI_REMOTE_PATH: ${{ vars.KDRIVE_TEST_CI_REMOTE_PATH }}
KDRIVE_TEST_CI_RUNNING_ON_CI: true
KDRIVE_TEST_CI_EXTENDED_TEST : true
KDRIVE_SENTRY_ENVIRONMENT: "windows_ci_runner"
jobs:
Windows-extended-tests:
runs-on: [ self-hosted, Windows, desktop-kdrive ]
env:
KDRIVE_TEST_CI_8MO_PARTITION_PATH: ${{ vars.KDRIVE_TEST_CI_8MO_PARTITION_PATH_WIN }}
COVFILE: ${{ github.workspace }}\\src\\test.cov
steps:
- name: Load system Path into Github environment
run : echo Path=%Path%>> %GITHUB_ENV%
shell: cmd
- name: Checkout the PR
uses: actions/[email protected]
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || 'develop' }}
submodules: recursive
- name: Clean the log directory
run : rm -r -force C:/Windows/Temp/kDrive-logdir/*
- name: Restore extension packages
run : nuget restore extensions/windows/cfapi/kDriveExt.sln
- name: Import Windows virtual certificate
env:
WINDOWS_VIRTUAL_CERT: ${{ secrets.WINDOWS_VIRTUAL_CERT }}
WINDOWS_VIRTUAL_CERT_PASSWORD: ${{ secrets.WINDOWS_VIRTUAL_CERT_PASSWORD }}
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate/tempCert.txt -Value $env:WINDOWS_VIRTUAL_CERT
certutil -decode certificate/tempCert.txt certificate/certificate.pfx
Remove-Item -path certificate -include tempCert.txt
Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String $env:WINDOWS_VIRTUAL_CERT_PASSWORD -Force -AsPlainText)
- name: Build kDrive desktop
run: |
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Auxiliary/Build/vcvars64.bat"
powershell ./infomaniak-build-tools/windows/build-drive.ps1 -ci -coverage -unitTests
shell: cmd
- name: Execute tests
run: |
& "cov01.exe" "-1" # coverage on
& "cov01.exe" "-s" # show status
./infomaniak-build-tools/run-tests.ps1
- name: Compute code coverage
run : |
& "covselect.exe" "--add" 'exclude folder c:/'
& "covselect.exe" "--add" 'exclude folder ../'
& "covselect.exe" "--add" 'exclude folder 3rdparty/'
& "covselect.exe" "--add" 'exclude folder gui/'
& "cov01.exe" "-0" # coverage off
& "cov01.exe" "-s" # show status
& "covhtml.exe" "coverage_html"
- name: Deactivate code coverage
run : "cov01.exe -0" # coverage off
if: always()
- name: Upload tests logs artifacts
uses: actions/upload-artifact@v4
with:
name: windows-tests-logs
path: C:/Windows/Temp/kDrive-logdir/*
retention-days: 3
overwrite: true
if: always()
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: windows-coverage-report
path: coverage_html/*
retention-days: 3
overwrite: true
- name: Clean-up generated code
run : powershell ./infomaniak-build-tools/windows/build-drive.ps1 -clean all
MacOS-extended-tests:
runs-on: [ self-hosted, macOS, desktop-kdrive ]
env:
KDRIVE_TEST_CI_8MO_PARTITION_PATH: ${{ vars.KDRIVE_TEST_CI_8MO_PARTITION_PATH_MACOS }}
steps:
- name: Clean-up XCode DerivedData
run : rm -rf /Users/runner/Library/Developer/Xcode/DerivedData
- name: Checkout the code
uses: actions/[email protected]
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || 'develop' }}
submodules: recursive
- name: Grant empty trash script execute permission
run : chmod +x ./infomaniak-build-tools/empty_drive_trash.sh
- name: Empty drive's trash
run : ./infomaniak-build-tools/empty_drive_trash.sh
- name: Unlock keychain to use the certificate
run : security unlock-keychain -p '${{ secrets.KEYCHAIN_PASSWORD }}' login.keychain
- name: Grant building script execute permission
run : chmod +x ./infomaniak-build-tools/macos/build-ci.sh
- name: Build kDrive desktop
run : ./infomaniak-build-tools/macos/build-ci.sh
- name: Grant tests script execute permission
run : chmod +x ./infomaniak-build-tools/run-tests.sh
- name: Execute tests
run : ./infomaniak-build-tools/run-tests.sh
- name: Get the path to kDrive-logdir
run : echo "logdir_path="$(find /private/var/folders/ -name kDrive-logdir 2>/dev/null)"" >> $GITHUB_ENV
if : success() || failure()
- name: Upload tests logs artifacts
uses: actions/upload-artifact@v4
with:
name: macos-tests-logs
path: ${{ env.logdir_path }}/*
retention-days: 3
overwrite: true
if: contains(env.logdir_path, 'kDrive-logdir') && (success() || failure())
- name: Clean the log directory
if : contains(env.logdir_path, 'kDrive-logdir')
run : rm -rf ${{ env.logdir_path }}/*
continue-on-error: true
- name: Clean-up generated code
run : rm -rf build-macos
Linux-extended-tests:
runs-on: [ self-hosted, Linux, X64, desktop-kdrive ]
env:
KDRIVE_TEST_CI_8MO_PARTITION_PATH: ${{ vars.KDRIVE_TEST_CI_8MO_PARTITION_PATH_LINUX }}
QT_QPA_PLATFORM: "offscreen"
steps:
- name: Checkout the PR
uses: actions/[email protected]
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || 'develop' }}
submodules: recursive
- name: Clean the log directory
run : rm -rf /tmp/kDrive-logdir/*
- name: Grant building script execute permission
run : chmod +x ./infomaniak-build-tools/linux/build-ci-amd64.sh
- name: Build kDrive desktop
run : ./infomaniak-build-tools/linux/build-ci-amd64.sh -u
- name: Grant tests script execute permission
run : chmod +x ./infomaniak-build-tools/run-tests.sh
- name: Execute tests
run : ./infomaniak-build-tools/run-tests.sh
- name: Upload tests logs artifacts
uses: actions/upload-artifact@v4
with:
name: linux-tests-logs
path: /tmp/kDrive-logdir/*
retention-days: 3
overwrite: true
if: always()
- name: Clean-up generated code
run : rm -rf build-linux
kChat_notification:
if: ((github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && always())
needs: [ Windows-extended-tests, MacOS-extended-tests, Linux-extended-tests ]
runs-on: [ self-hosted, Windows, desktop-kdrive ]
env:
KCHAT_WEBHOOK_URL: ${{ secrets.KCHAT_WEBHOOK_URL }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || 'develop' }}
- name: Notify kChat (Success or Failure)
run:
./infomaniak-build-tools/notify_kchat.ps1 "[![Build and run extended tests](https://github.com/Infomaniak/desktop-kDrive/actions/workflows/build-and-run-extended-tests.yml/badge.svg?branch=${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || 'develop' }})](https://github.com/Infomaniak/desktop-kDrive/actions/workflows/build-and-run-extended-tests.yml)"