Skip to content

Commit

Permalink
fix: working on fixing github actions pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
manawasp committed Mar 9, 2024
1 parent f28c5cb commit 14aebb8
Show file tree
Hide file tree
Showing 19 changed files with 119 additions and 284 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ insert_final_newline = true
charset = utf-8
end_of_line = lf

[{*.yml,*.yaml}]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,31 @@ on:
release:
types: [created]
branches:
- 'master'
- master

jobs:
build:
name: "Build docs"
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: "Install runtime dependencies in order to get package metadata"
run: "scripts/install"
- name: "Install deps and build with Sphinx"
run: make docs
- name: "Upload artifacts"

- name: Install dependencies
run: pip install -r requirements.txt

- name: Install deps and build with Sphinx
run: scripts/build-docs.sh

- name: Upload artifacts
uses: actions/upload-pages-artifact@v1
with:
# Upload built docs
path: "./Documentation"
path: "./site"
deploy:
name: "Deploy docs"
name: Deploy docs
if: github.event_name == 'release' && github.event.action == 'published'
needs: build
runs-on: ubuntu-latest
Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/dist.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Package

on:
# Only run when release is created in the master branch
release:
types: [created]
branches:
- 'master'

jobs:
build:
name: Build distributable files
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout source repository'
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5

- name: Install build dependencies
run: pip install build

- name: 'Build package'
run: scripts/build.sh

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
path: 'dist/*'

upload_pypi:
name: Upload packages
needs: ['build']
runs-on: 'ubuntu-latest'
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: '__token__'
password: '${{ secrets.PYPI_API_TOKEN }}'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Run Python tests
name: Python package

on:
push:
Expand Down Expand Up @@ -31,24 +31,30 @@ jobs:
experimental: true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: "actions/setup-python@v4"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
cache: "pip"
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
requirements/*.txt
requirements/**/*.txt
- name: "Install dependencies"
run: "scripts/install"
- name: "Run linting checks"
run: "scripts/check"
- name: "Run tests"
run: "scripts/tests"
- name: "Enforce coverage"
uses: codecov/codecov-action@v3
requirements-*.txt
pyproject.toml
- name: Install dependencies
run: pip install -r requirements.txt

- name: Run linting checks
run: scripts/lint.sh

- name: Run tests
run: scripts/tests.sh

- name: Enforce coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand Down
147 changes: 0 additions & 147 deletions Makefile

This file was deleted.

4 changes: 1 addition & 3 deletions mode/utils/times.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,7 @@ def humanize_seconds(
for unit, divider, formatter in TIME_UNITS:
if secs >= divider:
w = secs / float(divider)
return "{}{}{} {}{}".format(
prefix, sep, formatter(w), pluralize(int(w), unit), suffix
)
return f"{prefix}{sep}{formatter(w)} {pluralize(int(w), unit)}{suffix}"
if microseconds and secs > 0.0:
return f"{prefix}{sep}{secs:.2f} seconds{suffix}"
return now
Expand Down
4 changes: 1 addition & 3 deletions mode/utils/tracebacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,7 @@ def _get_coroutine_frame(
@classmethod
def _what_is_this(cls, obj: Any) -> AttributeError:
return AttributeError(
"WHAT IS THIS? str={} repr={!r} typ={!r} dir={}".format(
obj, obj, type(obj), dir(obj)
)
f"WHAT IS THIS? str={obj} repr={obj!r} typ={type(obj)!r} dir={dir(obj)}"
)

@classmethod
Expand Down
5 changes: 4 additions & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
freezegun>=0.3.11
hypothesis>=3.31
mypy>=1.8.0
pre-commit>=3.6.2
pytest-aiofiles>=0.2.0
pytest-asyncio==0.21.1
pytest-base-url>=2.1.0
Expand All @@ -15,3 +14,7 @@ pytz
ruff>=0.3.0
vulture
yarl

# Conditional
pre-commit>=3.6.2; python_version >= '3.9'
pre-commit>=3.5.0; python_version < '3.9'
Loading

0 comments on commit 14aebb8

Please sign in to comment.