Skip to content

ci: Enhance release procedure #152

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 5 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/git-chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{ range .Versions }}
{{ range .CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts

{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
32 changes: 32 additions & 0 deletions .github/git-chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/sysdiglabs/sysdig-sdk-python
options:
commits:
# filters:
# Type:
# - feat
# - fix
# - perf
# - refactor
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
ci: Continuous Integration
docs: Documentation
chore: Small Modifications
build: Compilation & Dependencies
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
79 changes: 79 additions & 0 deletions .github/workflows/ci-master-scheduled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI - Master - Scheduled

on:
schedule:
- cron: "0 1 * * *" # 1 AM everyday https://crontab.guru/#0_1_*_*_*

jobs:
scheduled-test:
strategy:
max-parallel: 1
fail-fast: false
matrix:
python_version:
# https://python-release-cycle.glitch.me/
- "3.6"
- "3.7"
- "3.8"
- "3.9"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}

- name: Install Poetry
run: python -m pip install poetry poetry-dynamic-versioning

- uses: actions/cache@v2
name: Cache Poetry dependencies
with:
path: |
~/.cache
~/.local/share/virtualenvs/
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-

- name: Get dependencies
run: poetry install

- name: Lint
continue-on-error: true
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Travis Test - Start agent
id: start_agent
env:
PYTHON_SDC_TEST_ACCESS_KEY: ${{ secrets.STAGING_AGENT_KEY }}
run: |
sudo apt-get install linux-headers-$(uname -r) dkms gcc-multilib g++-multilib
./test/start_agent.sh

- name: Travis Test - Install dependencies
run: |
poetry build
python -m pip install $(find dist -iname "*.whl" | head -1)

- name: Travis Test - Secure APIs
env:
PYTHON_SDC_TEST_API_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
run: ./test/test_secure_apis.sh

- name: Test in staging
env:
SDC_MONITOR_TOKEN: ${{ secrets.STAGING_MONITOR_API_TOKEN }}
SDC_SECURE_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
SDC_MONITOR_URL: "https://app-staging.sysdigcloud.com"
SDC_SECURE_URL: "https://secure-staging.sysdig.com"
run: poetry run mamba -f documentation

- name: Travis Test - Stop agent
run: ./test/stop_agent.sh
if: steps.start_agent.outcome == 'success'
50 changes: 20 additions & 30 deletions .github/workflows/ci-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,53 @@ on:

jobs:
test:
strategy:
max-parallel: 1
fail-fast: true
matrix:
python_version:
# https://python-release-cycle.glitch.me/
- "3.6"
- "3.7"
- "3.8"
- "3.9"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: ${{ matrix.python_version }}

- name: Install pipenv
run: python -m pip install pipenv
- name: Install Poetry
run: python -m pip install poetry poetry-dynamic-versioning

- uses: actions/cache@v2
name: Cache Pipenv dependencies
name: Cache Poetry dependencies
with:
path: |
~/.cache
~/.local/share/virtualenvs/
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-pipenv-
${{ runner.os }}-poetry-

- name: Get dependencies
run: pipenv install -d
run: poetry install

- name: Lint
continue-on-error: true
run: |
# stop the build if there are Python syntax errors or undefined names
pipenv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
pipenv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Travis Test - Start agent
id: start_agent
env:
PYTHON_SDC_TEST_ACCESS_KEY: ${{ secrets.STAGING_AGENT_KEY }}
run: |
sudo apt-get install linux-headers-$(uname -r) dkms gcc-multilib g++-multilib
./test/start_agent.sh

- name: Travis Test - Install dependencies
run: pip install .

- name: Travis Test - Secure APIs
env:
PYTHON_SDC_TEST_API_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
run: ./test/test_secure_apis.sh

- name: Test in staging
env:
SDC_MONITOR_TOKEN: ${{ secrets.STAGING_MONITOR_API_TOKEN }}
SDC_SECURE_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }}
SDC_MONITOR_URL: "https://app-staging.sysdigcloud.com"
SDC_SECURE_URL: "https://secure-staging.sysdig.com"
run: |
pipenv run mamba -f documentation

- name: Travis Test - Stop agent
run: ./test/stop_agent.sh
if: steps.start_agent.outcome == 'success'
run: poetry run mamba -f documentation -t integration
33 changes: 18 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.15'

- name: Setup go-chglog
run: go get -u github.com/git-chglog/git-chglog/cmd/git-chglog

- name: Generate changelog
run: git-chglog -c .github/git-chglog/config.yml -o RELEASE_CHANGELOG.md $(git describe --tags $(git rev-list --tags --max-count=1))

- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -22,14 +37,7 @@ jobs:
release_name: ${{ github.ref }}
draft: true
prerelease: false
body: |
This is the ${{ github.ref }} release of the sysdig-sdk-python (sdcclient), the Python client for Sysdig Platform

### Major Changes

### Minor Changes

### Bug fixes
body_path: RELEASE_CHANGELOG.md

pypi:
runs-on: ubuntu-latest
Expand All @@ -45,12 +53,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install poetry poetry-dynamic-versioning

- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
run: poetry publish --build -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASSWORD }}
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

.PHONY: test
test:
pipenv run mamba -f documentation
poetry run mamba -f documentation

.coverage:
pipenv run coverage run $(shell pipenv run which mamba) -f documentation || true
poetry run coverage run $(shell poetry run which mamba) -f documentation || true

cover: .coverage
pipenv run coverage report --include 'sdcclient/*'
poetry run coverage report --include 'sdcclient/*'

.PHONY: cover-html
cover-html: .coverage
pipenv run coverage html -d coverage --include 'sdcclient/*'
poetry run coverage html -d coverage --include 'sdcclient/*'

24 changes: 0 additions & 24 deletions Pipfile

This file was deleted.

Loading