From 465a9bf9fb7cb88b8c5bccff11ec71dbae3725cc Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 16:19:18 +0000 Subject: [PATCH 01/22] Fixing badges --- .github/workflows/tests_macos.yml | 9 +++++---- README.md | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index bc4c07a..ac797b9 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -36,14 +36,15 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest and create coverage report + - name: Test with pytest + id: pytest run: | cd $GITHUB_WORKSPACE python -m pytest if [ $? -eq 0 ]; then - echo "TESTS_PASSED_${{ matrix.python-version }}=true" >> $GITHUB_ENV + echo "::set-output name=TESTS_PASSED_${{ matrix.python-version }}::true" else - echo "TESTS_PASSED_${{ matrix.python-version }}=false" >> $GITHUB_ENV + echo "::set-output name=TESTS_PASSED_${{ matrix.python-version }}::false" fi create-badge: @@ -55,7 +56,7 @@ jobs: run: | overall_status="passed" for python_version in "3.9" "3.10" "3.11"; do - env_var="TESTS_PASSED_${python_version}" + env_var= ${{ steps.pytest.outputs.TESTS_PASSED_${{ python_version }} }} echo "ENV_VAR=${env_var}" if [ "${env_var}" != "true" ]; then overall_status="failed" diff --git a/README.md b/README.md index f0b25e8..626b008 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![PyPI - Version](https://img.shields.io/pypi/v/:slune-lib) +![PyPI - Version](https://img.shields.io/pypi/v0.0.2/:slune-lib) [![license](https://img.shields.io/badge/License-MIT-purple.svg)](LICENSE) ![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/h-0-0/4aa01e058fee448070c587f6967037e4/raw/CodeCovSlune.json) From ebe6da6b3ed1edf0bfc7e62dea71136b5934afce Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 16:33:13 +0000 Subject: [PATCH 02/22] Now using list --- .github/workflows/tests_macos.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index ac797b9..af941f3 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -6,6 +6,10 @@ on: pull_request: branches: [ "main" ] +env: + TEST_RESULTS: () + PY_V: ["3.9", "3.10", "3.11"] + jobs: build: @@ -13,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11"] + python-version: $PY_V steps: - uses: actions/checkout@v3 @@ -42,9 +46,9 @@ jobs: cd $GITHUB_WORKSPACE python -m pytest if [ $? -eq 0 ]; then - echo "::set-output name=TESTS_PASSED_${{ matrix.python-version }}::true" + TEST_RESULTS+=("true") else - echo "::set-output name=TESTS_PASSED_${{ matrix.python-version }}::false" + TEST_RESULTS+=("false") fi create-badge: @@ -55,10 +59,9 @@ jobs: id: determine-color run: | overall_status="passed" - for python_version in "3.9" "3.10" "3.11"; do - env_var= ${{ steps.pytest.outputs.TESTS_PASSED_${{ python_version }} }} - echo "ENV_VAR=${env_var}" - if [ "${env_var}" != "true" ]; then + for i in "${TEST_RESULTS[@]}"; do + echo "Test result: $i" + if [ "$i" != "true" ]; then overall_status="failed" break fi From ac7b0188731a3ab79c22e7326009ab3b265e7fd6 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 16:38:34 +0000 Subject: [PATCH 03/22] Wasn't converting to JSON --- .github/workflows/tests_macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index af941f3..261f51f 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: $PY_V + python-version: ${{fromJson(env.PY_V)}} steps: - uses: actions/checkout@v3 From 56624df4976abcc8d2809b84b5535aab7a21a3ac Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 16:39:38 +0000 Subject: [PATCH 04/22] Want an array --- .github/workflows/tests_macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 261f51f..58fdfb6 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -8,7 +8,7 @@ on: env: TEST_RESULTS: () - PY_V: ["3.9", "3.10", "3.11"] + PY_V: ("3.9", "3.10", "3.11") jobs: build: From 928ca074954207065d94c874fbcd76495d6b2312 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 16:41:11 +0000 Subject: [PATCH 05/22] No longr converting to JSON --- .github/workflows/tests_macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 58fdfb6..9750345 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ${{fromJson(env.PY_V)}} + python-version: $PY_V steps: - uses: actions/checkout@v3 From d42fa8f5a2887866fcc23b51bbd11f0d726b39a1 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 16:48:52 +0000 Subject: [PATCH 06/22] Wasn't declaring array properly --- .github/workflows/tests_macos.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 9750345..6a055e0 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -8,7 +8,7 @@ on: env: TEST_RESULTS: () - PY_V: ("3.9", "3.10", "3.11") + PY_V: (3.9 3.10 3.11) jobs: build: @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: $PY_V + python-version: fromJson( ${{ env.PY_V }} ) steps: - uses: actions/checkout@v3 @@ -46,9 +46,9 @@ jobs: cd $GITHUB_WORKSPACE python -m pytest if [ $? -eq 0 ]; then - TEST_RESULTS+=("true") + env.TEST_RESULTS+=("true") else - TEST_RESULTS+=("false") + env.TEST_RESULTS+=("false") fi create-badge: From fa54358ac9074427aad2d3a4a72d1dfe8fe93f88 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 16:50:12 +0000 Subject: [PATCH 07/22] Got rid of .env --- .github/workflows/tests_macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 6a055e0..efde663 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: fromJson( ${{ env.PY_V }} ) + python-version: fromJson( ${{ PY_V }} ) steps: - uses: actions/checkout@v3 From 30a034f0d0ca223c2e806aaf80dd8d8f9beec080 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 16:51:58 +0000 Subject: [PATCH 08/22] Changed brackets --- .github/workflows/tests_macos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index efde663..61e9cff 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -8,7 +8,7 @@ on: env: TEST_RESULTS: () - PY_V: (3.9 3.10 3.11) + PY_V: [3.9 3.10 3.11] jobs: build: @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: fromJson( ${{ PY_V }} ) + python-version: fromJson( ${{ env.PY_V }} ) steps: - uses: actions/checkout@v3 From 2fb33e1f615a9b3ebdf0e72690fe8f48eaf8f007 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 16:54:26 +0000 Subject: [PATCH 09/22] Correcting syntax --- .github/workflows/tests_macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 61e9cff..245a45b 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -8,7 +8,7 @@ on: env: TEST_RESULTS: () - PY_V: [3.9 3.10 3.11] + PY_V: ("3.9" "3.10" "3.11") jobs: build: From da50559afbb3ece34412e4d92d8dae5664dec7cc Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 17:01:05 +0000 Subject: [PATCH 10/22] Missing brackets? --- .github/workflows/tests_macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 245a45b..28e3224 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: fromJson( ${{ env.PY_V }} ) + python-version: ${{ fromJson( ${{ env.PY_V }} ) }} steps: - uses: actions/checkout@v3 From 2dc8940e1edbec491f20b286abbe3bafcdcbd172 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 17:07:07 +0000 Subject: [PATCH 11/22] No longer making python version env variables as not really needed --- .github/workflows/tests_macos.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 28e3224..21dfc4d 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -8,7 +8,6 @@ on: env: TEST_RESULTS: () - PY_V: ("3.9" "3.10" "3.11") jobs: build: @@ -17,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ${{ fromJson( ${{ env.PY_V }} ) }} + python-version: ["3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 From 5589a4ca077b5262fa5883a9988c68fed58ec53b Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 17:10:15 +0000 Subject: [PATCH 12/22] Quotation marks causing errors --- .github/workflows/tests_macos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 21dfc4d..b0aae58 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -45,9 +45,9 @@ jobs: cd $GITHUB_WORKSPACE python -m pytest if [ $? -eq 0 ]; then - env.TEST_RESULTS+=("true") + env.TEST_RESULTS+=(true) else - env.TEST_RESULTS+=("false") + env.TEST_RESULTS+=(false) fi create-badge: From b6cd13931a4b2646b0328bab71e597e27cf97623 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 17:17:43 +0000 Subject: [PATCH 13/22] Still trying to fix syntax --- .github/workflows/tests_macos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index b0aae58..ad0ea77 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -45,9 +45,9 @@ jobs: cd $GITHUB_WORKSPACE python -m pytest if [ $? -eq 0 ]; then - env.TEST_RESULTS+=(true) + $TEST_RESULTS+=("true") else - env.TEST_RESULTS+=(false) + $TEST_RESULTS+=("false") fi create-badge: From 57d87af27a940673013a8a2ea76c1fd184aebc8a Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 17:20:30 +0000 Subject: [PATCH 14/22] Debugging --- .github/workflows/tests_macos.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index ad0ea77..93772aa 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -45,6 +45,9 @@ jobs: cd $GITHUB_WORKSPACE python -m pytest if [ $? -eq 0 ]; then + echo $TEST_RESULTS + echo env.TEST_RESULTS + echo ${TEST_RESULTS} $TEST_RESULTS+=("true") else $TEST_RESULTS+=("false") From 6da1624274e8f9d6545c8f7fbde5403d70a660ad Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 17:22:14 +0000 Subject: [PATCH 15/22] Debugging --- .github/workflows/tests_macos.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 93772aa..bfe8a75 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -44,10 +44,10 @@ jobs: run: | cd $GITHUB_WORKSPACE python -m pytest + echo $TEST_RESULTS + echo env.TEST_RESULTS + echo ${TEST_RESULTS} if [ $? -eq 0 ]; then - echo $TEST_RESULTS - echo env.TEST_RESULTS - echo ${TEST_RESULTS} $TEST_RESULTS+=("true") else $TEST_RESULTS+=("false") From 7429d3f55b6adecd7690be0656ceb4b3a2f672d7 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 17:25:42 +0000 Subject: [PATCH 16/22] Debugging --- .github/workflows/tests_macos.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index bfe8a75..6b15cd7 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -45,12 +45,11 @@ jobs: cd $GITHUB_WORKSPACE python -m pytest echo $TEST_RESULTS - echo env.TEST_RESULTS echo ${TEST_RESULTS} if [ $? -eq 0 ]; then - $TEST_RESULTS+=("true") + ${TEST_RESULTS}+=("true") else - $TEST_RESULTS+=("false") + ${TEST_RESULTS}+=("false") fi create-badge: From b4d47350bbfef7207ae3ee2e5f4b799d9405d085 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 17:28:06 +0000 Subject: [PATCH 17/22] Debugging --- .github/workflows/tests_macos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 6b15cd7..d48e12d 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -47,9 +47,9 @@ jobs: echo $TEST_RESULTS echo ${TEST_RESULTS} if [ $? -eq 0 ]; then - ${TEST_RESULTS}+=("true") + ${TEST_RESULTS}+=('true') else - ${TEST_RESULTS}+=("false") + ${TEST_RESULTS}+=('false') fi create-badge: From c80ee53652b82641d568756c8a288103e94f0131 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 17:30:15 +0000 Subject: [PATCH 18/22] Debugging --- .github/workflows/tests_macos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index d48e12d..68c19f9 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -47,9 +47,9 @@ jobs: echo $TEST_RESULTS echo ${TEST_RESULTS} if [ $? -eq 0 ]; then - ${TEST_RESULTS}+=('true') + ${TEST_RESULTS}=("${TEST_RESULTS[@]}" "true") else - ${TEST_RESULTS}+=('false') + ${TEST_RESULTS}=("${TEST_RESULTS[@]}" "false") fi create-badge: From b986c95b656d9f414486a794d97a32af5740dc2f Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 18:56:34 +0000 Subject: [PATCH 19/22] Debugging --- .github/workflows/tests_macos.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 68c19f9..2cf2c74 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -6,9 +6,6 @@ on: pull_request: branches: [ "main" ] -env: - TEST_RESULTS: () - jobs: build: @@ -44,12 +41,10 @@ jobs: run: | cd $GITHUB_WORKSPACE python -m pytest - echo $TEST_RESULTS - echo ${TEST_RESULTS} if [ $? -eq 0 ]; then - ${TEST_RESULTS}=("${TEST_RESULTS[@]}" "true") + echo "true" >> results.txt else - ${TEST_RESULTS}=("${TEST_RESULTS[@]}" "false") + echo "false" >> results.txt fi create-badge: @@ -59,14 +54,17 @@ jobs: - name: Determine overall badge color id: determine-color run: | - overall_status="passed" - for i in "${TEST_RESULTS[@]}"; do - echo "Test result: $i" - if [ "$i" != "true" ]; then - overall_status="failed" - break + overall_status="passed" + RESULTS=$(cat results.txt) + # Loop through each line in the file + while IFS= read -r line; do + echo "Processing result: $line" + if [[ "$line" == *"false"* ]]; then + echo "Setting overall_status to failed" + overall_status=failed fi - done + done < results.txt + echo "::set-output name=overall_status::${overall_status}" echo "COVERAGE=${overall_status}" From a840acdadfd4d44b585b9434905941cf7afe90f3 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 19:02:15 +0000 Subject: [PATCH 20/22] Debugging --- .github/workflows/tests_macos.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 2cf2c74..990fa28 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -47,10 +47,22 @@ jobs: echo "false" >> results.txt fi + - name: Upload results.txt + uses: actions/upload-artifact@v2 + with: + name: results + path: results.txt + create-badge: needs: build runs-on: macos-latest steps: + - name: Download results.txt + uses: actions/download-artifact@v2 + with: + name: results + path: results.txt + - name: Determine overall badge color id: determine-color run: | @@ -64,7 +76,7 @@ jobs: overall_status=failed fi done < results.txt - + echo "::set-output name=overall_status::${overall_status}" echo "COVERAGE=${overall_status}" From 8c8a05158aba98f5b631d8946ba9f11ec8ed9fb3 Mon Sep 17 00:00:00 2001 From: h-aze Date: Sun, 3 Dec 2023 19:12:15 +0000 Subject: [PATCH 21/22] Debugging --- .github/workflows/tests_macos.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 990fa28..6fffebd 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -7,6 +7,20 @@ on: branches: [ "main" ] jobs: + initialize: + runs-on: macos-latest + + steps: + - name: Create results.txt + run: | + echo "RESULTS" > results.txt + + - name: Upload results.txt + uses: actions/upload-artifact@v2 + with: + name: results + path: results.txt + build: runs-on: macos-latest @@ -36,6 +50,11 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Download results.txt + uses: actions/download-artifact@v2 + with: + name: results + - name: Test with pytest id: pytest run: | @@ -47,12 +66,6 @@ jobs: echo "false" >> results.txt fi - - name: Upload results.txt - uses: actions/upload-artifact@v2 - with: - name: results - path: results.txt - create-badge: needs: build runs-on: macos-latest @@ -61,7 +74,6 @@ jobs: uses: actions/download-artifact@v2 with: name: results - path: results.txt - name: Determine overall badge color id: determine-color From 6d7e290717961d1ed1b773b3c481b6492b6afe7e Mon Sep 17 00:00:00 2001 From: h-aze Date: Mon, 4 Dec 2023 12:40:57 +0000 Subject: [PATCH 22/22] Fixing other workflows to match macos --- .github/workflows/tests_macos.yml | 2 +- .github/workflows/tests_ubuntu.yml | 50 ++++++++++++++++++++++------- .github/workflows/tests_windows.yml | 50 ++++++++++++++++++++++------- 3 files changed, 79 insertions(+), 23 deletions(-) diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index 6fffebd..27272a5 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -22,7 +22,7 @@ jobs: path: results.txt build: - + needs: initialize runs-on: macos-latest strategy: fail-fast: false diff --git a/.github/workflows/tests_ubuntu.yml b/.github/workflows/tests_ubuntu.yml index ead05f9..e51b812 100644 --- a/.github/workflows/tests_ubuntu.yml +++ b/.github/workflows/tests_ubuntu.yml @@ -7,8 +7,22 @@ on: branches: [ "main" ] jobs: - build: + initialize: + runs-on: macos-latest + + steps: + - name: Create results.txt + run: | + echo "RESULTS" > results.txt + - name: Upload results.txt + uses: actions/upload-artifact@v2 + with: + name: results + path: results.txt + + build: + needs: initialize runs-on: ubuntu-latest strategy: fail-fast: false @@ -36,32 +50,46 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest and create coverage report + - name: Download results.txt + uses: actions/download-artifact@v2 + with: + name: results + + - name: Test with pytest + id: pytest run: | cd $GITHUB_WORKSPACE python -m pytest if [ $? -eq 0 ]; then - echo "TESTS_PASSED_${{ matrix.python-version }}=true" >> $GITHUB_ENV + echo "true" >> results.txt else - echo "TESTS_PASSED_${{ matrix.python-version }}=false" >> $GITHUB_ENV + echo "false" >> results.txt fi create-badge: needs: build runs-on: ubuntu-latest steps: + - name: Download results.txt + uses: actions/download-artifact@v2 + with: + name: results + - name: Determine overall badge color id: determine-color run: | overall_status="passed" - for python_version in "3.9" "3.10" "3.11"; do - env_var="TESTS_PASSED_${python_version}" - echo "ENV_VAR=${env_var}" - if [ "${env_var}" != "true" ]; then - overall_status="failed" - break + + RESULTS=$(cat results.txt) + # Loop through each line in the file + while IFS= read -r line; do + echo "Processing result: $line" + if [[ "$line" == *"false"* ]]; then + echo "Setting overall_status to failed" + overall_status=failed fi - done + done < results.txt + echo "::set-output name=overall_status::${overall_status}" echo "COVERAGE=${overall_status}" diff --git a/.github/workflows/tests_windows.yml b/.github/workflows/tests_windows.yml index 83e3a2f..1ec6c87 100644 --- a/.github/workflows/tests_windows.yml +++ b/.github/workflows/tests_windows.yml @@ -7,8 +7,22 @@ on: branches: [ "main" ] jobs: - build: + initialize: + runs-on: macos-latest + + steps: + - name: Create results.txt + run: | + echo "RESULTS" > results.txt + - name: Upload results.txt + uses: actions/upload-artifact@v2 + with: + name: results + path: results.txt + + build: + needs: initialize runs-on: ubuntu-latest strategy: fail-fast: false @@ -36,32 +50,46 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest and create coverage report + - name: Download results.txt + uses: actions/download-artifact@v2 + with: + name: results + + - name: Test with pytest + id: pytest run: | cd $GITHUB_WORKSPACE python -m pytest if [ $? -eq 0 ]; then - echo "TESTS_PASSED_${{ matrix.python-version }}=true" >> $GITHUB_ENV + echo "true" >> results.txt else - echo "TESTS_PASSED_${{ matrix.python-version }}=false" >> $GITHUB_ENV + echo "false" >> results.txt fi create-badge: needs: build runs-on: ubuntu-latest steps: + - name: Download results.txt + uses: actions/download-artifact@v2 + with: + name: results + - name: Determine overall badge color id: determine-color run: | overall_status="passed" - for python_version in "3.9" "3.10" "3.11"; do - env_var="TESTS_PASSED_${python_version}" - echo "ENV_VAR=${env_var}" - if [ "${env_var}" != "true" ]; then - overall_status="failed" - break + + RESULTS=$(cat results.txt) + # Loop through each line in the file + while IFS= read -r line; do + echo "Processing result: $line" + if [[ "$line" == *"false"* ]]; then + echo "Setting overall_status to failed" + overall_status=failed fi - done + done < results.txt + echo "::set-output name=overall_status::${overall_status}" echo "COVERAGE=${overall_status}"