Skip to content

Commit 967cca1

Browse files
authored
Merge pull request #28 from Indicio-tech/release/0.1.0
Preapre 0.1.0 release and github workflows to help
2 parents d98747a + 81e6427 commit 967cca1

File tree

10 files changed

+576
-1291
lines changed

10 files changed

+576
-1291
lines changed

.github/workflows/code-quality-check.yml

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,27 @@ on:
99
pull_request:
1010

1111
env:
12-
FLAKE8_VERSION: 3.9.2
13-
BLACK_VERSION: 21.8b0
12+
FLAKE8_VERSION: 5.0.4
13+
BLACK_VERSION: 22.3.0
1414

1515
jobs:
1616
format:
1717
name: Format and Lint Check
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v2
21-
- name: Set up Python 3.6
22-
uses: actions/setup-python@v2
20+
- uses: actions/checkout@v3
21+
- name: Set up Python 3.10
22+
id: setup
23+
uses: actions/setup-python@v4
2324
with:
24-
python-version: 3.6
25-
- name: Cache python environment
26-
id: cache-env
27-
uses: actions/cache@v2
28-
with:
29-
path: env
30-
key: ${{ runner.os }}-format-lint-${{ env.FLAKE8_VERSION }}-${{ env.BLACK_VERSION }}-${{ hashFiles('.github/workflows/code-quality-check.yml') }}
31-
- name: create virtual environment
32-
if: steps.cache-env.outputs.cache-hit != 'true'
33-
run: |
34-
python -m venv env
25+
python-version: '3.10'
26+
cache: 'pip'
27+
cache-dependency-path: '.github/workflows/requirements.cqc.txt'
3528
- name: Install dependencies
36-
if: steps.cache-env.outputs.cache-hit != 'true'
37-
run: |
38-
env/bin/python -m pip install black==${{ env.BLACK_VERSION }}
39-
env/bin/python -m pip install flake8==${{ env.FLAKE8_VERSION }}
29+
run: pip install -r .github/workflows/requirements.cqc.txt
4030
- name: Black Format Check
41-
run: |
42-
env/bin/python -m black --check acapy_plugin_pickup tests int/tests
31+
run: python -m black --check acapy_plugin_pickup tests int/tests
4332
- name: Lint with flake8
4433
run: |
45-
# stop the build if there are Python syntax errors or undefined names
46-
env/bin/python -m flake8 . --exclude=env --count --select=E9,F63,F7,F82 --show-source --statistics
47-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
48-
env/bin/python -m flake8 . --exclude=env --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
34+
python -m flake8 . --exclude=env --count --select=E9,F63,F7,F82 --show-source --statistics
35+
python -m flake8 . --exclude=env --count --exit-zero --max-complexity=10 --max-line-length=90 --statistics
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Manual Publish Image
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
tag:
6+
description: 'Image tag'
7+
required: true
8+
type: string
9+
10+
11+
jobs:
12+
publish-image:
13+
name: Publish
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Gather image info
19+
id: info
20+
run: |
21+
echo "::set-output name=repo-owner::${GITHUB_REPOSITORY_OWNER,,}"
22+
23+
- name: Cache Docker layers
24+
uses: actions/cache@v3
25+
with:
26+
path: /tmp/.buildx-cache
27+
key: ${{ runner.os }}-buildx-${{ github.sha }}
28+
restore-keys: |
29+
${{ runner.os }}-buildx-
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v1
33+
34+
- name: Log in to the GitHub Container Registry
35+
uses: docker/login-action@v1
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Setup Image Metadata
42+
id: base-meta
43+
uses: docker/metadata-action@v3
44+
with:
45+
images: |
46+
ghcr.io/${{ steps.info.outputs.repo-owner }}/acapy-plugin-pickup
47+
tags: |
48+
type=raw,value=${{ inputs.tag }}
49+
50+
- name: Build and Push Image to ghcr.io
51+
uses: docker/build-push-action@v3
52+
with:
53+
push: true
54+
context: .
55+
file: docker/Dockerfile
56+
tags: ${{ steps.base-meta.outputs.tags }}
57+
labels: ${{ steps.base-meta.outputs.labels }}
58+
cache-from: type=local,src=/tmp/.buildx-cache
59+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
60+
61+
# Temp fix
62+
# https://github.com/docker/build-push-action/issues/252
63+
# https://github.com/moby/buildkit/issues/1896
64+
- name: Move cache
65+
run: |
66+
rm -rf /tmp/.buildx-cache
67+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish Image
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
publish-image:
8+
name: Publish
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- name: Gather image info
14+
id: info
15+
run: |
16+
echo "::set-output name=repo-owner::${GITHUB_REPOSITORY_OWNER,,}"
17+
18+
- name: Cache Docker layers
19+
uses: actions/cache@v3
20+
with:
21+
path: /tmp/.buildx-cache
22+
key: ${{ runner.os }}-buildx-${{ github.sha }}
23+
restore-keys: |
24+
${{ runner.os }}-buildx-
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v1
28+
29+
- name: Log in to the GitHub Container Registry
30+
uses: docker/login-action@v1
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Setup Image Metadata
37+
id: base-meta
38+
uses: docker/metadata-action@v3
39+
with:
40+
images: |
41+
ghcr.io/${{ steps.info.outputs.repo-owner }}/acapy-plugin-pickup
42+
tags: |
43+
type=semver
44+
type=sha
45+
46+
- name: Build and Push Image to ghcr.io
47+
uses: docker/build-push-action@v3
48+
with:
49+
push: true
50+
context: .
51+
file: docker/Dockerfile.release
52+
tags: ${{ steps.base-meta.outputs.tags }}
53+
labels: ${{ steps.base-meta.outputs.labels }}
54+
cache-from: type=local,src=/tmp/.buildx-cache
55+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
56+
57+
# Temp fix
58+
# https://github.com/docker/build-push-action/issues/252
59+
# https://github.com/moby/buildkit/issues/1896
60+
- name: Move cache
61+
run: |
62+
rm -rf /tmp/.buildx-cache
63+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Upload Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
env:
8+
PYTHON_VERSION: 3.7
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Install poetry
16+
run: pipx install poetry
17+
- name: Setup Python
18+
id: setup
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: ${{ env.PYTHON_VERSION }}
22+
cache: 'poetry'
23+
- name: Install dependencies
24+
if: steps.setup.outputs.cache-hit != 'true'
25+
run: poetry install
26+
- name: Confidence check (run tests)
27+
run: poetry run pytest
28+
- name: Build package
29+
run: poetry build
30+
- name: Publish package
31+
env:
32+
POETRY_PYPI_TOKEN_PYPI: ${{secrets.pypi_upload}}
33+
run: poetry publish
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
black==22.6.0
2+
flake8==5.0.4

.github/workflows/tests.yml

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,58 +4,36 @@ on:
44
branches: [ main ]
55
pull_request:
66

7-
env:
8-
POETRY_VERSION: 1.1.11
9-
CACHE: 0
10-
117
jobs:
128
test:
139
name: Tests
1410
runs-on: ubuntu-latest
1511
strategy:
1612
matrix:
17-
python-version: [3.7, 3.8, 3.9]
13+
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
1814

1915
steps:
20-
- uses: actions/checkout@v2
21-
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v2
23-
with:
24-
python-version: ${{ matrix.python-version }}
25-
- name: Cache poetry installation
26-
id: cache-poetry
27-
uses: actions/cache@v2
28-
with:
29-
path: ~/.local
30-
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ env.POETRY_VERSION }}-${{ hashFiles('.github/workflows/tests.yml') }}
31-
- name: Install poetry
32-
if: steps.cache-poetry.outputs.cache-hit != 'true'
33-
run: |
34-
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - --version=${{ env.POETRY_VERSION }}
35-
- name: Setup poetry environment
36-
id: setup-poetry-env
37-
run: |
38-
poetry env use $(which python)
39-
echo "::set-output name=poetry-env::$(poetry env info --path)"
40-
- name: Cache poetry virtual environment
41-
id: cache-poetry-venv
42-
uses: actions/cache@v2
43-
with:
44-
path: ${{ steps.setup-poetry-env.outputs.poetry-env }}
45-
key: poetry-env-${{ runner.os }}-${{ matrix.python-version }}-${{ env.POETRY_VERSION }}-${{ hashFiles('poetry.lock') }}-${{ hashFiles('.github/workflows/tests.yml') }}
46-
- name: Install dependencies
47-
if: steps.cache-poetry-venv.outputs.cache-hit != 'true'
48-
run: |
49-
poetry install
50-
- name: Run unit tests with pytest
51-
run: |
52-
poetry run pytest ./tests
16+
- uses: actions/checkout@v3
17+
- name: Install poetry
18+
run: pipx install poetry
19+
- name: Setup Python
20+
id: setup
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
cache: 'poetry'
25+
- name: Install dependencies
26+
if: steps.setup.outputs.cache-hit != 'true'
27+
run: poetry install
28+
- name: Run unit tests with pytest
29+
run: |
30+
poetry run pytest ./tests
5331
5432
int:
5533
name: Integration Tests
5634
runs-on: ubuntu-latest
5735
steps:
58-
- uses: actions/checkout@v2
36+
- uses: actions/checkout@v3
5937
- name: Run integration tests
6038
run: |
6139
docker-compose -f ./int/docker-compose.yml run tests

0 commit comments

Comments
 (0)