-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
209 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Github CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '**' | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
linter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/pypoetry | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
make dependencies | ||
- name: Lint with pylint | ||
run: | | ||
make lint | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cache/pypoetry | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
make dependencies | ||
- name: Build the package | ||
run: | | ||
poetry build | ||
unit: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
make dependencies | ||
- name: Prepare coverage | ||
run: | | ||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | ||
chmod +x ./cc-test-reporter | ||
./cc-test-reporter before-build | ||
- name: Unit test with nose test suite | ||
run: | | ||
make unit | ||
env: | ||
LOG_LEVEL: ERROR | ||
|
||
- name: Report coverage | ||
run: | | ||
poetry run coverage xml | ||
GIT_COMMIT_SHA=`[[ -z "$GITHUB_HEAD_REF" ]] && echo $GITHUB_SHA || echo ${{ github.event.pull_request.head.sha }}` GIT_BRANCH=`[[ -z "$GITHUB_HEAD_REF" ]] && echo ${GITHUB_REF/refs\/heads\/} || echo $GITHUB_HEAD_REF` ./cc-test-reporter after-build -t coverage.py --exit-code $? | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Setup Environment | ||
run: | | ||
make setup | ||
- name: Build & Release package | ||
run: | | ||
make publish | ||
env: | ||
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Tag & Release Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Setup Environment | ||
run: | | ||
make setup | ||
env: | ||
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
- name: Detect version upgrade | ||
id: versioning | ||
run: | | ||
package_version=$(echo $(poetry version -v) | sed "s/django-cloud-tasks //") | ||
echo "::set-output name=package_version::"$package_version | ||
upgraded=$(git tag --list | grep -q "${package_version}$" && echo "false" || echo "true") | ||
echo "::set-output name=upgraded::"$upgraded | ||
pre_release=$([[ $package_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "false" || echo "true") | ||
echo "::set-output name=pre_release::"$pre_release | ||
- name: Create Release | ||
if: ${{ steps.versioning.outputs.upgraded == 'true' }} | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.versioning.outputs.package_version }} | ||
release_name: Release ${{ steps.versioning.outputs.package_version }} | ||
body: | | ||
Auto-released by bot. | ||
See commit changes. | ||
draft: false | ||
prerelease: ${{ steps.versioning.outputs.pre_release }} | ||
- name: Build & Release package | ||
if: ${{ steps.versioning.outputs.upgraded == 'true' }} | ||
run: | | ||
make publish | ||
env: | ||
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
on: | ||
schedule: | ||
- cron: '0 0 * * 1' # every monday at 00:00 | ||
|
||
name: Update packages | ||
jobs: | ||
release: | ||
name: Update dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Install Python dependencies | ||
run: | | ||
make dependencies | ||
env: | ||
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
- name: Update dependencies | ||
run: | | ||
make update | ||
poetry version patch | ||
env: | ||
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v2 | ||
with: | ||
token: ${{ secrets.PAT }} | ||
base: master | ||
branch: feature/auto-update | ||
commit-message: Updated dependencies | ||
title: 'Dependency Update' | ||
body: | | ||
All dependencies have been update by the Github Action bot. | ||
labels: dependencies | ||
team-reviewers: developers | ||
draft: false | ||
request-to-parent: false | ||
- name: Check outputs | ||
run: | | ||
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}" | ||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" |