From 7c1af21a792db62abb84a37af6ca10fb406d2acd Mon Sep 17 00:00:00 2001 From: rasswanth-s <43314053+rasswanth-s@users.noreply.github.com> Date: Fri, 11 Oct 2024 08:57:32 +0530 Subject: [PATCH 1/5] shift workflows to use self hosted runners --- .github/workflows/cd-deploy.yaml | 9 ++++++++- .github/workflows/cd-release.yaml | 9 ++++++++- .github/workflows/pr-tests.yaml | 12 ++++++++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cd-deploy.yaml b/.github/workflows/cd-deploy.yaml index 5299f4d6..fc5dea73 100644 --- a/.github/workflows/cd-deploy.yaml +++ b/.github/workflows/cd-deploy.yaml @@ -16,9 +16,16 @@ concurrency: jobs: deploy-syftbox-server: - runs-on: ubuntu-latest + # runs-on: ubuntu-latest + runs-on: syftbox-sh-linux-x64 steps: + - name: Install Git + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install git -y + - name: Checkout SyftBox repo uses: actions/checkout@v4 diff --git a/.github/workflows/cd-release.yaml b/.github/workflows/cd-release.yaml index b7d40920..04d6d319 100644 --- a/.github/workflows/cd-release.yaml +++ b/.github/workflows/cd-release.yaml @@ -39,9 +39,16 @@ jobs: deploy-syftbox: needs: [call-pr-tests] - runs-on: ubuntu-latest + # runs-on: ubuntu-latest + runs-on: syftbox-sh-linux-x64 steps: + - name: Install Git + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install git -y + - name: Checkout SyftBox repo with github token uses: actions/checkout@v4 with: diff --git a/.github/workflows/pr-tests.yaml b/.github/workflows/pr-tests.yaml index dfd76594..548cfb7c 100644 --- a/.github/workflows/pr-tests.yaml +++ b/.github/workflows/pr-tests.yaml @@ -23,12 +23,20 @@ jobs: strategy: max-parallel: 99 matrix: - os: [ubuntu-latest, macos-latest] + # os: [ubuntu-latest, macos-latest] python-version: ["3.12", "3.11", "3.10"] fail-fast: false - runs-on: ${{ matrix.os }} + # runs-on: ${{ matrix.os }} + runs-on: [syftbox-sh-linux-x64] steps: + + - name: Install Git + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install git -y + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} From 7c5af6bfb889e61f504a6bad6ddb5fc9e7a19f95 Mon Sep 17 00:00:00 2001 From: khoaguin Date: Fri, 11 Oct 2024 14:28:14 +0700 Subject: [PATCH 2/5] create sync folder before starting the client for sync test --- tests/sync/sync_test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/sync/sync_test.py b/tests/sync/sync_test.py index 9a05427a..7c8c95c4 100644 --- a/tests/sync/sync_test.py +++ b/tests/sync/sync_test.py @@ -72,6 +72,10 @@ def datasite_1( client_config._server_client = server_client + # Create the sync folder before starting the client + sync_folder = Path(client_config.sync_folder) + sync_folder.mkdir(parents=True, exist_ok=True) + lifespan_with_settings = partial(client_lifespan, client_config=client_config) client_app.router.lifespan_context = lifespan_with_settings with TestClient(client_app) as client: From e95a044f78a1776adc699a5adb5abd6e33281025 Mon Sep 17 00:00:00 2001 From: rasswanth-s <43314053+rasswanth-s@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:03:41 +0530 Subject: [PATCH 3/5] add mac os runners --- .github/workflows/pr-tests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-tests.yaml b/.github/workflows/pr-tests.yaml index 548cfb7c..381e5266 100644 --- a/.github/workflows/pr-tests.yaml +++ b/.github/workflows/pr-tests.yaml @@ -24,11 +24,12 @@ jobs: max-parallel: 99 matrix: # os: [ubuntu-latest, macos-latest] + runner: [syftbox-sh-linux-x64, syftbox-sh-mac-arm64] python-version: ["3.12", "3.11", "3.10"] fail-fast: false # runs-on: ${{ matrix.os }} - runs-on: [syftbox-sh-linux-x64] + runs-on: ${{ matrix.runner }} steps: - name: Install Git From 83e17f523973fab0a18668928aaa32c8a132906f Mon Sep 17 00:00:00 2001 From: khoaguin Date: Fri, 11 Oct 2024 14:35:46 +0700 Subject: [PATCH 4/5] move creating sync dir to `start_watchdog` function --- syftbox/client/client.py | 1 + tests/sync/sync_test.py | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/syftbox/client/client.py b/syftbox/client/client.py index 7ffb9a6a..85c10d00 100644 --- a/syftbox/client/client.py +++ b/syftbox/client/client.py @@ -236,6 +236,7 @@ def sync_on_event(event: FileSystemEvent): run_plugin("sync", event) watch_dir = Path(app.shared_state.client_config.sync_folder) + watch_dir.mkdir(parents=True, exist_ok=True) event_handler = AnyFileSystemEventHandler( watch_dir, callbacks=[sync_on_event], diff --git a/tests/sync/sync_test.py b/tests/sync/sync_test.py index 7c8c95c4..9a05427a 100644 --- a/tests/sync/sync_test.py +++ b/tests/sync/sync_test.py @@ -72,10 +72,6 @@ def datasite_1( client_config._server_client = server_client - # Create the sync folder before starting the client - sync_folder = Path(client_config.sync_folder) - sync_folder.mkdir(parents=True, exist_ok=True) - lifespan_with_settings = partial(client_lifespan, client_config=client_config) client_app.router.lifespan_context = lifespan_with_settings with TestClient(client_app) as client: From 6c586c6e0c0b8161eb2c5819f2fc4a650cdaca3f Mon Sep 17 00:00:00 2001 From: rasswanth-s <43314053+rasswanth-s@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:07:34 +0530 Subject: [PATCH 5/5] add permission to home directory --- .github/workflows/pr-tests.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr-tests.yaml b/.github/workflows/pr-tests.yaml index 381e5266..3606a5e2 100644 --- a/.github/workflows/pr-tests.yaml +++ b/.github/workflows/pr-tests.yaml @@ -31,6 +31,9 @@ jobs: # runs-on: ${{ matrix.os }} runs-on: ${{ matrix.runner }} steps: + - name: Permission to home directory + run: | + sudo chown -R $USER:$USER $HOME - name: Install Git if: runner.os == 'Linux'