Skip to content

Commit 8c264cb

Browse files
Joris ConijnJoris Conijn
authored andcommitted
feat: implement ci workflow
1 parent 2468225 commit 8c264cb

File tree

6 files changed

+173
-40
lines changed

6 files changed

+173
-40
lines changed

.github/workflows/makefile.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
11+
ci:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: [3.8, 3.9]
16+
os: [ubuntu-latest]
17+
runs-on: ${{ matrix.os }}
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Run image
24+
uses: abatilo/actions-poetry@v2.1.3
25+
- name: Install dependencies
26+
run: make install
27+
- name: Run check
28+
run: make test

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Create Release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
7+
jobs:
8+
build:
9+
name: Create Release
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
- name: Install python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.9
18+
- name: Prepare variables
19+
id: vars
20+
run: |
21+
echo ::set-output name=version::$(awk '/version/{print $NF}' pyproject.toml | sed 's/\"//g')
22+
- name: Install poetry
23+
uses: abatilo/actions-poetry@v2.1.3
24+
- name: Install dependencies
25+
run: make install
26+
- name: Run check
27+
run: make build
28+
- name: Create Release
29+
id: create_release
30+
uses: actions/create-release@v1
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
with:
34+
tag_name: ${{ github.ref }}
35+
release_name: Release v${{ steps.vars.outputs.version }}
36+
draft: false
37+
prerelease: false
38+
- name: Upload Release Asset
39+
id: upload-release-asset
40+
uses: actions/upload-release-asset@v1
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
upload_url: ${{ steps.create_release.outputs.upload_url }}
45+
asset_path: ./dist/report2junit-${{ steps.vars.outputs.version }}.tar.gz
46+
asset_name: report2junit-${{ steps.vars.outputs.version }}.tar.gz
47+
asset_content_type: application/tar+gzip

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ SHELL = /bin/bash -c
22
VIRTUAL_ENV = $(shell poetry env info --path)
33
export BASH_ENV=$(VIRTUAL_ENV)/bin/activate
44

5-
.PHONY: lint test install clean run release
5+
.PHONY: lint test install clean run build release tag
66

77
lint: _black _mypy
88

@@ -11,7 +11,6 @@ test: lint
1111

1212
install: $(VIRTUAL_ENV)
1313
poetry install
14-
pre-commit install
1514

1615
clean:
1716
[[ -d "$(VIRTUAL_ENV)" ]] && rm -rf "$(VIRTUAL_ENV)" || true
@@ -26,8 +25,10 @@ run:
2625
report2junit --source-type cfn-guard ./sample-reports/cfn-guard.json
2726
report2junit --source-type cfn-nag ./sample-reports/cfn-nag.json
2827

29-
release:
28+
build:
3029
python setup.py sdist
30+
31+
release: build
3132
twine upload dist/*
3233

3334
.PHONY: _black _mypy
@@ -39,7 +40,5 @@ _black:
3940
_mypy:
4041
$(info [*] Python static type checker...)
4142
mypy --junit-xml reports/typecheck.xml report2junit
42-
#--cobertura-xml-report reports
43-
# --html-report reports
4443

4544
$(VERBOSE).SILENT:

0 commit comments

Comments
 (0)