Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

SAM-232: Testing improvements - use docker compose to run 3rd party services #462

Draft
wants to merge 147 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
656946a
initial work to add a docker compose configuration for arango, kafka,…
eapearson Apr 14, 2022
96fd48e
improve some comments [SAM-232]
eapearson Apr 14, 2022
be057cd
fix punctuation [SAM-232]
eapearson Apr 14, 2022
de80e90
add support for ensuring host dependencies, installing some service d…
eapearson Apr 14, 2022
945a4b9
remote pipenv from Pipfile! [SAM-232]
eapearson Apr 20, 2022
98942d1
reorganize gitignore file [SAM-232]
eapearson Apr 21, 2022
e28eefe
reorganize test files, refactor for move, refactor for containerized …
eapearson Apr 21, 2022
8a17df5
move test utils with assertions into test_assertions; reorganize impo…
eapearson Apr 21, 2022
07d98d2
replace mongo executable with mongo container; remove mongo controlle…
eapearson Apr 21, 2022
f291442
first pass at simplifying the GHA workflow so it is easier to incorpo…
eapearson Apr 21, 2022
8ec8764
set up python and pipenv [SAM-232]
eapearson Apr 21, 2022
aa385ae
hmm, PWD not set in GHA? [SAM-232]
eapearson Apr 21, 2022
fb7a9c9
actually, fix setup script [SAM-232]
eapearson Apr 21, 2022
df0d147
remove backup argument for sed [SAM-232]
eapearson Apr 21, 2022
c429455
Merge remote-tracking branch 'origin/develop' into feature-SAM-232
eapearson Apr 22, 2022
9c0fe94
remove duplicate documentation (crept in with merge) [SAM-232]
eapearson Apr 22, 2022
de3f4c7
ignore more development/testing artifacts [SAM-232]
eapearson Apr 22, 2022
c227450
restore mypy testing, mypy fixes [SAM-232]
eapearson Apr 22, 2022
9f6fed3
add coverage reports and ignore them [SAM-232]
eapearson Apr 23, 2022
719e460
fix sed usage [SAM-232]
eapearson Apr 23, 2022
965235c
update dependencies in order to be able to use newer coverage with im…
eapearson Apr 23, 2022
2edc608
iterate on documentation (wip) [SAM-232]
eapearson Apr 23, 2022
ca59815
update GHA workflow [SAM-232]
eapearson Apr 23, 2022
255370e
for creating test.cfg, replace sed with jinja2-based compile-template…
eapearson Apr 24, 2022
1ce9deb
install python dependencies earlier in the setup script [SAM-232]
eapearson Apr 24, 2022
00c8c4e
restore pytest-cov [SAM-232]
eapearson Apr 24, 2022
535d00a
remove old "example" config file [SAM-232]
eapearson Apr 24, 2022
a7d5e4b
fix coverage generation [SAM-232]
eapearson Apr 24, 2022
254c4cd
improve badges (wip) [SAM-232]
eapearson Apr 24, 2022
989bdb2
restore push to codecov [SAM-232]
eapearson Apr 24, 2022
c10fc49
trigger from push to develop, PR against develop [SAM-232]
eapearson Apr 24, 2022
cecc670
badge shows master and develop [SAM-232]
eapearson Apr 24, 2022
a48de1d
remove codecov develop branch badge; multiple branches not supported …
eapearson Apr 24, 2022
e1bb995
print coverage summary as separate step in log [SAM-232]
eapearson Apr 25, 2022
83e1b67
additional test documentation [SAM-232]
eapearson Apr 25, 2022
9518268
simplify name of coverage summary step [SAM-232]
eapearson Apr 25, 2022
0557abd
switch to kbase account for badges [SAM-232]
eapearson Apr 25, 2022
1fdc641
remove commented out code [SAM-232]
eapearson Apr 25, 2022
6cca5c0
remove mongo install support [SAM-232]
eapearson Apr 25, 2022
052f2e6
move into test/scripts rather than main scripts [SAM-232]
eapearson Apr 25, 2022
8a8ea61
add blank line (pep8 compliance) [SAM-232]
eapearson Apr 25, 2022
ad46ebf
remove development notes file [SAM-232]
eapearson Apr 25, 2022
c6de61e
rename task [SAM-232]
eapearson Apr 25, 2022
0dcdd9c
remove obsolete (non-existent) make task references [SAM-232]
eapearson Apr 25, 2022
af3559f
fix code comment [SAM-232]
eapearson Apr 25, 2022
86855fc
replace existing GHA workflow files (7 yaml files, 7 scripts) with si…
eapearson Apr 27, 2022
c3eff17
rename workflow [SAM-238]
eapearson Apr 27, 2022
8172fe7
use shorter image tags (pull_request-* -> pr-*, release-v* -> v*) [SA…
eapearson Apr 27, 2022
0c3695f
try skipping duplicate jobs (pr, push) [SAM-238]
eapearson Apr 27, 2022
860dfb0
change name of pre_job [SAM-238]
eapearson Apr 28, 2022
381f6cf
tinker with reusable workflows [SAM-238]
eapearson Apr 28, 2022
85c85fb
tinker with reusable workflows [SAM-238]
eapearson Apr 28, 2022
4a71efb
tinker with reusable workflows [SAM-238]
eapearson Apr 28, 2022
7d56867
tinker with reusable workflows [SAM-238]
eapearson Apr 28, 2022
41f156a
tinker with reusable workflows [SAM-238]
eapearson Apr 28, 2022
d5a09f8
tinker with reusable workflows [SAM-238]
eapearson Apr 28, 2022
ed66e65
tinker with reusable workflows [SAM-238]
eapearson Apr 28, 2022
f196916
tinker with reusable workflows [SAM-238]
eapearson Apr 28, 2022
d32b05f
tinker with reusable workflows [SAM-238]
eapearson Apr 28, 2022
de6e3c9
remove image build from pr workflow, remove some empty lines [SAM-238]
eapearson Apr 28, 2022
e0717e9
Improve descriptions, specify PR triggering types [SAM-238]
eapearson Apr 28, 2022
8453ada
remove edit as condition [SAM-238]
eapearson Apr 28, 2022
084fc17
update gha docs [SAM-238]
eapearson Apr 28, 2022
5cea03c
improve naming [SAM-238]
eapearson Apr 28, 2022
d1808d1
improve workflow names for appearance in github ui [SAM-238]
eapearson Apr 28, 2022
e092ed6
improve workflow names for appearance in github ui (again) [SAM-238]
eapearson Apr 28, 2022
20d5ac8
adjust naming, work on docs [SAM-238]
eapearson Apr 28, 2022
ac18b83
doc updates [SAM-238]
eapearson Apr 28, 2022
e93a164
Merge remote-tracking branch 'origin/develop' into feature-SAM-238
eapearson Apr 28, 2022
a4ced27
move test-setup into scripts directory [SAM-232]
eapearson Apr 28, 2022
876727b
Merge remote-tracking branch 'origin/develop' into feature-SAM-232
eapearson Apr 28, 2022
81bc7e6
Merge remote-tracking branch 'origin/feature-SAM-238' into feature-SA…
eapearson Apr 28, 2022
95448df
remove old gha workflow file [SAM-232]
eapearson Apr 29, 2022
f6ccfeb
restore test template [SAM-232]
eapearson Apr 29, 2022
cb62510
remove unused (and empty) file [SAM-232]
eapearson Apr 29, 2022
d449c9d
improve testing documentation [SAM-232]
eapearson May 4, 2022
d08ea60
remove file remaining after merge [SAM-232]
eapearson May 4, 2022
93e24c6
prefix reusable workflows with "reusable-"; this helps organize workf…
eapearson May 4, 2022
9356e35
prefix reusable workflows with "reusable-"; this helps organize workf…
eapearson May 4, 2022
fe3735f
update gha doc [SAM-232]
eapearson May 4, 2022
f1d9ccc
namespace reusable workflow files with a prefix "reusable-"; helps or…
eapearson May 4, 2022
7670d0e
first pass at alignment w/devops practices [SAM-238]
eapearson May 5, 2022
a240a24
fix tags [SAM-238]
eapearson May 5, 2022
98801c4
fix regression in secret names [SAM-238]
eapearson May 5, 2022
97d3721
rename created -> opened (matches event name) [SAM-238]
eapearson May 5, 2022
59ff7cf
update docs [SAM-238]
eapearson May 5, 2022
1401904
inherit secrets [SAM-238]
eapearson May 5, 2022
1543e10
small doc edit to trigger pr sync event [SAM-238]
eapearson May 5, 2022
7e35615
fix name; copied wrong context prop [SAM-238]
eapearson May 5, 2022
d2df798
fix pr number (copy pasta) [SAM-238]
eapearson May 5, 2022
0d81716
fix repo owner [SAM-238]
eapearson May 5, 2022
c51ebab
fix repo owner [SAM-238]
eapearson May 5, 2022
ab93924
rename reusable- to reusable_ (dash to underscore); add semver check …
eapearson May 5, 2022
d6acab6
add semver check [SAM-238]
eapearson May 5, 2022
fbf81c2
add semver check [SAM-238]
eapearson May 5, 2022
4914dd3
try script to create tags [SAM-238]
eapearson May 5, 2022
dd986f3
disable test temporarily [SAM-238]
eapearson May 5, 2022
ee6609b
disable test temporarily [SAM-238]
eapearson May 5, 2022
a497874
try core api [SAM-238]
eapearson May 5, 2022
f36c77d
fix script usage [SAM-238]
eapearson May 5, 2022
ab6ba17
fix script usage [SAM-238]
eapearson May 5, 2022
f77e7d8
fix script [SAM-238]
eapearson May 5, 2022
195a82c
fix script [SAM-238]
eapearson May 5, 2022
af2d51a
fix script [SAM-238]
eapearson May 5, 2022
971808a
fix script [SAM-238]
eapearson May 5, 2022
39df0db
fix script [SAM-238]
eapearson May 6, 2022
f5abf76
fix script [SAM-238]
eapearson May 6, 2022
66de2f6
convert release to single workflow, add quotes to many places where s…
eapearson May 6, 2022
91479b3
provide "push" input to control whether built image is pushed to GHCR…
eapearson May 6, 2022
c98adb1
don't push image for develop pr builds [SAM-238]
eapearson May 6, 2022
3a1df0d
make tag optional, to simplify non-push workflows [SAM-238]
eapearson May 6, 2022
2e2c953
fix yaml error [SAM-238]
eapearson May 6, 2022
9676285
tab got out of whak [SAM-238]
eapearson May 7, 2022
fe287b3
um...use image and registry rather than munge tags [SAM-238]
eapearson May 7, 2022
b9fbaa5
that didn't work, revert [SAM-238]
eapearson May 7, 2022
f4c693a
try js script for semver test [SAM-238]
eapearson May 8, 2022
7c096bd
use setFailed rather than error [SAM-238]
eapearson May 8, 2022
2be3042
replace shell script with js script, rename tag->tags, rename semver-…
eapearson May 8, 2022
dcda814
rename release tag workflow, separate build-only and build+push into …
eapearson May 9, 2022
1bc02a3
rename release tag workflow, separate build-only and build+push into …
eapearson May 9, 2022
d6f34fa
imporeve name [SAM-238]
eapearson May 9, 2022
577957d
remove conditional [SAM-238]
eapearson May 9, 2022
d0e6373
remove secrets, no longer used in this manner [SAM-238]
eapearson May 9, 2022
e8edc1d
add documentation for workflows (wip) [SAM-238]
eapearson May 9, 2022
a2344bd
improve naming [SAM-238]
eapearson May 9, 2022
9cf8f78
improve naming [SAM-238]
eapearson May 9, 2022
883cdd6
update gha workflows and docs [SAM-232]
eapearson May 9, 2022
35e6b3f
Merge remote-tracking branch 'origin/develop' into feature-SAM-232
eapearson May 9, 2022
e52fa7e
fix manual workflow [SAM-238]
eapearson May 9, 2022
3dc9736
doc update [SAM-238]
eapearson May 10, 2022
196a0ff
Merge remote-tracking branch 'origin/develop' into feature-SAM-238
eapearson May 10, 2022
757de30
update docs [SAM-238]
eapearson May 10, 2022
ea4fbf2
tweak and move testing overview diagram [SAM-232]
eapearson May 10, 2022
1a1f8c9
support both main and master as primary branch; docs also updated [SA…
eapearson May 11, 2022
0a56112
job name should be just "build-image" [SAM-238]
eapearson May 11, 2022
7a73ca0
job name should be just "build" [SAM-238]
eapearson May 11, 2022
7a932a0
beginning to convert plantuml to mermaid [SAM-238]
eapearson May 11, 2022
2458578
add another mermaid diagram (iterating to see on github) [SAM-238]
eapearson May 11, 2022
08abc7b
finish mermaid diagrams, now refine [SAM-238]
eapearson May 12, 2022
56af604
refining mermaid diagrams [SAM-238]
eapearson May 12, 2022
9d88c8a
refining mermaid diagrams [SAM-238]
eapearson May 12, 2022
de83d7d
Merge remote-tracking branch 'origin/feature-SAM-238' into feature-SA…
eapearson May 12, 2022
0e582a2
remove plantuml diagrams [SAM-232]
eapearson May 12, 2022
46437e0
delete plantuml diagrams [SAM-238]
eapearson May 12, 2022
e696f50
Merge remote-tracking branch 'origin/feature-SAM-238' into feature-SA…
eapearson May 12, 2022
8501b90
remove plantuml diagram [SAM-232]
eapearson May 12, 2022
2b7a752
align with develop [SAM-232]
eapearson May 12, 2022
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
31 changes: 0 additions & 31 deletions .github/workflows/build_prodrc_pr.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/build_test_pr.yaml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Manual
on:
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/reusable_test-python.yml
build-push:
needs: test
uses: ./.github/workflows/reusable_build-push.yml
with:
name: '${{ github.repository }}'
tags: '${{ github.ref_name }}'
43 changes: 0 additions & 43 deletions .github/workflows/non_sdk_test.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/prod_release.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/pull-request-develop-merged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: PR to develop closed and merged
on:
pull_request:
branches:
- develop
types:
- closed
jobs:
test:
if: ${{ github.event.pull_request.merged }}
uses: ./.github/workflows/reusable_test-python.yml
build-push:
if: ${{ github.event.pull_request.merged }}
needs: test
uses: ./.github/workflows/reusable_build-push.yml
with:
name: '${{ github.event.repository.name }}-develop'
tags: latest
secrets: inherit
16 changes: 16 additions & 0 deletions .github/workflows/pull-request-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: PR to develop opened
on:
pull_request:
branches:
- develop
types:
- opened
- reopened
- synchronize
jobs:
test:
uses: ./.github/workflows/reusable_test-python.yml
build:
needs: test
uses: ./.github/workflows/reusable_build.yml
21 changes: 21 additions & 0 deletions .github/workflows/pull-request-main-merged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: PR To main (or master) merged
on:
pull_request:
branches:
- main
- master
types:
- closed
jobs:
test:
if: ${{ github.event.pull_request.merged }}
uses: ./.github/workflows/reusable_test-python.yml
build-push:
if: ${{ github.event.pull_request.merged }}
needs: test
uses: ./.github/workflows/reusable_build-push.yml
with:
name: '${{ github.event.repository.name }}'
tags: latest-rc
secrets: inherit
19 changes: 19 additions & 0 deletions .github/workflows/pull-request-main-opened.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: PR to main (or master) opened
on:
pull_request:
branches:
- main
- master
types:
- opened
jobs:
test:
uses: ./.github/workflows/reusable_test-python.yml
build-push:
needs: test
uses: ./.github/workflows/reusable_build-push.yml
with:
name: '${{ github.event.repository.name }}'
tags: pr${{ github.event.number }}
secrets: inherit
23 changes: 23 additions & 0 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Release - Test, Build & Push Image
on:
release:
branches:
- main
- master
types: [ published ]
jobs:
validate-release-tag:
uses: ./.github/workflows/reusable_validate-release-tag.yml
with:
release_tag: '${{ github.event.release.tag_name }}'
test:
needs: validate-release-tag
uses: ./.github/workflows/reusable_test-python.yml
build-push:
needs: test
uses: ./.github/workflows/reusable_build-push.yml
with:
name: '${{ github.event.repository.name }}'
tags: '${{ github.event.release.tag_name }},latest'
secrets: inherit
61 changes: 61 additions & 0 deletions .github/workflows/reusable_build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: Build & Push Image to GHCR
on:
workflow_call:
inputs:
name:
description: The image name
required: true
type: string
tags:
description: The image tags
required: true
type: string
jobs:
build-push-image:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub Repo
uses: actions/checkout@v2

- name: Get current date
id: date
run: echo "::set-output name=date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
# note that the calling workflow must set `secrets: inherit`
username: '${{ secrets.GHCR_USERNAME }}'
password: '${{ secrets.GHCR_TOKEN }}'

- name: Create github action tags from image tags
id: tags
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const tags = '${{ inputs.tags }}'.split(',');
const username = '${{ github.event.repository.owner.login }}';
const repoName = '${{ inputs.name }}';
return tags.map((tag) => {
return `ghcr.io/${username}/${repoName}:${tag}`;
}).join(',');

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
pull: true
push: true
build-args: |
BUILD_DATE=${{ steps.date.outputs.date }}
VCS_REF=${{ github.sha }}
BRANCH='${{ github.ref }}'
TAG='${{ github.ref }}'
tags: '${{ steps.tags.outputs.result }}'
21 changes: 21 additions & 0 deletions .github/workflows/reusable_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Build Image without pushing
on:
workflow_call:
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub Repo
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Build without push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
pull: true
push: false
33 changes: 33 additions & 0 deletions .github/workflows/reusable_test-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Test (unit, integration)
on:
workflow_call:
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub Repo
uses: actions/checkout@v2

- uses: actions/setup-python@v3
with:
python-version: '3.7'

- name: Install pipenv
run: pip install -r requirements.txt

- name: Install test dependencies and config
run: make test-setup

# Run tests
- name: Run all tests
run: make test

# Display a coverage report for inspection in the workflow logs
- name: Coverage summary
run: make coverage-summary

- name: Send to Codecov
uses: codecov/codecov-action@v2
with:
files: ./cov_profile.lcov
20 changes: 20 additions & 0 deletions .github/workflows/reusable_validate-release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Ensure release tag is semantic version
on:
workflow_call:
inputs:
release_tag:
required: true
type: string
jobs:
ensure-semver:
runs-on: ubuntu-latest
steps:
- name: Validate that release tag as a proper semantic version
uses: actions/github-script@v6
with:
script: |
const releaseTag = '${{ inputs.release_tag }}';
if (!/^[0-9]+\.[0-9]+\.[0-9]+$/.test(releaseTag)) {
core.setFailed(`Release version must follow semantic version naming (e.g. 1.0.2) but is "${releaseTag}"`)
}
Loading