Skip to content

Commit c460abf

Browse files
Adding CI and lots of failing badges :)
1 parent 92789c9 commit c460abf

File tree

2 files changed

+166
-1
lines changed

2 files changed

+166
-1
lines changed

.github/workflows/ci.yml

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- stable
7+
- main
8+
tags:
9+
- v*
10+
pull_request:
11+
branches:
12+
- '**'
13+
14+
concurrency:
15+
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
16+
cancel-in-progress: true
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
22+
jobs:
23+
build:
24+
name: Build ${{ matrix.os.name }} ${{ matrix.python.name }}
25+
runs-on: ${{ matrix.os.runs-on }}
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
os:
30+
- name: 🐧
31+
runs-on: ubuntu-latest
32+
python:
33+
- name: CPython 3.10
34+
major_dot_minor: '3.10'
35+
action: '3.10'
36+
steps:
37+
- uses: actions/checkout@v3
38+
39+
- uses: actions/setup-python@v4
40+
with:
41+
# This allows the matrix to specify just the major.minor version while still
42+
# expanding it to get the latest patch version including alpha releases.
43+
# This avoids the need to update for each new alpha, beta, release candidate,
44+
# and then finally an actual release version. actions/setup-python doesn't
45+
# support this for PyPy presently so we get no help there.
46+
#
47+
# CPython -> 3.9.0-alpha - 3.9.X
48+
# PyPy -> pypy-3.7
49+
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python.action), matrix.python.action))[startsWith(matrix.python.action, 'pypy')] }}
50+
architecture: x64
51+
52+
- name: Setup environment
53+
run: |
54+
python -m pip install --upgrade pip
55+
python -m pip install build
56+
57+
- name: Build sdist and wheel
58+
run: |
59+
python -m build
60+
61+
- name: Publish package files
62+
if: always()
63+
uses: actions/upload-artifact@v3
64+
with:
65+
name: packages
66+
path: dist/*
67+
if-no-files-found: error
68+
69+
test:
70+
name: Test ${{ matrix.os.name }} ${{ matrix.python.name }}
71+
needs:
72+
- build
73+
runs-on: ${{ matrix.os.runs-on }}
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
os:
78+
- name: 🐧
79+
runs-on: ubuntu-latest
80+
- name: 🍎
81+
runs-on: macos-latest
82+
- name: 🪟
83+
runs-on: windows-latest
84+
python:
85+
- name: CPython 3.8
86+
major_dot_minor: '3.8'
87+
action: '3.8'
88+
- name: CPython 3.9
89+
major_dot_minor: '3.9'
90+
action: '3.9'
91+
- name: CPython 3.10
92+
major_dot_minor: '3.10'
93+
action: '3.10'
94+
- name: CPython 3.11
95+
major_dot_minor: '3.11'
96+
action: '3.11'
97+
- name: CPython 3.12
98+
major_dot_minor: '3.12'
99+
action: '3.12'
100+
- name: PyPy 3.8
101+
major_dot_minor: '3.8'
102+
action: 'pypy-3.8'
103+
104+
105+
steps:
106+
- uses: actions/checkout@v3
107+
with:
108+
path: repo
109+
110+
- name: Download package files
111+
uses: actions/download-artifact@v3
112+
with:
113+
name: packages
114+
path: dist
115+
116+
- uses: actions/setup-python@v4
117+
with:
118+
# This allows the matrix to specify just the major.minor version while still
119+
# expanding it to get the latest patch version including alpha releases.
120+
# This avoids the need to update for each new alpha, beta, release candidate,
121+
# and then finally an actual release version. actions/setup-python doesn't
122+
# support this for PyPy presently so we get no help there.
123+
#
124+
# CPython -> 3.9.0-alpha - 3.9.X
125+
# PyPy -> pypy-3.7
126+
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python.action), matrix.python.action))[startsWith(matrix.python.action, 'pypy')] }}
127+
architecture: x64
128+
129+
- name: Setup environment
130+
run: |
131+
python --version --version
132+
# make sure we test the installed code
133+
cp -R repo/tests/ tests/
134+
python -m pip install --upgrade pip
135+
python -m pip install ./dist/*.whl
136+
# show the directory contents for diagnostics
137+
ls -la
138+
139+
- name: Run unittest
140+
run: |
141+
python -m unittest
142+
143+
all:
144+
name: All successful
145+
runs-on: ubuntu-latest
146+
# The always() part is very important.
147+
# If not set, the job will be skipped on failing dependencies.
148+
if: always()
149+
needs:
150+
# This is the list of CI job that we are interested to be green before
151+
# a merge.
152+
- build
153+
- test
154+
steps:
155+
- name: Require all successes
156+
uses: re-actors/alls-green@v1.2.2
157+
with:
158+
jobs: ${{ toJSON(needs) }}

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@ bitformat
44

55
**bitformat** is a Python module for creating and parsing file formats, especially at the bit rather than byte level.
66

7-
It is intended to complement the **bitstring** module, but is currently at a planning stage and is not yet recommended for use.
7+
It is intended to complement the [**bitstring**](https://github.com/scott-griffiths/bitstring) module, but is currently at a planning stage and is not yet recommended for use.
8+
9+
[![CI badge](https://github.com/scott-griffiths/bitformat/actions/workflows/.github/workflows/ci.yml/badge.svg)](https://github.com/scott-griffiths/bitformat/actions/workflows/ci.yml)
10+
[![Docs](https://img.shields.io/readthedocs/bitformat?logo=readthedocs&logoColor=white)](https://bitformat.readthedocs.io/en/latest/)
11+
[![Dependents (via libraries.io)](https://img.shields.io/librariesio/dependents/pypi/bitformat?logo=libraries.io&logoColor=white)](https://libraries.io/pypi/bitstring)
12+
   
13+
[![Pepy Total Downlods](https://img.shields.io/pepy/dt/bitformat?logo=python&logoColor=white&labelColor=blue&color=blue)](https://pypistats.org/packages/bitformat)
14+
[![PyPI - Downloads](https://img.shields.io/pypi/dm/bitformat?label=%40&labelColor=blue&color=blue)](https://pypistats.org/packages/bitformat)

0 commit comments

Comments
 (0)