diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index bc4c07a..27272a5 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.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: macos-latest strategy: fail-fast: false @@ -36,32 +50,45 @@ 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: macos-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 + 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}" 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}" 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)