-
Notifications
You must be signed in to change notification settings - Fork 47
[IO-1554][internal] CI/CD pipeline #660
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
Merged
Merged
Changes from all commits
Commits
Show all changes
201 commits
Select commit
Hold shift + click to select a range
7277616
Marked existing as old, added new flow basics
c3bccbf
Bare bones of initial scripts for testing
1c5fcd6
Written basic shell scripts for most steps
98671e0
WIP
21846b7
Correction to scripts
6668eac
Script that confirms release needs doing
bb8d0ec
Python versioning scripts WIP
f17b69f
Attempt at fix for changed files filter
5a4aede
Bash refactor
413f600
Update flows
5111954
Fixing Bash scripts and testing
a338e80
Github token change
407e086
Moved token to use github namespace
ba4591f
Output list of changed files
ce703c2
Testing passing around variables
bd5873a
Changing echo types
4cfcaad
Trying a different approach
891dec4
Check gh cli version
467bfd3
Fix for command wrapping
e389a70
Setting step output
10cd78a
Set env var
93fac8e
Different approach to passing vars
5a79f49
Format and lint should work now
cce8fff
Refactor of bash scripts
ec1ddc5
Re-enabled testing stage
7283cba
Get absolute paths in bash scripts
611814f
Ensure poetry is installed
b134b7c
Updated test script
d11a071
Extract tests into own file for use elsewhere
ca152b7
Make tests.yml reusable
33a51ae
Improve run
7a313fe
Work out the issue with the poetry binary
5b32995
Set powershell to run in pwsh
ea01e15
Convert flows to reusable flows
998429a
Refactored yaml to call jobs from reusable workflows directly
14df7cd
Fixing links
853bb15
Two simple replacements for 3rd party tools
5eba13d
Use bash as shell
190f515
Fix variable assignment
da805ee
Format and lint simplification
5b856d9
Debugging output
b1cc7fb
Confirm passing of variables
02d8c7c
Found the alternative context
73c6e48
Fixed grep problem
67c0cf0
Doing some debugging to reduce to python files only
c58a785
Creation of new variables
05c3353
trim strings
a9927e7
Trying an echo for output
969af9a
Assign variables properly
46969f1
File rename and new file filtering
eadfc92
Correct quote
f21bf06
Change to piping
07577fc
Debugging statements
6e8bae5
Conditional setting of output
9a719e9
Testing a hypothesis
c399ac0
Testing which step fails
a0c18ec
Localising error
e868227
pipefail issue
3821874
Suppress grep errors if they occur
ef53b5a
Filrering should be fault tolerant now
8c9cc38
Github doesn't handle multiline strings well
ae1e8e3
File filter in python
2dc25d6
Make executable
e969ec2
Output checking
60802f4
Expose whole strings to see what is mutating them
5d4e640
Added new opportunities for debugging
dba2337
Checking entire context
a81bd71
Testing an idea
ef61d18
Trying a test value
aa6c8d7
Debug step
5333270
Testing something
9859eda
Debugging step
beae74f
Dump needs context
b58f978
Testing with xargs
47720e3
Trying removing the output section
4f934b9
Testing variable name length
ed1e481
View job
e4e34ee
Confirm set succeeds
e55a606
Syntax error corrected
52b8b6f
Correct commit
9b5a62e
JSON error
3645e65
filename
49b9943
Trying one last thing, and then taking a whole different approach
beda9c5
Correcting the issue
0780e45
Getting somewhere
e1e36b7
Restructure of directories
2c15fa2
Restructure again because github doesn't support nested directories
1f660f2
Changes to make tests work
d09ab37
Test runner
538a397
Bash changes
1a14c39
Lint job change
bdab367
Tests
2bb285d
Missed a shell command
eaa887f
Extract install deps into reusable flow for later, fix tests job
c2075b3
Make black formatter pass
e2d08fa
Final fixes to the increase version system
3639d9c
Merge branch 'master' into io-1554
9fdef65
Add in pyproject validator
454ee0c
increase_version now supports cicd mode
e289e6b
Release tag
52414ec
Correct install deps reusable flow
92633fd
Change flows to pass variables correctly
20ed111
Return reusable to within tests
14e1479
Lock file was blocking tests
be60008
Test fixes
e584cee
Addition of a debug statement to sort context
9b46d6c
Jobs context
2a868c5
Restructure linting and formatting
9c1944f
Get black and flake passing
47febf3
Extracted formatting
41bc6d9
Permissions
b58d844
Linting and format jobs
eac86d2
Use ruff instead of black
e9af68c
Bash syntax
361b635
Fix black
948cfca
Changes to increment_version.py for CICD use
84b15ce
Outline of all basic flows
60efa3c
End of PR task
b60ca29
Testing merge action
8148747
Typecheck fix
39f8bb1
Job name change
3b9c49c
PR finish
191eeb7
poetry install options
79273f4
Deps change
3c9bda8
Switch to an action
d6ebc24
config entirely in ticks
681c6b1
Taking mypy out of the mix for now-ticketed for return
aedd8fe
Merge to master documentation job
82325ae
Setup to test doc gen in branch
f72d0d0
Simulate a squash merge
e93ae18
Test version of reverse commit step
5b9cafd
Added debug statement to find the correct context member
e6f2ea3
Correction to flow
dc9a57b
Quick change to get context info
3468a37
Reverse commit should now get the correct branch name
46e011d
Remove AWS from the doc run
5cc1ada
Starting debug of AWS step
b4936a8
Test AWS auth with no upload
aa3a648
Enable in place
c5fcd78
Enable merge to master action
e1250db
Add permissions to scheduled release action
033a1f3
Enable workflow dispatch for testing
84828c5
Change crontab for testing
c99d45b
Use existing linear label updater
6fc04cc
Scheduled release CRON
e458b8f
Release process
64415ca
Debug check master is passing
83ffe0f
Making tag check test against main branch as default.
dcb8f56
Fixed the JS
fb390f6
Fixed the JS
447ba7a
some debugging
9e5acee
Get contexts for debugging
604e71b
Add contexts
3de6ad7
Correct debug
3725623
Some debug
de50d73
Correct JS
d6fb12c
Finding workflow runs
bc5f22c
Change version back
34777c0
Fix JS
23fc1b1
Retrieve workflow runs
1130a3b
JS correction
8eb383d
Trying a new approach
3645276
Reverse destructuring
06be44e
Used different approach
7b107c9
Release path changes
ecc1abd
Add name to step
25d3e96
Removed clutter
f2a4237
Release refactor
efedae6
Added a codeowners file
478c71f
Update to CODEOWNERS file
64da97d
Release draft system
9476640
One step deploy script
437002a
Remove old code
67b4604
Slack message sender
a9bd8ae
Release use slack action
1f91c62
Release process document
41dfe02
Merge branch 'master' into io-1554
fc7d478
Remove the testmerge file
b7a57e4
Fully enable merge-to-master behaviour
f7d702a
Set success on master merge action
7babb93
Ticket moving script
078a57c
WIP
edf04f2
Merge branch 'master' into io-1554
a3525bd
Placeholder in ticket
f1de353
Merge in master
aade733
WIP, close to done
c158130
Merge branch 'master' into io-1554
owencjones f7f79e0
Unify master e2e dir with branch
98fb564
Implementation of slack messaging
610f6f3
Updating reverse commit
a1ce749
PR Comments
3e9ebc6
[IO-1754] Darwin-py v2 Dogfooding refactors (#670)
Nathanjp91 9ffa420
HOTFIX: Documentation fix
1840d4f
[IO-1824][internal] Documentation fix (#673)
owencjones 445981d
[IO-1561] Mypy cleanup (#652)
Nathanjp91 2daeae9
HOUSEKEEPING: Bump version to 0.8.43
8915a7f
[IO-1829] Tests refactor and timing changes (#676)
Nathanjp91 b6d7c64
[IO-1661][external] Error messages were not clear to customers (#674)
owencjones 7586e1e
HOUSEKEEPING: Bump version to v0.8.44
763b377
Fixed conflicts
c22f216
Merge master
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,35 @@ | ||
| # http://editorconfig.org | ||
| root = true | ||
|
|
||
| [*] | ||
| indent_style = space | ||
| indent_size = 4 | ||
| end_of_line = lf | ||
| charset = utf-8 | ||
| trim_trailing_whitespace = true | ||
| insert_final_newline = true | ||
|
|
||
| # Use 4 spaces for the Python files | ||
| [*.py] | ||
| indent_size = 4 | ||
| max_line_length = 160 | ||
|
|
||
| # The JSON files contain newlines inconsistently | ||
| [*.json] | ||
| insert_final_newline = ignore | ||
|
|
||
| # Makefiles always use tabs for indentation | ||
| [Makefile] | ||
| indent_style = tab | ||
|
|
||
| [*.md] | ||
| trim_trailing_whitespace = false | ||
|
|
||
| [*.yml] | ||
| indent_size = 2 | ||
| insert_final_newline = true | ||
|
|
||
| [*.yaml] | ||
| indent_size = 2 | ||
| insert_final_newline = true | ||
|
|
||
This file contains hidden or 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,4 @@ | ||
| @owencjones | ||
| @nathanjp91 | ||
| @simedw | ||
| @andreaazzini |
This file contains hidden or 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,52 @@ | ||
| name: merge_to_master | ||
| run-name: Merge to master | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| workflow_call: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
|
|
||
| run_tests: | ||
| name: Run tests | ||
| uses: ./.github/workflows/JOB_tests.yml | ||
|
|
||
| documentation: | ||
| name: Documentation | ||
| uses: ./.github/workflows/JOB_generate_documentation.yml | ||
|
|
||
| warn_on_fail: | ||
| needs: [run_tests, documentation] | ||
| if : ${{ failure() }} | ||
| name: Slack message us on fail | ||
| uses: ./.github/workflows/JOB_slack_message.yml | ||
| with: | ||
| at_team: true | ||
| icon: ':warning:' | ||
| message: 'Master is failing after a push event, please review at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}' | ||
|
|
||
| success: | ||
| needs: [run_tests, documentation] | ||
| if : ${{ success() }} | ||
| name: Success | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Set branch status to success | ||
| uses: actions/github-script@v3 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| github.repos.createCommitStatus({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| sha: context.sha, | ||
| state: 'success' | ||
| }) | ||
|
|
||
|
|
This file contains hidden or 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 @@ | ||
| name: pull_request | ||
| run-name: Pull Request | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
|
|
||
| # Prevent running concurrently | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
|
|
||
| get_changed_files: | ||
| name: Get changed files | ||
| uses: ./.github/workflows/JOB_get_changed_files.yml | ||
|
|
||
| format: | ||
| name: Check format of python | ||
| needs: get_changed_files | ||
| uses: ./.github/workflows/JOB_format.yml | ||
| with: | ||
| files: ${{ needs.get_changed_files.outputs.python_changed_files }} | ||
|
|
||
| lint: | ||
| name: Lint python | ||
| needs: get_changed_files | ||
| uses: ./.github/workflows/JOB_lint.yml | ||
| with: | ||
| files: ${{ needs.get_changed_files.outputs.python_changed_files }} | ||
|
|
||
| # TODO: See Issue IO-1666 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deliberately left in place, because it's ticketed next |
||
| # typecheck: | ||
| # name: Analyse types in python | ||
| # needs: get_changed_files | ||
| # uses: ./.github/workflows/JOB_typecheck.yml | ||
| # with: | ||
| # files: ${{ needs.get_changed_files.outputs.python_changed_files }} | ||
|
|
||
| run_tests: | ||
| name: Run tests | ||
| uses: ./.github/workflows/JOB_tests.yml | ||
|
|
||
This file contains hidden or 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,142 @@ | ||
| name: release | ||
| run-name: Release | ||
|
|
||
| on: | ||
| release: | ||
| types: [released] | ||
|
|
||
| workflow_call: | ||
| inputs: | ||
| release_id: | ||
| type: string | ||
| description: "The id of the release" | ||
| required: false | ||
|
|
||
| release_tag: | ||
| type: string | ||
| description: "The tag of the release" | ||
| required: false | ||
|
|
||
| is_draft: | ||
| type: boolean | ||
| description: "Is the release a draft" | ||
| required: false | ||
|
|
||
| env: | ||
| release_id: ${{ inputs.release_id || github.event.release.id }} | ||
| release_tag: ${{ inputs.release_tag || github.event.release.tag_name }} | ||
| is_draft: ${{ inputs.is_draft || github.event.release.draft }} | ||
| is_scheduled: ${{ github.event_name == 'schedule' }} | ||
|
|
||
| jobs: | ||
| validate_tag: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| ref: ${{ github.ref }} | ||
|
|
||
| - name: Fail early if tag schema is invalid | ||
| run: | | ||
| if [[ ! ${{ env.release_tag }} =~ ^refs/tags/(v[0-9]+\.[0-9]+\.[0-9]+)$ && ${{ env.release_tag }} =~ ^refs/tags/test-.*$ ]]; then | ||
| echo "Tag ${{ env.release_tag }} is not a valid semver tag" | ||
| exit 1 | ||
| fi | ||
|
|
||
| run_tests: | ||
| needs: validate_tag | ||
| uses: ./.github/workflows/JOB_tests.yml | ||
|
|
||
| build: | ||
| needs: validate_tag | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| ref: ${{ github.ref }} | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: "3.9" | ||
|
|
||
| - run: pip install pip --upgrade | ||
| - name: Setup Poetry | ||
| uses: abatilo/actions-poetry@v2 | ||
| with: | ||
| poetry-version: "1.3.1" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| poetry install --no-interaction --no-root --all-extras -vvv | ||
| poetry build | ||
|
|
||
| - name: Add build to release | ||
| uses: actions/upload-release-asset@v1 | ||
| with: | ||
| upload_url: ${{ github.event.release.upload_url }} | ||
| asset_path: ./dist/* | ||
| asset_name: ${{ env.release_id }}.tar.gz | ||
| asset_content_type: application/gzip | ||
|
|
||
| release: | ||
| needs: [run_tests, build] | ||
| if: startsWith(github.ref, 'refs/tags/v') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Publish on pypi.org | ||
| env: | ||
| POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
| POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
| run: | | ||
| # poetry publish | ||
| echo "Publishing to pypi.org - Emulated" | ||
|
|
||
| test_release: | ||
| needs: [run_tests, build] | ||
| if: startsWith(github.ref, 'refs/tags/test-') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Publish on test.pypi.org | ||
| env: | ||
| POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }} | ||
| POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} | ||
| run: | | ||
| poetry publish | ||
| echo "Publishing to test.pypi.org - Emulated" | ||
|
|
||
| # Linear tickets update | ||
|
|
||
| notify_release: | ||
| needs: [release, test_release] | ||
| if: always() && contains(needs.*.result, 'success') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Notify Slack | ||
| uses: ./.github/workflows/JOB_slack_message.yml | ||
| with: | ||
| icon: ":rocket:" | ||
| at_team: ${{ env.is_scheduled || !env.is_draft }} | ||
| message: | | ||
| :tada: *${{ env.release_tag }}* has been released! | ||
| :link: | ||
| - https://pypi.org/project/darwin-py | ||
| - ${{ github.event.release.html_url }} | ||
|
|
||
| notify_failed_release: | ||
| needs: [release, test_release] | ||
| if: always() && contains(needs.*.result, 'failure') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Notify Slack | ||
| uses: ./.github/workflows/JOB_slack_message.yml | ||
| with: | ||
| icon: ":warning:" | ||
| at_team: true | ||
| message: | | ||
| :warning: *${{ env.release_tag }}* has failed to be released! | ||
|
|
||
| *An error occurred performing release, and you may need to release manually.* | ||
|
|
||
| :link: | ||
| - ${{ github.event.release.html_url }} |
This file contains hidden or 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,70 @@ | ||
| name: scheduled-release | ||
| run-name: Scheduled Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: '30 10 * * 2' # every Tuesday at 10:30am | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| checkout: | ||
| name: Checkout | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| ref: master | ||
|
|
||
| check_master_can_release: | ||
| name: Check master can release | ||
| uses: ./.github/workflows/JOB_check-master-can-release.yml | ||
|
|
||
| run_tests: | ||
| name: Run tests | ||
| needs: check_master_can_release | ||
| uses: ./.github/workflows/JOB_tests.yml | ||
|
|
||
| increment_patch_version: | ||
| name: Increment patch version | ||
| needs: [checkout, check_master_can_release, run_tests] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Run increment script | ||
| shell: bash | ||
| run: python3 ${{ github.workspace }}/deploy/increase_version.py --cicd --patch | ||
|
|
||
| commit_changes_to_master: | ||
| name: Commit changes to master | ||
| needs: increment_patch_version | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Commit changes | ||
| shell: bash | ||
| run: | | ||
| version=`cat ${{ github.workspace }}/deploy/version.txt` | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
| git config --global user.name "github-actions[bot]" | ||
| git add . | ||
| git commit -m "HOUSEKEEPING: Increment version number to $version" | ||
| git tag master "v$version" | ||
| git status | ||
| # git push origin master --tags | ||
| echo "tag_name=v$version" >> $GITHUB_ENV | ||
|
|
||
| create_release: | ||
| name: Create release | ||
| needs: commit_changes_to_master | ||
| uses: ./.github/workflows/JOB_create_release.yml | ||
| with: | ||
| is_draft: true # will not publish, only create draft | ||
|
|
||
| release: | ||
| needs: create_release | ||
| uses: ./.github/workflows/EVENT_release.yml | ||
| with: | ||
| release_tag: ${{ github.env.tag_name }} | ||
| release_id: ${{ needs.create_release.outputs.release_id }} | ||
| is_draft: true # will not publish, only create draft |
This file contains hidden or 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,31 @@ | ||
| name: created_tag | ||
| run-name: Created Tag | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v[0-9]+.[0-9]+.[0-9]+' | ||
| - 'test-*' | ||
|
|
||
| concurrency: | ||
| group: created_tag | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| jobs: | ||
| create_release: | ||
| name: Create Release | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| name: Checkout | ||
| with: | ||
| ref: ${{ github.head_ref || github.ref }} | ||
|
|
||
| - name: Create release | ||
| uses: ./.github/workflows/JOB_create_release.yml | ||
| with: | ||
| is_draft: true | ||
|
|
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useful addition, because YAML is valid with 4 spaced text, but GHA doesn't like it.