Phase 5: Setting up CI/CD with Github Actions
Approaching the end of the challenge now and this is the last task (apart from a short blog post). We have to implement Continuous Integration / Continuous Deployment (CI/CD) to our project.
This task was an important step for me as it showed how application releases and deployments can be safely done using automation. We are able to define when we can run tests and deploy them to a production system if they’re successful.
Github Actions
Github Actions allows you to define the necessary steps in your workflow, and runs them automatically based on trigger events. It’s very straightfoward to pickup and their documentation is quite good.
I’ve already written how I automate updating this blog using Github Actions, so I am quite familiar with the service. But as with all projects there were some important lessons learned when implementing CI/CD for this project.
Back end CI/CD
I created 2 jobs; one to test
the Python code and the other to deploy
the code when the test
job is successful.
Front end CI/CD
I used a single job here, where any update to the website code is synced to the S3 bucket and the CloudFront cache clearing command is run.
Lessons Learned
-
I need to research for a test my workflows locally. A lot of commits/time was spent troubleshooting why a certain workflow was not working. 😓
-
Make use of existing actions in the marketplace. This helps speed things up and ensure that your workflows are error free.
-
The workflow configuration file should be secure to not include any sensitive data. This includes things like access keys, private folders etc. Using Secrets within the configuration file allows some flexibility as well.
Conclusion
With the CI/CD workflows in place, all we have to do is push code from our machines and Github Actions takes it over from there to test and deploy your code to production.
And with that done, I guess we’re at the finish line for the Cloud Resume Challenge! 🎉🎉