-
Notifications
You must be signed in to change notification settings - Fork 38
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
Integrate with Github Actions #346
Merged
Merged
Conversation
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
yong-jie
force-pushed
the
gh-actions1
branch
from
September 6, 2020 17:18
83eea69
to
b7938dc
Compare
yong-jie
force-pushed
the
gh-actions1
branch
2 times, most recently
from
September 7, 2020 08:08
8a778db
to
6501fb4
Compare
yong-jie
force-pushed
the
gh-actions1
branch
from
September 7, 2020 08:37
25c1b25
to
b522871
Compare
LoneRifle
approved these changes
Sep 8, 2020
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.
lgtm otherwise; please:
- review comments
- figure out if we can immediately replace Travis
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
I think there is value in trying out github actions as our CI provider, with the main reason being support for concurrent builds without hoarding travis' concurrent builds limit.
Approach
Traditionally, our CI/CD pipeline consists of the following steps done in sequence:
Lint -> Test -> Build -> Push to ECR -> Deploy to EB
With Github Actions, we can do Lint, Test and Build+Push concurrently, before Deploying to EB after the previous 3 jobs have finished. This an optimistic approach because it builds and pushes the docker image to ECR without checking if Lint and Test have passed. Here is the primary tradeoff:
Pros:
Cons:
Rationale:
release
.Things to note
Syntax is lacking
The Github Actions syntax is still in its early phases of development and is missing some quality-of-life configuration options. This means I had to rely on some workarounds to get some things done.
An example is the dedicated job called
gatekeep
which helps determine whether the build & deploy jobs need to be executed. The workaround is necessary because I can't utilise theenv
context inside theif
statements for jobs, so something likeif: branch == env.STAGING || branch == env.PRODUCTION
is not possible.GoGovSG/.github/workflows/ci.yml
Lines 56 to 72 in b522871
Weak env var selection mechanism
Our builds use different versions of env vars depending on the branch that the Github Action is being run on. At present, I could not find a nice way to select variants of env vars depending on the branch, so I have resorted to using scripts to set our necessary EB env vars.
GoGovSG/.github/workflows/ci.yml
Lines 129 to 146 in b522871
Lack of inter-workflow dependency/message-passing
It's a universally good practice to split blocks of logic/code into different files. This is not yet supported in Github Actions and I am lumping both CI and CD into a single workflow file for the time being.
List of things done