Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Fix dependencies installation with Python 3.12 #2337

Closed
wants to merge 11 commits into from
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cache:

install:
- ps: Update-NodeJsInstallation 18.12.1 x64
- cmd: appveyor-retry pip install setuptools
- cmd: appveyor-retry yarn install
- cmd: appveyor-retry node node_modules/electron/install.js
- cmd: appveyor-retry yarn install:electron
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup python
run: pip install setuptools
- name: Setup CouchDB
id: setup-couchdb
uses: 'taratatach/[email protected]'
Expand Down Expand Up @@ -118,6 +120,8 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup python
run: pip install setuptools
- name: Setup CouchDB
id: setup-couchdb
uses: 'taratatach/[email protected]'
Expand Down Expand Up @@ -172,6 +176,8 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup python
run: pip install setuptools
- name: Setup CouchDB
id: setup-couchdb
uses: 'taratatach/[email protected]'
Expand Down Expand Up @@ -220,6 +226,8 @@ jobs:
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
Expand All @@ -238,4 +246,3 @@ jobs:
${{ github.workspace }}/dist/latest-linux.yml
${{ github.workspace }}/dist/Cozy[- ]Drive[- ]*.AppImage
retention-days: 5

152 changes: 93 additions & 59 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ env:
NODE_ENV: "test"
COZY_DESKTOP_HEARTBEAT: "1000"
DISPLAY: ":99.0"
NODE_VERSION: "18.12.1"
NODE_VERSION: "20.15.1"
GO_VERSION: "1.19"
COUCHDB_VERSION: "3.2.2"
COUCHDB_USER: "admin"
Expand All @@ -44,18 +44,20 @@ jobs:
steps:
- uses: styfle/cancel-workflow-action@5df4e62aed82ea1f787d2a02ab3dbfcaa49ffdd1

cleanup:
needs: cancel
name: 'Cleanup Swift'
docker_cache_key:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- run: |
pip install python-swiftclient python-keystoneclient
swift delete -a
- 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: cleanup
needs: docker_cache_key
runs-on: macos-12
name: Unit tests
strategy:
Expand All @@ -75,6 +77,18 @@ jobs:
~/.cache/electron
~/.cache/electron-builder
key: ${{ runner.os }}-v${{ env.NODE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
- name: Setup Docker
uses: douglascamata/setup-docker-macos-action@v1-alpha
- 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/[email protected]
with:
key: ${{ needs.docker_cache_key.outputs.key }}
bash: ${{ steps.install-bash.outputs.bash-path }}
- name: Setup node
uses: actions/setup-node@v3
with:
Expand All @@ -83,38 +97,36 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup CouchDB
id: setup-couchdb
uses: ./.github/actions/setup-couchdb
with:
couchdb-version: ${{ env.COUCHDB_VERSION }}
couchdb-user: ${{ env.COUCHDB_USER }}
couchdb-password: ${{ env.COUCHDB_PASSWORD }}
- name: Setup cozy-stack
uses: ./.github/actions/setup-cozy-stack
with:
couchdb-url: ${{ steps.setup-couchdb.outputs.couchdb-url }}
- 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 cozy-desktop "$COZY_DESKTOP_DIR"
hdiutil attach "${COZY_DESKTOP_DIR}.dmg" -mountpoint "$COZY_DESKTOP_DIR"
echo "NODE_ENV=test" > "${{ github.workspace }}/.env.test"
- name: Install dependencies
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: yarn install:all
- name: Start Xvfb
run: sudo Xvfb :99 -ac -screen 0 1024x768x8 &
- name: Setup cozy-stack
run: docker-compose up -d
- name: Setup test config
run: |
until docker exec cozy-desktop-stack /cozy-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: cleanup
needs: docker_cache_key
runs-on: macos-12
name: Integration tests
strategy:
Expand All @@ -134,6 +146,18 @@ jobs:
~/.cache/electron
~/.cache/electron-builder
key: ${{ runner.os }}-v${{ env.NODE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
- name: Setup Docker
uses: douglascamata/setup-docker-macos-action@v1-alpha
- 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/[email protected]
with:
key: ${{ needs.docker_cache_key.outputs.key }}
bash: ${{ steps.install-bash.outputs.bash-path }}
- name: Setup node
uses: actions/setup-node@v3
with:
Expand All @@ -142,38 +166,36 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup CouchDB
id: setup-couchdb
uses: ./.github/actions/setup-couchdb
with:
couchdb-version: ${{ env.COUCHDB_VERSION }}
couchdb-user: ${{ env.COUCHDB_USER }}
couchdb-password: ${{ env.COUCHDB_PASSWORD }}
- name: Setup cozy-stack
uses: ./.github/actions/setup-cozy-stack
with:
couchdb-url: ${{ steps.setup-couchdb.outputs.couchdb-url }}
- 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 cozy-desktop "$COZY_DESKTOP_DIR"
hdiutil attach "${COZY_DESKTOP_DIR}.dmg" -mountpoint "$COZY_DESKTOP_DIR"
echo "NODE_ENV=test" > "${{ github.workspace }}/.env.test"
- name: Install dependencies
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: yarn install:all
- name: Start Xvfb
run: sudo Xvfb :99 -ac -screen 0 1024x768x8 &
- name: Setup cozy-stack
run: docker-compose up -d
- name: Setup test config
run: |
until docker exec cozy-desktop-stack /cozy-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: cleanup
needs: docker_cache_key
runs-on: macos-12
name: Scenarios
strategy:
Expand All @@ -194,6 +216,18 @@ jobs:
~/.cache/electron
~/.cache/electron-builder
key: ${{ runner.os }}-v${{ env.NODE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
- name: Setup Docker
uses: douglascamata/setup-docker-macos-action@v1-alpha
- 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/[email protected]
with:
key: ${{ needs.docker_cache_key.outputs.key }}
bash: ${{ steps.install-bash.outputs.bash-path }}
- name: Setup node
uses: actions/setup-node@v3
with:
Expand All @@ -202,19 +236,13 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup CouchDB
id: setup-couchdb
uses: ./.github/actions/setup-couchdb
with:
couchdb-version: ${{ env.COUCHDB_VERSION }}
couchdb-user: ${{ env.COUCHDB_USER }}
couchdb-password: ${{ env.COUCHDB_PASSWORD }}
- name: Setup cozy-stack
uses: ./.github/actions/setup-cozy-stack
with:
couchdb-url: ${{ steps.setup-couchdb.outputs.couchdb-url }}
- 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 }}
Expand All @@ -228,11 +256,15 @@ jobs:
sleep 1
done
echo "NODE_ENV=test" > "${{ github.workspace }}/.env.test"
- name: Install dependencies
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: yarn install:all
- name: Start Xvfb
run: sudo Xvfb :99 -ac -screen 0 1024x768x8 &
- name: Setup cozy-stack
run: docker-compose up -d
- name: Setup test config
run: |
until docker exec cozy-desktop-stack /cozy-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' }}
Expand Down Expand Up @@ -260,6 +292,8 @@ jobs:
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
Expand Down
8 changes: 5 additions & 3 deletions test/setup.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/bin/sh

set -x
set -ex

# Retrieve test client ID
client_id=$(cozy-stack instances client-oauth \
client_id=$(cozy-stack --admin-host 127.0.0.1 \
instances client-oauth \
cozy.localhost:8080 \
http://cozy.localhost/ \
test \
github.com/cozy-labs/cozy-desktop)

# Retrieve test token
token=$(cozy-stack instances token-oauth \
token=$(cozy-stack --admin-host 127.0.0.1 \
instances token-oauth \
cozy.localhost:8080 \
"$client_id" \
io.cozy.files io.cozy.settings)
Expand Down
3 changes: 2 additions & 1 deletion test/support/builders/metadata/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ module.exports = class BaseMetadataBuilder {
) /*: this */ {
this.doc = {
..._.cloneDeep(was),
...this.doc
...this.doc,
updated_at: was.updated_at || this.doc.updated_at
}
this.doc.moveFrom = was
if (childMove) this.doc.moveFrom.childMove = true
Expand Down
7 changes: 2 additions & 5 deletions test/unit/remote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,15 +728,12 @@ describe('remote.Remote', function () {
.name('cat6.jpg')
.data('meow')
.create()
old = builders
.metafile()
.fromRemote(remoteDoc)
.changedSide('local')
.build()
old = builders.metafile().fromRemote(remoteDoc).upToDate().build()
doc = builders
.metafile()
.moveFrom(old)
.path('moved-to/cat7.jpg')
.changedSide('local')
.build()
})

Expand Down
Loading