From 26d6e2ff56c53fb984920b0c6e2cdc4d2cbcec7d Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Tue, 22 Oct 2024 17:59:08 +0530 Subject: [PATCH 01/19] start and stop prism for running tests --- .github/workflows/build-test-lint.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index b2cdbcf..ae2c156 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -43,9 +43,16 @@ jobs: run: python setup.py sdist working-directory: xero-python - # - name: Run Test - # run: | - # source venv/bin/activate - # pip install -r requirements/test.txt - # pytest -v - # working-directory: xero-python + - name: Start PRISM Server + run: sudo ./start-prism.sh + working-directory: xero-python/tests/utils + + - name: Run Test + run: | + source venv/bin/activate + pytest -v + working-directory: xero-python + + - name: Stop PRISM + run: pkill -f prism + working-directory: xero-python From d20a509a94c016e889b1a73c0a5bb8ba1e8ff184 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Tue, 22 Oct 2024 18:01:05 +0530 Subject: [PATCH 02/19] install prism --- .github/workflows/build-test-lint.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index ae2c156..11b0737 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -43,6 +43,14 @@ jobs: run: python setup.py sdist working-directory: xero-python + - name: Install Node.js + uses: actions/setup-node@v2 + with: + node-version: 20 + + - name: Install Prism + run: npm install -g @stoplight/prism-cli + - name: Start PRISM Server run: sudo ./start-prism.sh working-directory: xero-python/tests/utils From 41fd22a34980abe16ffe56d219755aca99a4b691 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Tue, 22 Oct 2024 18:11:48 +0530 Subject: [PATCH 03/19] check if prism is installed properly --- .github/workflows/build-test-lint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index 11b0737..26543f3 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -51,6 +51,9 @@ jobs: - name: Install Prism run: npm install -g @stoplight/prism-cli + - name: CHeck PRISM + run: prism --version + - name: Start PRISM Server run: sudo ./start-prism.sh working-directory: xero-python/tests/utils From e3e7fce2ff645e97abc2939aea79bac1d7ff821b Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Tue, 22 Oct 2024 18:15:59 +0530 Subject: [PATCH 04/19] corrected start script --- tests/utils/start-prism.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/utils/start-prism.sh b/tests/utils/start-prism.sh index 92b55f1..7a29b94 100755 --- a/tests/utils/start-prism.sh +++ b/tests/utils/start-prism.sh @@ -1,3 +1,5 @@ +#!/bin/bash + prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero_accounting.yaml --host 127.0.0.1 --port 4010 & prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-app-store.yaml --host 127.0.0.1 --port 4011 & prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero_assets.yaml --host 127.0.0.1 --port 4012 & From b672e73a456faaeec43d2c3985df6c19b65008b7 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Tue, 22 Oct 2024 18:17:58 +0530 Subject: [PATCH 05/19] removed sudo --- .github/workflows/build-test-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index 26543f3..3c7aba0 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -55,7 +55,7 @@ jobs: run: prism --version - name: Start PRISM Server - run: sudo ./start-prism.sh + run: ./start-prism.sh working-directory: xero-python/tests/utils - name: Run Test From 7834c276dfeee886d7e630d5d6a9767b381b3549 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Tue, 22 Oct 2024 18:20:34 +0530 Subject: [PATCH 06/19] adds nohup --- .github/workflows/build-test-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index 3c7aba0..b678939 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -55,7 +55,7 @@ jobs: run: prism --version - name: Start PRISM Server - run: ./start-prism.sh + run: nohup ./start-prism.sh working-directory: xero-python/tests/utils - name: Run Test From ec413b6e0c8e1eda4ff6f395856361e161da0acb Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 08:49:32 +0530 Subject: [PATCH 07/19] adds disown --- .github/workflows/build-test-lint.yml | 23 ++++++++++------------- tests/utils/start-prism.sh | 2 ++ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index b678939..e290dab 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -31,17 +31,17 @@ jobs: pip install -r requirements.txt -r requirements/dev.txt working-directory: xero-python - - name: Check vulnerable packages - run: pip-audit -r requirements.txt -r requirements/dev.txt - working-directory: xero-python + # - name: Check vulnerable packages + # run: pip-audit -r requirements.txt -r requirements/dev.txt + # working-directory: xero-python - - name: Run Flake8 - run: flake8 xero_python - working-directory: xero-python + # - name: Run Flake8 + # run: flake8 xero_python + # working-directory: xero-python - - name: Build package - run: python setup.py sdist - working-directory: xero-python + # - name: Build package + # run: python setup.py sdist + # working-directory: xero-python - name: Install Node.js uses: actions/setup-node@v2 @@ -51,11 +51,8 @@ jobs: - name: Install Prism run: npm install -g @stoplight/prism-cli - - name: CHeck PRISM - run: prism --version - - name: Start PRISM Server - run: nohup ./start-prism.sh + run: ./start-prism.sh working-directory: xero-python/tests/utils - name: Run Test diff --git a/tests/utils/start-prism.sh b/tests/utils/start-prism.sh index 7a29b94..454594a 100755 --- a/tests/utils/start-prism.sh +++ b/tests/utils/start-prism.sh @@ -9,3 +9,5 @@ prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/mas prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-payroll-nz.yaml --host 127.0.0.1 --port 4016 & prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-payroll-au.yaml --host 127.0.0.1 --port 4017 & prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-projects.yaml --host 127.0.0.1 --port 4018 + +disown From bea1f9d2fdde809385a64273bd599e4a265f3121 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 09:26:51 +0530 Subject: [PATCH 08/19] adds continue-on-error --- .github/workflows/build-test-lint.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index e290dab..068f5ef 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -52,7 +52,8 @@ jobs: run: npm install -g @stoplight/prism-cli - name: Start PRISM Server - run: ./start-prism.sh + run: | + ./start-prism.sh & echo $! > prism_pid.txt working-directory: xero-python/tests/utils - name: Run Test @@ -60,7 +61,9 @@ jobs: source venv/bin/activate pytest -v working-directory: xero-python + continue-on-error: true - name: Stop PRISM + if: success() || failure() run: pkill -f prism working-directory: xero-python From 15f4f5177707f664076f211032235bee6d75d70f Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 09:28:42 +0530 Subject: [PATCH 09/19] uncommented and adds sleep --- .github/workflows/build-test-lint.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index 068f5ef..fa06ee2 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -31,17 +31,17 @@ jobs: pip install -r requirements.txt -r requirements/dev.txt working-directory: xero-python - # - name: Check vulnerable packages - # run: pip-audit -r requirements.txt -r requirements/dev.txt - # working-directory: xero-python + - name: Check vulnerable packages + run: pip-audit -r requirements.txt -r requirements/dev.txt + working-directory: xero-python - # - name: Run Flake8 - # run: flake8 xero_python - # working-directory: xero-python + - name: Run Flake8 + run: flake8 xero_python + working-directory: xero-python - # - name: Build package - # run: python setup.py sdist - # working-directory: xero-python + - name: Build package + run: python setup.py sdist + working-directory: xero-python - name: Install Node.js uses: actions/setup-node@v2 @@ -54,6 +54,7 @@ jobs: - name: Start PRISM Server run: | ./start-prism.sh & echo $! > prism_pid.txt + sleep 10 working-directory: xero-python/tests/utils - name: Run Test From 234066df4180d009b874e8823adf4fdeaceb169a Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 09:32:00 +0530 Subject: [PATCH 10/19] commented source activation --- .github/workflows/build-test-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index fa06ee2..d807f8c 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -59,7 +59,7 @@ jobs: - name: Run Test run: | - source venv/bin/activate + # source venv/bin/activate pytest -v working-directory: xero-python continue-on-error: true From 0b9cc88c738939635d08df75b42fc5d90c65ba18 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 09:35:14 +0530 Subject: [PATCH 11/19] adds environment --- .github/workflows/build-test-lint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index d807f8c..7321d3b 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -59,7 +59,8 @@ jobs: - name: Run Test run: | - # source venv/bin/activate + python -m venv venv + source venv/bin/activate pytest -v working-directory: xero-python continue-on-error: true From 0b05dd374eaae820217341b46d2de8a9a1420dbc Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 09:40:39 +0530 Subject: [PATCH 12/19] removed version for urllib3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7be89c5..f1163e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # make sure content of this file can be parsed by setup.load_requirements python-dateutil>=2.7 -urllib3>=2.2.3 +urllib3 certifi setuptools>=75.1.0 From 20873cd2ec8504bb6a788d92d328f061bec7344b Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 10:05:47 +0530 Subject: [PATCH 13/19] increase sleep timing --- .github/workflows/build-test-lint.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index 7321d3b..94d5053 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -54,7 +54,7 @@ jobs: - name: Start PRISM Server run: | ./start-prism.sh & echo $! > prism_pid.txt - sleep 10 + sleep 15 working-directory: xero-python/tests/utils - name: Run Test @@ -63,7 +63,6 @@ jobs: source venv/bin/activate pytest -v working-directory: xero-python - continue-on-error: true - name: Stop PRISM if: success() || failure() From 94a8f5fb9eaee82076fffe4b35392e2a280ffe7a Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 10:10:27 +0530 Subject: [PATCH 14/19] commented echo statemenet --- .github/workflows/build-test-lint.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index 94d5053..faf8683 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -53,13 +53,14 @@ jobs: - name: Start PRISM Server run: | - ./start-prism.sh & echo $! > prism_pid.txt + ./start-prism.sh + # & echo $! > prism_pid.txt sleep 15 working-directory: xero-python/tests/utils - name: Run Test run: | - python -m venv venv + # python -m venv venv source venv/bin/activate pytest -v working-directory: xero-python From 3797926d4eeab16a52c6786ac5c1c6cd26466503 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 10:13:40 +0530 Subject: [PATCH 15/19] try adding sleep while starting prism --- .github/workflows/build-test-lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index faf8683..08546cb 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -53,9 +53,9 @@ jobs: - name: Start PRISM Server run: | - ./start-prism.sh + ./start-prism.sh & sleep 10 # & echo $! > prism_pid.txt - sleep 15 + # sleep 15 working-directory: xero-python/tests/utils - name: Run Test From c0b657b75c3cbc19f1ffa3f0b7f7d9fd419610d7 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 10:15:22 +0530 Subject: [PATCH 16/19] increase sleep timer --- .github/workflows/build-test-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index 08546cb..8a3f365 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -53,7 +53,7 @@ jobs: - name: Start PRISM Server run: | - ./start-prism.sh & sleep 10 + ./start-prism.sh & sleep 15 # & echo $! > prism_pid.txt # sleep 15 working-directory: xero-python/tests/utils From d6b63e21d02cf63c192a7781943f5ae0bbc2d452 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 10:19:18 +0530 Subject: [PATCH 17/19] try removing disown --- .github/workflows/build-test-lint.yml | 2 -- tests/utils/start-prism.sh | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index 8a3f365..219b485 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -54,8 +54,6 @@ jobs: - name: Start PRISM Server run: | ./start-prism.sh & sleep 15 - # & echo $! > prism_pid.txt - # sleep 15 working-directory: xero-python/tests/utils - name: Run Test diff --git a/tests/utils/start-prism.sh b/tests/utils/start-prism.sh index 454594a..7a29b94 100755 --- a/tests/utils/start-prism.sh +++ b/tests/utils/start-prism.sh @@ -9,5 +9,3 @@ prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/mas prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-payroll-nz.yaml --host 127.0.0.1 --port 4016 & prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-payroll-au.yaml --host 127.0.0.1 --port 4017 & prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-projects.yaml --host 127.0.0.1 --port 4018 - -disown From 217a7efde14dbf2b67e9f7665f2ffbe909e32be9 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 10:27:35 +0530 Subject: [PATCH 18/19] clanup commit --- .github/workflows/build-test-lint.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index 219b485..e3fbf26 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -43,7 +43,7 @@ jobs: run: python setup.py sdist working-directory: xero-python - - name: Install Node.js + - name: Set up Node environment uses: actions/setup-node@v2 with: node-version: 20 @@ -58,7 +58,6 @@ jobs: - name: Run Test run: | - # python -m venv venv source venv/bin/activate pytest -v working-directory: xero-python From b8eb6d87e8ad1c3760a40d878420516bf7bfa797 Mon Sep 17 00:00:00 2001 From: vigneshk-tw Date: Wed, 23 Oct 2024 10:48:39 +0530 Subject: [PATCH 19/19] final cleanup --- .github/workflows/build-test-lint.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-test-lint.yml b/.github/workflows/build-test-lint.yml index e3fbf26..6b403c9 100644 --- a/.github/workflows/build-test-lint.yml +++ b/.github/workflows/build-test-lint.yml @@ -52,8 +52,7 @@ jobs: run: npm install -g @stoplight/prism-cli - name: Start PRISM Server - run: | - ./start-prism.sh & sleep 15 + run: ./start-prism.sh & sleep 15 working-directory: xero-python/tests/utils - name: Run Test