test: Avoid APFS integration timeout #2164
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: macOS | |
| # To debug a job, add the following step: | |
| # - name: Debug with tmate | |
| # uses: mxschmitt/action-tmate@v3 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - '**' | |
| pull_request: | |
| paths-ignore: | |
| - '.github/workflows/linux.yaml' | |
| env: | |
| COZY_DESKTOP_DIR: "${{ github.workspace }}/twake-desktop" | |
| COZY_STACK_STORAGE: "${{ github.workspace }}/storage" | |
| COZY_URL: "http://cozy.localhost:8080" | |
| COZY_PASSPHRASE: "cozy" | |
| GO111MODULE: "on" | |
| NO_BREAKPOINTS: "1" | |
| NODE_ENV: "test" | |
| COZY_DESKTOP_HEARTBEAT: "1000" | |
| DISPLAY: ":99.0" | |
| NODE_VERSION: "20.15.1" | |
| GO_VERSION: "1.19" | |
| COUCHDB_VERSION: "3.2.2" | |
| COUCHDB_USER: "admin" | |
| COUCHDB_PASSWORD: "password" | |
| OS_USERNAME: "${{ secrets.SWIFT_OS_USERNAME }}" | |
| OS_PASSWORD: "${{ secrets.SWIFT_OS_PASSWORD }}" | |
| OS_PROJECT_NAME: "${{ secrets.SWIFT_OS_PROJECT_NAME }}" | |
| OS_REGION_NAME: "GRA" | |
| OS_USER_DOMAIN_NAME: "Default" | |
| OS_PROJECT_DOMAIN_NAME: "Default" | |
| OS_AUTH_URL: "https://auth.cloud.ovh.net/v3" | |
| OS_IDENTITY_API_VERSION: "3" | |
| jobs: | |
| cancel: | |
| name: 'Cancel Previous Runs' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 3 | |
| steps: | |
| - uses: styfle/cancel-workflow-action@5df4e62aed82ea1f787d2a02ab3dbfcaa49ffdd1 | |
| docker_cache_key: | |
| name: 'Fetch latest version tag of cozy-app-dev' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - id: cozy-app-dev | |
| run: | | |
| version=$(curl -Ls --fail -q "https://hub.docker.com/v2/repositories/cozy/cozy-app-dev/tags/?page_size=1000" | \ | |
| jq '.results | .[] | .name' -r | \ | |
| head -n 2 | tail -1) | |
| echo "key=docker-${{ runner.os }}-${{ hashFiles('docker-compose.yml') }}-$(echo $version)" >> $GITHUB_OUTPUT | |
| outputs: | |
| key: ${{ steps.cozy-app-dev.outputs.key }} | |
| unit: | |
| needs: [cancel, docker_cache_key] | |
| runs-on: macos-26-intel | |
| name: Unit tests | |
| strategy: | |
| matrix: | |
| fs: ['APFS'] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Cache node modules | |
| id: cache-node-modules | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| path: | | |
| ${{ github.workspace }}/node_modules | |
| ~/.cache/electron | |
| ~/.cache/electron-builder | |
| key: ${{ runner.os }}-${{ runner.arch }}-v${{ env.NODE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} | |
| - name: Setup Docker | |
| uses: douglascamata/setup-docker-macos-action@v1.1.0 | |
| - name: Install Bash for docker-cache | |
| id: install-bash | |
| run: | | |
| brew install bash | |
| echo "bash-path=$(brew --prefix)/bin/bash" >> $GITHUB_OUTPUT | |
| - name: Cache Docker images. | |
| uses: cozy-labs/docker-cache@0.7.0 | |
| with: | |
| key: ${{ needs.docker_cache_key.outputs.key }} | |
| bash: ${{ steps.install-bash.outputs.bash-path }} | |
| - name: Setup node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup golang | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Setup python | |
| run: pip install setuptools | |
| - name: Setup DNS resolution for .localhost | |
| uses: ./.github/actions/setup-dnsmasq | |
| - name: Install dependencies | |
| if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
| run: yarn install:all | |
| - name: Setup local env | |
| env: | |
| COZY_DESKTOP_FS: ${{ matrix.fs }} | |
| run: | | |
| hdiutil create -megabytes 50 -fs "$COZY_DESKTOP_FS" -volname twake-desktop "$COZY_DESKTOP_DIR" | |
| hdiutil attach "${COZY_DESKTOP_DIR}.dmg" -mountpoint "$COZY_DESKTOP_DIR" | |
| echo "NODE_ENV=test" > "${{ github.workspace }}/.env.test" | |
| - name: Setup cozy-stack | |
| run: docker compose up -d | |
| - name: Setup test config | |
| run: | | |
| until docker exec twake-desktop-stack /twake-desktop/test/setup.sh | |
| do | |
| echo "Waiting for cozy-stack to be running..." | |
| sleep 30 | |
| done | |
| - name: Unit tests | |
| env: | |
| COZY_DESKTOP_FS: ${{ matrix.fs }} | |
| run: yarn test:unit --forbid-only | |
| integration: | |
| needs: [cancel, docker_cache_key] | |
| runs-on: macos-26-intel | |
| name: Integration tests | |
| strategy: | |
| matrix: | |
| fs: ['APFS'] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Cache node modules | |
| id: cache-node-modules | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| path: | | |
| ${{ github.workspace }}/node_modules | |
| ~/.cache/electron | |
| ~/.cache/electron-builder | |
| key: ${{ runner.os }}-${{ runner.arch }}-v${{ env.NODE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} | |
| - name: Setup Docker | |
| uses: douglascamata/setup-docker-macos-action@v1.1.0 | |
| - name: Install Bash for docker-cache | |
| id: install-bash | |
| run: | | |
| brew install bash | |
| echo "bash-path=$(brew --prefix)/bin/bash" >> $GITHUB_OUTPUT | |
| - name: Cache Docker images. | |
| uses: cozy-labs/docker-cache@0.7.0 | |
| with: | |
| key: ${{ needs.docker_cache_key.outputs.key }} | |
| bash: ${{ steps.install-bash.outputs.bash-path }} | |
| - name: Setup node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup golang | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Setup python | |
| run: pip install setuptools | |
| - name: Setup DNS resolution for .localhost | |
| uses: ./.github/actions/setup-dnsmasq | |
| - name: Install dependencies | |
| if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
| run: yarn install:all | |
| - name: Setup local env | |
| env: | |
| COZY_DESKTOP_FS: ${{ matrix.fs }} | |
| run: | | |
| hdiutil create -megabytes 50 -fs "$COZY_DESKTOP_FS" -volname twake-desktop "$COZY_DESKTOP_DIR" | |
| hdiutil attach "${COZY_DESKTOP_DIR}.dmg" -mountpoint "$COZY_DESKTOP_DIR" | |
| echo "NODE_ENV=test" > "${{ github.workspace }}/.env.test" | |
| - name: Setup cozy-stack | |
| run: docker compose up -d | |
| - name: Setup test config | |
| run: | | |
| until docker exec twake-desktop-stack /twake-desktop/test/setup.sh | |
| do | |
| echo "Waiting for cozy-stack to be running..." | |
| sleep 30 | |
| done | |
| - name: Integration tests | |
| env: | |
| COZY_DESKTOP_FS: ${{ matrix.fs }} | |
| run: yarn test:integration --forbid-only | |
| scenarios: | |
| needs: [cancel, docker_cache_key] | |
| runs-on: macos-26-intel | |
| name: Scenarios | |
| strategy: | |
| matrix: | |
| stopped_client: ['', 'STOPPED'] | |
| fs: ['APFS', 'HFS+'] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Cache node modules | |
| id: cache-node-modules | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| path: | | |
| ${{ github.workspace }}/node_modules | |
| ~/.cache/electron | |
| ~/.cache/electron-builder | |
| key: ${{ runner.os }}-${{ runner.arch }}-v${{ env.NODE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} | |
| - name: Setup Docker | |
| uses: douglascamata/setup-docker-macos-action@v1.1.0 | |
| - name: Install Bash for docker-cache | |
| id: install-bash | |
| run: | | |
| brew install bash | |
| echo "bash-path=$(brew --prefix)/bin/bash" >> $GITHUB_OUTPUT | |
| - name: Cache Docker images. | |
| uses: cozy-labs/docker-cache@0.7.0 | |
| with: | |
| key: ${{ needs.docker_cache_key.outputs.key }} | |
| bash: ${{ steps.install-bash.outputs.bash-path }} | |
| - name: Setup node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup golang | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Setup python | |
| run: pip install setuptools | |
| - name: Setup DNS resolution for .localhost | |
| uses: ./.github/actions/setup-dnsmasq | |
| - name: Install dependencies | |
| if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
| run: yarn install:all | |
| - name: Setup local env | |
| env: | |
| COZY_DESKTOP_FS: ${{ matrix.fs }} | |
| run: | | |
| until hdiutil create -megabytes 100 -fs "$COZY_DESKTOP_FS" -volname twake-desktop "$COZY_DESKTOP_DIR" | |
| do | |
| sleep 1 | |
| done | |
| until hdiutil attach "${COZY_DESKTOP_DIR}.dmg" -mountpoint "$COZY_DESKTOP_DIR" | |
| do | |
| sleep 1 | |
| done | |
| echo "NODE_ENV=test" > "${{ github.workspace }}/.env.test" | |
| - name: Setup cozy-stack | |
| run: docker compose up -d | |
| - name: Setup test config | |
| run: | | |
| until docker exec twake-desktop-stack /twake-desktop/test/setup.sh | |
| do | |
| echo "Waiting for cozy-stack to be running..." | |
| sleep 30 | |
| done | |
| - name: Scenarios | |
| env: | |
| STOPPED_CLIENT: ${{ matrix.stopped_client == 'STOPPED' }} | |
| COZY_DESKTOP_FS: ${{ matrix.fs }} | |
| run: yarn test:scenarios --forbid-only | |
| build: | |
| needs: cancel | |
| name: Build packages | |
| strategy: | |
| matrix: | |
| os: [macos-26-intel, macos-26] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Cache node modules | |
| id: cache-node-modules | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| path: | | |
| ${{ github.workspace }}/node_modules | |
| ~/.cache/electron | |
| ~/.cache/electron-builder | |
| key: ${{ runner.os }}-${{ runner.arch }}-v${{ env.NODE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} | |
| - name: Setup node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup python | |
| run: pip install setuptools | |
| - name: Install dependencies | |
| if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} | |
| run: yarn install:all | |
| - name: Build assets | |
| run: yarn build | |
| - name: Build package | |
| uses: ./.github/actions/build-and-publish | |
| with: | |
| gh-token: "${{ secrets.github_token }}" | |
| mac-cert: "${{ secrets.mac_cert }}" | |
| mac-cert-password: "${{ secrets.mac_cert_password }}" | |
| apple-id: "${{ secrets.apple_id }}" | |
| apple-id-password: "${{ secrets.apple_id_password }}" | |
| apple-team-id: "${{ secrets.apple_team_id }}" | |
| - name: Save artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-mac-${{ runner.arch }} | |
| path: | | |
| ${{ github.workspace }}/dist/latest*.yml | |
| ${{ github.workspace }}/dist/Twake[- ]Desktop[- ]*.dmg | |
| ${{ github.workspace }}/dist/Twake[- ]Desktop[- ]*.zip | |
| retention-days: 5 | |
| compression-level: 0 | |