Skip to content

Commit 29d758c

Browse files
Switch to github workflows and add badges
1 parent 06b825d commit 29d758c

File tree

6 files changed

+142
-73
lines changed

6 files changed

+142
-73
lines changed

.github/workflows/pipeline.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: pipeline
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test-dotnet:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Setup .NET Core
11+
uses: actions/setup-dotnet@v1
12+
- name: Install dependencies
13+
run: dotnet restore
14+
- name: Run tests
15+
run: dotnet test
16+
17+
test-python:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: [3.7, 3.8, 3.9]
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v1
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Install dependencies
29+
run: |
30+
cd pyhagelkorn
31+
pip install -e .
32+
pip install flake8 pytest pytest-cov codecov wheel
33+
- name: Lint with flake8
34+
run: |
35+
cd pyhagelkorn
36+
# stop the build if there are Python syntax errors or undefined names
37+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
38+
# exit-zero treats all errors as warnings
39+
flake8 . --count --exit-zero --statistics
40+
- name: Test with pytest
41+
run: |
42+
cd pyhagelkorn
43+
pytest --cov=./hagelkorn --cov-append --cov-report xml --cov-report term-missing hagelkorn/tests.py
44+
- name: Upload coverage
45+
uses: codecov/codecov-action@v1
46+
if: matrix.python-version == 3.8
47+
with:
48+
file: ./pyhagelkorn/coverage.xml
49+
- name: Test Wheel install and import
50+
run: |
51+
cd pyhagelkorn
52+
python setup.py bdist_wheel
53+
cd dist
54+
pip install hagelkorn*.whl
55+
python -c "import hagelkorn; print(hagelkorn.__version__)"

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: release-pipeline
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
9+
jobs:
10+
release-pypi:
11+
runs-on: ubuntu-latest
12+
env:
13+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Python
17+
uses: actions/setup-python@v1
18+
with:
19+
python-version: 3.8
20+
- name: Install dependencies
21+
run: |
22+
cd pyhagelkorn
23+
pip install -e .
24+
pip install flake8 pytest pytest-cov twine wheel
25+
- name: Test with pytest
26+
run: |
27+
cd pyhagelkorn
28+
pytest --cov=./hagelkorn --cov-append --cov-report xml --cov-report term-missing hagelkorn/tests.py
29+
- name: Build package
30+
run: |
31+
cd pyhagelkorn
32+
python setup.py sdist bdist_wheel
33+
- name: Check version number match
34+
run: |
35+
cd pyhagelkorn
36+
echo "GITHUB_REF: ${GITHUB_REF}"
37+
# Make sure the package version is the same as the tag
38+
grep -Rq "^Version: ${GITHUB_REF:11}$" hagelkorn.egg-info/PKG-INFO
39+
- name: Publish to PyPI
40+
run: |
41+
cd pyhagelkorn
42+
twine check dist/*
43+
twine upload --repository pypi --username __token__ --password ${PYPI_TOKEN} dist/*
44+
- name: Test installation
45+
run: |
46+
sleep 120
47+
pip install hagelkorn==${GITHUB_REF:11}
48+
release-nuget:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v2
52+
- name: Setup .NET Core
53+
uses: actions/setup-dotnet@v1
54+
- name: Install dependencies
55+
run: dotnet restore
56+
- name: Run tests
57+
run: dotnet test
58+
- name: Build
59+
run: dotnet build --configuration Release --no-restore
60+
- name: Publish Hagelkorn
61+
uses: brandedoutcast/publish-nuget@v2
62+
with:
63+
PROJECT_FILE_PATH: Hagelkorn/Hagelkorn.csproj
64+
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
65+
NUGET_SOURCE: https://api.nuget.org
66+
INCLUDE_SYMBOLS: true

.gitlab-ci.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

README.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
[![PyPI version](https://badge.fury.io/py/hagelkorn.svg)](https://badge.fury.io/py/hagelkorn)
2+
![Nuget](https://img.shields.io/nuget/v/hagelkorn)
3+
[![pipeline](https://github.com/michaelosthege/hagelkorn/workflows/pipeline/badge.svg)](https://github.com/michaelosthege/hagelkorn/actions)
4+
[![coverage](https://codecov.io/gh/michaelosthege/hagelkorn/branch/master/graph/badge.svg)](https://codecov.io/gh/michaelosthege/hagelkorn)
5+
16
# Hagelkorn
27
This is a package for generating human-readable and human-memorable IDs.
38

@@ -23,20 +28,10 @@ hagelkorn.monotonic(resolution=0.1, overflow_years=5)
2328
```
2429

2530
## Installation
26-
27-
28-
1. Got to [Repository/Tags](https://github.com/michaelosthege/hagelkorn/releases) to view the
29-
list of releases & their release notes.
30-
2. Click the _download_ button on the right
31-
32-
![Release Download](docs/ReleaseDownload.png)
33-
34-
### Python
35-
Download the `python-release` artifact, unpack the `*.whl* and install via pip:
31+
The Python version is available [on PyPI](https://pypi.org/packages/hagelkorn):
3632

3733
```bash
38-
pip install hagelkorn-x.x-py3-none-any.whl
34+
pip install hagelkorn
3935
```
4036

41-
### C#
42-
Download the `dotnet-release` artifact, that contains the NuGet package.
37+
The C#/.NET Standard package is available [on NuGet](https://nuget.org/packages/Hagelkorn).

hagelkorn.sln

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "pyhagelkorn", "pyhagelkorn\
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D1813558-B955-41CA-8751-C02C696BFBDE}"
99
ProjectSection(SolutionItems) = preProject
10-
.gitlab-ci.yml = .gitlab-ci.yml
1110
README.md = README.md
1211
EndProjectSection
1312
EndProject
1413
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hagelkorn", "Hagelkorn\Hagelkorn.csproj", "{B5F2F4F9-EA30-41DE-BA00-0C963F1D6882}"
1514
EndProject
1615
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hagelkorn.Tests", "Hagelkorn.Tests\Hagelkorn.Tests.csproj", "{874D9203-51CD-46E4-B04C-E6F7D60D7AFF}"
1716
EndProject
17+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{9E0CD207-B9D1-4A71-B344-FED1E2F98283}"
18+
ProjectSection(SolutionItems) = preProject
19+
.github\workflows\pipeline.yml = .github\workflows\pipeline.yml
20+
.github\workflows\release.yml = .github\workflows\release.yml
21+
EndProjectSection
22+
EndProject
1823
Global
1924
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2025
Debug|Any CPU = Debug|Any CPU
@@ -35,6 +40,9 @@ Global
3540
GlobalSection(SolutionProperties) = preSolution
3641
HideSolutionNode = FALSE
3742
EndGlobalSection
43+
GlobalSection(NestedProjects) = preSolution
44+
{9E0CD207-B9D1-4A71-B344-FED1E2F98283} = {D1813558-B955-41CA-8751-C02C696BFBDE}
45+
EndGlobalSection
3846
GlobalSection(ExtensibilityGlobals) = postSolution
3947
SolutionGuid = {A3B2E33A-22D5-49F2-B52E-5FB088B430D0}
4048
EndGlobalSection

pyhagelkorn/.coveragerc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[run]
2+
omit =
3+
# exclude tests files from coverage calculation
4+
hagelkorn/test*.py

0 commit comments

Comments
 (0)