Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated readme #25

Merged
merged 12 commits into from
Jul 23, 2024
12 changes: 12 additions & 0 deletions .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,15 @@ runs:

- name: Install Poetry for Windows
if: runner.os == 'Windows' && steps.cached-poetry.outputs.cache-hit != 'true'
shell: pwsh
env:
POETRY_VERSION: ${{ inputs.poetry-version }}
POETRY_HOME: ${{ inputs.poetry-home }}
run: |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -

- name: Add Poetry to the PATH environment variable
if: inputs.poetry-path != ''
shell: bash
run: |
echo "${{ inputs.poetry-path }}" >> $GITHUB_PATH
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: '🧪 Test'

on:
workflow_dispatch:
push:
pull_request:

jobs:
py-test:
uses: ./.github/workflows/tox-pytest.yml
with:
enable-test: true

# determine-changes:
# if: |
# github.event_name != 'pull_request' ||
# github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
# runs-on: ubuntu-latest
# outputs:
# has-changes: ${{ fromJson(steps.filter.outputs.changes)[0] != null }}
# py: ${{ steps.filter.outputs.py }}
# py-test: ${{ steps.filter.outputs.py-test }}
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Categorize changed files
# uses: dorny/paths-filter@v2
# id: filter
# with:
# filters: .github/settings/test-filters.yml
70 changes: 36 additions & 34 deletions .github/workflows/tox-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,28 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10']
poetry_version: ['1.3.1']
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
# python-version: ['3.9']
python-version: ['3.8', '3.9', '3.10']
poetry-version: ['1.8.3']
include:
- os: ubuntu-latest
poetry_home: ''
poetry_path: ''
poetry_cache_paths: |
poetry-home: ''
poetry-path: ''
poetry-cache-paths: |
~/.local/share/pypoetry
~/.local/bin/poetry
- os: macos-latest
poetry_home: ''
poetry_path: ${HOME}/.local/bin
poetry_cache_paths: |
poetry-home: ''
poetry-path: ${HOME}/.local/bin
poetry-cache-paths: |
~/Library/Application Support/pypoetry
~/.local/bin/poetry
- os: windows-latest
poetry_home: ''
poetry_path: ${APPDATA}\pypoetry\venv\Scripts
poetry_cache_paths: |
poetry-home: ''
poetry-path: ${APPDATA}\pypoetry\venv\Scripts
poetry-cache-paths: |
~\AppData\Roaming\pypoetry
~\AppData\Roaming\Python\Scripts\poetry.exe
poetry-cache-key-fmt: ['poetry-{0}-{1}-python-{2}']
Expand Down Expand Up @@ -86,18 +88,14 @@ jobs:
with:
cache-key: ${{ format(matrix.venv-cache-key-fmt, matrix.os, steps.setup-python.outputs.python-version, hashFiles('**/poetry.lock')) }}
python-version: ${{ steps.setup-python.outputs.python-version }}
poetry-install-args: --no-interaction --no-root --with dev
poetry-install-args: --no-interaction --with dev

- name: Test with pytest
id: test-with-pytest
if: inputs.enable-test == true
run: |
${{ steps.setup-poetry-dependencies.outputs.venv-activate }}
tox -v
# tox -e py -- -v --color=yes
# deactivate
# # Create a dummy file.
# touch "dummy-$(echo .coverage.*)"
tox -e py -- -v

- name: Upload coverage reports
if: steps.test-with-pytest.conclusion != 'skipped' && matrix.enable-coverage == 'true'
Expand All @@ -107,24 +105,28 @@ jobs:
path: .coverage.*
retention-days: 1

- name: Get Total Coverage from coverage.json
if: steps.test-with-pytest.conclusion != 'skipped' && matrix.enable-coverage == 'true'
- name: "Export Coverage Percentage"
id: report-coverage
if: inputs.enable-test == true
run: |
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
${{ steps.setup-poetry-dependencies.outputs.venv-activate }}
tox -e report
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "total=$TOTAL" >> $GITHUB_ENV
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY

- name: "Make badge"
uses: schneegans/dynamic-badges-action@v1.4.0
with:
# GIST_TOKEN is a GitHub personal access token with scope "gist".
auth: ${{ secrets.GIST_TOKEN }}
gistID: 5f5c84f28e80b29f2f9ce92300859446 # replace with your real Gist id.
filename: covbadge.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}
# - name: "Make badge"
# uses: schneegans/dynamic-badges-action@v1.7.0
# with:
# # GIST_TOKEN is a GitHub personal access token with scope "gist".
# auth: ${{ secrets.GIST_TOKEN }}
# gistID: 5f5c84f28e80b29f2f9ce92300859446 # replace with your real Gist id.
# filename: covbadge.json
# label: Coverage
# message: ${{ env.total }}%
# minColorRange: 50
# maxColorRange: 90
# valColorRange: ${{ env.total }}

- name: Upload dummy files
if: steps.test-with-pytest.conclusion != 'skipped' && matrix.enable-coverage == 'true'
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pip install [email protected]:watakandai/specless.git
curl -sSL https://install.python-poetry.org | python3 -
```

###
### Install specless & dependencies

```bash
# Clone locally
Expand All @@ -50,9 +50,8 @@ cd specless
# Activate the virtual environment
python -m venv env
source env/bin/activate
# Install
# Install specless & dependencies
poetry install
#
```

Done!
Expand Down
Loading