Logo

dev-resources.site

for different kinds of informations.

GitHub Workflows: The First Line of Defense

Published at
11/10/2024
Categories
ci
opensource
containers
github
Author
majd_almnayer_2101
Categories
4 categories in total
ci
open
opensource
open
containers
open
github
open
Author
18 person written this
majd_almnayer_2101
open
GitHub Workflows: The First Line of Defense

For this week, our task was to automate everything: GitHub workflows for testing, linting, building, and error checking. Additionally, I set up a dev container that contributors can use in GitHub Codespaces for a fast, hassle-free setup. Finally, we were assigned to write tests for a classmate's project!

Setting up the GitHub Actions CI workflow was straightforward, as I had already done it several weeks ago in release 0.1. The workflow includes several jobs. The first job builds the project and ensures there are no build errors. The second job runs eslint to ensure the code meets our linting standards. The third job runs the tests and verifies they all pass! I also configured the GitHub workflows to run only on pull requests when they are opened, reopened, marked as ready for review, or when new commits are pushed.

Setting up workflows is not new for me, as I’ve done it previously in the Cloud Computing course and in my job. As for adding tests to a pclassmate's project](https://github.com/cleobnvntra/genereadme/pull/19), The main difference between my partner’s testing setup and mine was in code granularity. I made sure my code is modular, with small, testable pieces working together, making it easier to test. My partner’s code, however, was constructed in a way that combined many elements in the same file, which made testing slightly harder. Still, I found that it’s possible to test effectively without needing extensive project context—I covered edge cases, handled errors, and more.

CI is amazing and should always be one of the first setups in a project, especially for testing and linting. It ensures that the project follows standards, all tests pass, and builds don’t fail before a change is pushed to the main branch!

For the optional challenges, I had already set up linting in my workflow, so this was already done. However, setting up the devcontainer was certainly challenging. I encountered an issue with the Docker visual studio code extension that caused the devcontainer's build to fail on Windows but pass on WSL. After some troubleshooting, I found a workaround: cleaning any locally cached files (using apt-get clean) before the build process started.

Finally, the devcontainer was set up with all the recommended extensions, rules, and settings required to provide a premium, hassle-free contribution experience for OptimizeIt!

And the coolest part? Anyone can use GitHub Codespaces to run the devcontainer instantly, allowing for the smoothest possible development experience when contributing. No more Operating System issues, no more “but it worked on my machine,” and no more time wasted on annoying setup steps—everything is ready for any contributor!

Codespaces

Summary

Overall, I’d say this week was essential for open-source development. Ensuring your repository is guarded against issues that might otherwise cause problems is the first line of defense. It’s crucial for maintaining cleanliness and adhering to standard guidelines. Additionally, having a ready-to-use development environment for contributors not only smooths the development experience but also encourages more people to contribute with ease!

ci Article's
30 articles in total
Favicon
CI/CD Tools for Startups: Empowering IT Professionals to Scale Smarter
Favicon
CI/CD pipeline
Favicon
Top 10 Best CI/CD Tools For DevOps and Programmers
Favicon
Tester c'est tricher, compiler c'est douter
Favicon
Docker in DevOps Workflows: Enhancing CI/CD Pipelines
Favicon
Streamlining CI/CD Pipelines with Docker: A Complete Guide
Favicon
Docker with CI/CD: Automating the Software Lifecycle
Favicon
What is Continuous Integration? - A Comprehensive Guide
Favicon
Setting up Continuous Integration (CI) for dev-mate-cli
Favicon
Implementing a CI Pipeline for VShell with GitHub Actions
Favicon
Building CI/CD Pipelines with Jenkins and GitLab - Part1
Favicon
Top 5 Continuous Integration Tools: Optimizing Your Development Workflow
Favicon
How We Started Continuous OSS License Monitoring with License Finder
Favicon
Mastering CI/CD Pipelines: Automate Testing, Deployment, and Delivery Like a Pro
Favicon
Building a CI Tool for GitHub Runners
Favicon
GitLab CI: Needs vs Dependencies — A Practical Guide
Favicon
Adding CI Workflows with GitHub Actions
Favicon
Managing Software Project Complexity with Development Containers and Continuous Integration
Favicon
GitHub Workflows: The First Line of Defense
Favicon
Automate Vercel Preview Deployments with GitHub actions: A Step-by-Step Guide
Favicon
github action services: mysql, redis and elasticsearch
Favicon
The Must-Have GitHub Actions Dashboard - CICube
Favicon
Effective CI: A Comprehensive Guide
Favicon
Day007 - Random posts under TIL
Favicon
Django project - Part 3 Continuous Integration
Favicon
Fast multi-arch Docker build for Rust projects
Favicon
Eslint Code Insights from Bitbucket pipelines
Favicon
Unlock Your Developer Potential: How to Apply Atomic Habits to Your Software Development Journey
Favicon
How to Copy Files from Pod to Local with kubectl cp
Favicon
DevOps Unleashed Navigating the Future of Continuous Integration and Delivery

Featured ones: