Skip to content

Commit b188f79

Browse files
authored
Add GH Workflow and config variants (CircleCI-Public#6)
* Create action to run config variant Rather than use circleci and confuse users with the circleci config fie, we can use an action to ensure all the config variants are tested * fix regex for deploy, failing CI until envvars are set * fix regex, now fail? * fix runtime.txt for heroku * Forgot a dependency * need to do a force push since we're changing history * valid extended config * Update readme with details on variants
1 parent 222c285 commit b188f79

12 files changed

Lines changed: 735 additions & 6 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: 2.1
2+
3+
orbs:
4+
# The python orb contains a set of prepackaged circleci configuration you can use repeatedly in your configurations files
5+
# Orb commands and jobs help you with common scripting around a language/tool
6+
# so you dont have to copy and paste it everywhere.
7+
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python
8+
python: circleci/python@1.2
9+
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/heroku
10+
heroku: circleci/heroku@1.2
11+
12+
workflows:
13+
sample: # This is the name of the workflow, feel free to change it to better match your workflow.
14+
# Inside the workflow, you define the jobs you want to run.
15+
# For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
16+
jobs:
17+
- build-and-test
18+
- heroku/deploy-via-git:
19+
force: true # this parameter instructs the push to use a force flag when pushing to the heroku remote, see: https://devcenter.heroku.com/articles/git
20+
requires:
21+
- build-and-test # only run deploy-via-git job if the build job has completed
22+
filters:
23+
branches:
24+
# This sample config runs this job on any branch matching the regex below, however, it's more likely you want to only run this job on master.
25+
only: /.*-heroku-deploy/ # Delete this line
26+
# only: master # Uncomment this line
27+
28+
jobs:
29+
build-and-test: # This is the name of the job, feel free to change it to better match what you're trying to do!
30+
# These next lines defines a docker executors: https://circleci.com/docs/2.0/executor-types/
31+
# You can specify an image from dockerhub or use one of the convenience images from CircleCI's Developer Hub
32+
# A list of available CircleCI docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python
33+
# The executor is the environment in which the steps below will be executed - below will use a python 3.9 container
34+
# Change the version below to your required version of python
35+
docker:
36+
- image: cimg/python:3.8
37+
# Checkout the code as the first step. This is a dedicated CircleCI step.
38+
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
39+
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
40+
# Then run your tests!
41+
# CircleCI will report the results back to your VCS provider.
42+
steps:
43+
- checkout
44+
- python/install-packages:
45+
pkg-manager: pip
46+
# app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
47+
# pip-dependency-file: test-requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements.
48+
- run:
49+
name: Run tests
50+
# This assumes pytest is installed via the install-package step above
51+
command: pytest

.circleci/extended/pylint.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: 2.1
2+
3+
orbs:
4+
# The python orb contains a set of prepackaged circleci configuration you can use repeatedly in your configurations files
5+
# Orb commands and jobs help you with common scripting around a language/tool
6+
# so you dont have to copy and paste it everywhere.
7+
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python
8+
python: circleci/python@1.2
9+
10+
workflows:
11+
sample: # This is the name of the workflow, feel free to change it to better match your workflow.
12+
# Inside the workflow, you define the jobs you want to run.
13+
# For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
14+
jobs:
15+
- build-and-test
16+
17+
18+
jobs:
19+
build-and-test: # This is the name of the job, feel free to change it to better match what you're trying to do!
20+
# These next lines defines a docker executors: https://circleci.com/docs/2.0/executor-types/
21+
# You can specify an image from dockerhub or use one of the convenience images from CircleCI's Developer Hub
22+
# A list of available CircleCI docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python
23+
# The executor is the environment in which the steps below will be executed - below will use a python 3.9 container
24+
# Change the version below to your required version of python
25+
docker:
26+
- image: cimg/python:3.8
27+
# Checkout the code as the first step. This is a dedicated CircleCI step.
28+
# The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
29+
# Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
30+
# Then run your tests!
31+
# CircleCI will report the results back to your VCS provider.
32+
steps:
33+
- checkout
34+
- python/install-packages:
35+
pkg-manager: pip
36+
# app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
37+
# pip-dependency-file: test-requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements.
38+
- run:
39+
name: Run pylint
40+
# This assumes pylint is installed via the install-package step above
41+
command: pylint openapi_server
42+
- run:
43+
name: Run tests
44+
# This assumes pytest is installed via the install-package step above
45+
command: pytest
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: test-extended-configs
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
# TODO add an action workflow to ensure every file in .circleci/extended appears in this list
11+
configfile: ["heroku-deploy", "pylint"]
12+
steps:
13+
- name: checkout
14+
uses: actions/checkout@v2
15+
with:
16+
ref: ${{ github.event.pull_request.head.sha }}
17+
- name: Replace config
18+
run: cp .circleci/extended/${{ matrix.configfile }}.yml .circleci/config.yml
19+
- name: commit-push_branch-test
20+
uses: dsayling/commit-branch-check-action@v0.0.8
21+
with:
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
files: ".circleci/config.yml"
24+
commit-message: "Update circleci config for ${{ matrix.configfile }} from ${{github.event.pull_request.head.ref}}"
25+
dest-branch: ${{github.event.pull_request.head.ref}}-${{ matrix.configfile }}
26+
verify-checks: true
27+
delete-after-checks: true
28+

0 commit comments

Comments
 (0)