Skip to content

Commit

Permalink
MRG: Merge pull request #12 from octue/devops/deploy-with-namespace
Browse files Browse the repository at this point in the history
Clean up service
  • Loading branch information
cortadocodes authored Dec 22, 2022
2 parents 2c16a04 + 741f485 commit 29c2f47
Show file tree
Hide file tree
Showing 20 changed files with 1,340 additions and 142 deletions.
6 changes: 0 additions & 6 deletions .dockerignore

This file was deleted.

23 changes: 10 additions & 13 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
name: python-ci

on: [push]
on:
push:
branches-ignore:
- main

jobs:

check-semantic-version:
if: "!contains(github.event.head_commit.message, 'skipci')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# Set fetch-depth to 0 to fetch all tags (necessary for git-mkver to determine the correct semantic version).
fetch-depth: 0
- uses: actions/setup-python@v2
- name: Install git-mkver
run: |
curl -L https://github.com/idc101/git-mkver/releases/download/v1.2.1/git-mkver-linux-amd64-1.2.1.tar.gz \
| tar xvz \
&& sudo mv git-mkver /usr/local/bin
- name: Install semantic version checker
run: pip install git+https://github.com/octue/conventional-commits
- name: Check version
run: check-semantic-version setup.py

- uses: octue/check-semantic-version@1.0.0.beta-9
with:
path: pyproject.toml
breaking_change_indicated_by: minor
32 changes: 19 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@ jobs:
if: "github.event.pull_request.merged == true && !contains(github.event.pull_request.head.message, 'skipci')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get package version
run: echo "PACKAGE_VERSION=$(python setup.py --version)" >> $GITHUB_ENV
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, no need to create your own.
with:
tag_name: ${{ env.PACKAGE_VERSION }}
release_name: ${{ github.event.pull_request.title }}
body: ${{ github.event.pull_request.body }}
draft: false
prerelease: false
- uses: actions/checkout@v2

- name: Install Poetry
uses: snok/install-poetry@v1.3.2

- name: Get package version
id: get-package-version
run: echo "PACKAGE_VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, no need to create your own.
with:
tag_name: ${{ steps.get-package-version.outputs.PACKAGE_VERSION }}
release_name: ${{ github.event.pull_request.title }}
body: ${{ github.event.pull_request.body }}
draft: false
prerelease: false
29 changes: 13 additions & 16 deletions .github/workflows/update-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,16 @@ jobs:
if: "!contains(github.event.pull_request.body, '<!--- SKIP AUTOGENERATED NOTES --->')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
# Set fetch-depth to 0 to fetch all commit history (necessary for compiling pull request description).
fetch-depth: 0
- name: Install release note compiler
run: pip install git+https://github.com/octue/conventional-commits
- name: Compile new pull request description
run: |
echo 'PULL_REQUEST_NOTES<<EOF' >> $GITHUB_ENV
echo "$(compile-release-notes PULL_REQUEST_START --pull-request-url=${{ github.event.pull_request.url }} --api-token=${{ secrets.GITHUB_TOKEN }})" >> $GITHUB_ENV
echo EOF >> $GITHUB_ENV
- name: Update pull request body
uses: riskledger/update-pr-description@v2
with:
body: ${{ env.PULL_REQUEST_NOTES }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3

- uses: octue/generate-pull-request-description@1.0.0.beta-2
id: pr-description
with:
pull_request_url: ${{ github.event.pull_request.url }}
api_token: ${{ secrets.GITHUB_TOKEN }}

- name: Update pull request body
uses: riskledger/update-pr-description@v2
with:
body: ${{ steps.pr-description.outputs.pull_request_description }}
token: ${{ secrets.GITHUB_TOKEN }}
70 changes: 70 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
exclude: "build|.git/|.tox|dist|octue.egg-info"
default_stages: [commit]
fail_fast: true
default_language_version:
python: python3 # force all unspecified python hooks to run python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
args: ["--line-length", "120"]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
language_version: python3
additional_dependencies:
- "pep8-naming"
args:
- --ignore-names=setUp,tearDown,setUpClass,tearDownClass,asyncSetUp,asyncTearDown,setUpTestData,failureException,longMessage,maxDiff,startTestRun,stopTestRun

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier

- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle

- repo: https://github.com/windpioneers/pre-commit-hooks
rev: 0.0.5
hooks:
- id: check-branch-name
args:
- "^main$"
- "^development$"
- "^devops/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^doc/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^feature/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^enhancement/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^fix/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^hotfix/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^review/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^refactor/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^test/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^style/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^deprecation/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"
- "^dependencies/([a-z][a-z0-9]*)(-[a-z0-9]+)*$"

- repo: https://github.com/octue/conventional-commits
rev: 0.8.1
hooks:
- id: check-commit-message-is-conventional
stages: [commit-msg]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# example-service-cloud-run
Trying to get cloud run to deploy a template service

An example Octue service for deploying to Google Cloud Run. Questions can be sent to it at `octue/example-service-cloud-run:latest`.
2 changes: 1 addition & 1 deletion app_configuration.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"output_location": "gs://octue-sdk-python-test-bucket/example_output_datasets"
"output_location": "gs://octue-sdk-python-test-bucket/example_output_datasets"
}
File renamed without changes.
2 changes: 1 addition & 1 deletion app.py → example_service_cloud_run/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from octue.resources import Datafile, Dataset

from example_package.submodule import do_something
from example_service_cloud_run.submodule import do_something


logger = logging.getLogger(__name__)
Expand Down
File renamed without changes.
41 changes: 0 additions & 41 deletions mkver.conf

This file was deleted.

5 changes: 3 additions & 2 deletions octue.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
services:
- name: example-service-cloud-run
organisation: octue
- namespace: octue
name: example-service-cloud-run
app_source_path: example_service_cloud_run
project_name: octue-amy
region: europe-west2
repository_owner: octue
Expand Down
Loading

0 comments on commit 29c2f47

Please sign in to comment.