cloudonaut Posted February 27 Share Posted February 27 GitHub Actions is my favorite CI/CD solution. Over the past year, I gradually switched all projects from CodePipeline to GitHub Actions. To this day, I enjoy the smooth user experience. However, GitHub-hosted runners quickly become a big item on GitHub’s monthly bill. That’s why I will share how to reduce costs for GitHub Actions with Octolense by Sandro Volpicella and HyperEnv for GitHub Actions Runner made by Michael and me in the following. /images/2024/02/how-to-reduce-costs-for-github-actions-title.jpg Do you prefer watching a video instead of reading? Here you go! JavaScript is disabled. Please visit YouTube.com to watch the video. Get insights into usage with OctolenseAnalyzing usage is vital when it comes to cutting costs. The pricing model of GitHub-hosted runners is simple. You pay for every build minute depending on the operating system and number of CPUs. Here is an excerpt of the GitHub Actions pricing page. Operating system vCPUs Per-minute rate (USD) Linux 2 $0.008 Linux 4 $0.016 Linux 8 $0.032 Linux 16 $0.064 Linux 32 $0.128 Linux 64 $0.256 Windows 2 $0.016 Windows 8 $0.064 Windows 16 $0.128 Windows 32 $0.256 Windows 64 $0.512 macOS 3 or 4 (M1 or Intel) $0.08 macOS 12 $0.12 macOS 6 (M1) $0.16 How do you find out which repository consumes the most build minutes? Unfortunately, GitHub only provides insights into the total amount of consumed build minutes. /images/2024/02/github-billing-actions.png The ability to generate a CSV report only helps a little to analyze spending. Date,Product,SKU,Quantity,Unit Type,Price Per Unit ($),Multiplier,Owner,Repository Slug,Username,Actions Workflow,Notes2024-02-22,Actions,Compute - UBUNTU,30,minute,0.008,1.0,stratocumulus,android,andreaswittig,.github/workflows/build.yml,2024-02-22,Actions,Compute - UBUNTU,90,minute,0.008,1.0,stratocumulus,ios,andreaswittig,.github/workflows/build.yml,2024-02-22,Actions,Compute - UBUNTU,60,minute,0.008,1.0,stratocumulus,spa,andreaswittig,.github/workflows/build.yml, Luckily, Sandro built Octolense, a simple-to-use and powerful tool to get insights into GitHub Actions usage. After connecting with GitHub, Octolense opens a dashboard showing the key metrics Billable Minutes, Paid Minutes, and Workflow Runs. Besides that, the dashboard lists the Top Cost Intensive Repositories. /images/2024/02/octolense-dashboard.png And there is more. Opening the detail view of a repository unveils insights into successful and failed workflow runs. /images/2024/02/octolense-repository.png Octolense provides valuable insights into the use of GitHub actions and allows you to identify the repositories where optimizing your CI/CD workflows will have the most significant impact. Get started with Octolense to analyze GitHub Actions usage! Reduce costs with self-hosted runners by HyperEnvBy default, a workflow job runs on a GitHub-hosted runner. Alternatively, you can also use self-hosted runners to execute workflow jobs. Michael and I built HyperEnv for GitHub Actions Runner to make deploying self-hosted runners on AWS as easy as possible. How does HyperEnv work? The following diagram illustrates the components automatically deployed to your AWS account within 10 minutes. GitHub sends a webhook event whenever a new job gets created. HyperEnv launches an EC2 instance with GitHub runner and build environments pre-installed. The GitHub runner executes the job. The EC2 instance terminates. /images/2024/02/hyperenv-architecture.jpg Switching from GitHub-hosted runners to HyperEnv reduces costs by at least 30%. The following table shows a cost estimation for 20,000 build minutes running on t3.large instances (2 vCPU, 8 GB memory, 25 GB volume) in us-east-1. Category Description Costs HyperEnv for GitHub Actions Runner $0.002 per vCPU and build minute $80.00 EC2 instance $0.0014 per build minute $27.73 EBS volume $0.0000019 per GB and build minute $0.93 CloudWatch and others $0.00001 per build minute $0.20 Total Costs HyperEnv for GitHub Actions Runner + AWS infrastructure $110.66 That’s cost savings of 31% compared to GitHub-hosted runners. Besides, many workflows do not require a machine with 2 vCPUs and 8 GB memory. By choosing a smaller instance type, you can reduce the costs for GitHub Actions executed on self-hosted runners even more. Deploy HyperEnv for GitHub Actions Runner and reduce costs by at least 30%! SummaryGain insights into your GitHub actions usage with Octolense and reduce costs for GitHub Actions by switching from GitHub-hosted Runners to HyperEnv. Do you have any other tips on how to reduce costs for GitHub Actions? Let me know!View the full article Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.