Skip to content

Commit

Permalink
Merge pull request #14 from h-0-0/h-0-0-dev
Browse files Browse the repository at this point in the history
Fixed badges
  • Loading branch information
h-0-0 authored Dec 4, 2023
2 parents 91b1ccf + 6d7e290 commit 8ebf3aa
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 35 deletions.
51 changes: 39 additions & 12 deletions .github/workflows/tests_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down
50 changes: 39 additions & 11 deletions .github/workflows/tests_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down
50 changes: 39 additions & 11 deletions .github/workflows/tests_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down

0 comments on commit 8ebf3aa

Please sign in to comment.