Skip to content

Commit

Permalink
Set initial configurations to publish package
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-adir committed Nov 5, 2023
1 parent 6abc111 commit 3b62a21
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/black.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint with Black

on:
push:
paths:
- src/**
- tests/**
branches:
- main
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: psf/black@stable
with:
options: "--check --verbose --exclude docs"


41 changes: 41 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This is a basic workflow to help you get started with Actions

name: Tests

# Controls when the workflow will run
on:
push:
paths:
- src/**
- tests/**
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Run with tox
run: tox
45 changes: 45 additions & 0 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Coverage

on:
push:
paths:
- src/**
- tests/**
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
coverage:
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Checkout sources
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Run coverage
run: tox -e coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
33 changes: 33 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish to PyPI

on:
release:
types: [ published ]
branches: [ main ]
workflow_dispatch:

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install poetry and dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Configure poetry
env:
pypi_token: ${{ secrets.PyPI_TOKEN }}
run: poetry config pypi-token.pypi $pypi_token

- name: Build and publish
run: poetry publish --build
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "compmec-section"
version = "0.0.1"
version = "0.2.0"
description = "Analysis of beams cross-section using the boundary element method"
authors = ["Carlos Adir <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/compmec/section/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
It uses mainly curves as boundary to compute the elements.
"""

__version__ = "0.0.1"
__version__ = "0.2.0"

if __name__ == "__main__":
pass
12 changes: 9 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ envlist =
python3.8,
python3.9,
python3.10,
python3.11,
python3.12,
coverage,

[testenv]
deps =
numpy
compmec-shape
pytest
pytest-order
pytest-timeout
Expand All @@ -21,12 +24,15 @@ commands =
python =
3.7: py37
3.8: py38
3.9: py39, coverage
3.10: py310
3.9: py39
3.10: py310, coverage
3.11: py311
3.12: py312

[testenv:coverage]
deps =
numpy
compmec-shape
pytest
pytest-cov
pytest-order
Expand All @@ -36,7 +42,7 @@ deps =
commands =
coverage erase
pytest --cov={envsitepackagesdir}/compmec/section --cov-report=xml tests
coverage report -m --fail-under 20
coverage report -m --fail-under 80
coverage xml

[testenv:format]
Expand Down

0 comments on commit 3b62a21

Please sign in to comment.