{"id":2108,"date":"2026-07-22T18:09:34","date_gmt":"2026-07-22T11:09:34","guid":{"rendered":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-set-up-continuous-integration-with-github-actions-a-step-by-step-guide\/"},"modified":"2026-07-22T18:09:34","modified_gmt":"2026-07-22T11:09:34","slug":"how-to-set-up-continuous-integration-with-github-actions-a-step-by-step-guide","status":"publish","type":"post","link":"https:\/\/sumberlaba.com\/index.php\/2026\/07\/22\/how-to-set-up-continuous-integration-with-github-actions-a-step-by-step-guide\/","title":{"rendered":"How to Set Up Continuous Integration with GitHub Actions: A Step-by-Step Guide"},"content":{"rendered":"<h1>How to Set Up Continuous Integration with GitHub Actions: A Step-by-Step Guide<\/h1>\n<p>Continuous Integration (CI) automatically builds and tests your code every time you push changes, catching bugs early. GitHub Actions makes this simple by letting you define workflows directly in your repository. This tutorial walks you through setting up a basic CI pipeline for a Node.js project \u2013 the same pattern works for any language.<\/p>\n<p>To follow along, you need a GitHub repository with a package.json file (or equivalent) that includes a test script. No external CI server required \u2013 everything runs inside GitHub&#8217;s infrastructure. Let&#8217;s get started.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/via.placeholder.com\/800x600\/4a90d9\/ffffff?text=how%20to%20set%20up%20continuous%20integration%20with%20GitHub%20Actions\" alt=\"Article illustration\" style=\"display:block;margin:20px auto;max-width:100%;height:auto;border-radius:8px;\" \/><\/p>\n<h2>Step 1: Create a Workflow File<\/h2>\n<p>Inside your repository, create the folder <code>.github\/workflows<\/code>. Then add a YAML file, for example <code>ci.yml<\/code>. This file defines your CI pipeline.<\/p>\n<ul>\n<li>In your GitHub repo, click the &#8220;Actions&#8221; tab and select &#8220;New workflow&#8221;. Or manually create the file locally and push it.<\/li>\n<li>Name the file something descriptive like <code>node-ci.yml<\/code>.<\/li>\n<li>Use a simple template to start; you can always edit it later.<\/li>\n<\/ul>\n<h2>Step 2: Define the Trigger<\/h2>\n<p>Specify when the workflow should run. The most common trigger is on every push or pull request to the main branch.<\/p>\n<ul>\n<li>Start with <code>name: Node.js CI<\/code>.<\/li>\n<li>Add <code>on: [push, pull_request]<\/code> to run on any branch, or <code>on: push: branches: [main]<\/code> to limit to the main branch only.<\/li>\n<li>You can also filter by file paths to avoid running CI on documentation changes.<\/li>\n<\/ul>\n<h2>Step 3: Set Up the Job<\/h2>\n<p>Jobs run on a virtual machine. Use <code>runs-on: ubuntu-latest<\/code>. Each job contains a series of steps.<\/p>\n<ul>\n<li>Step 1: <code>actions\/checkout@v3<\/code> \u2013 checks out your repository code.<\/li>\n<li>Step 2: <code>actions\/setup-node@v3<\/code> with <code>node-version: '18'<\/code> \u2013 installs the Node.js version you need.<\/li>\n<li>Step 3: <code>run: npm ci<\/code> \u2013 installs dependencies (faster and more reliable than <code>npm install<\/code>).<\/li>\n<li>Step 4: <code>run: npm test<\/code> \u2013 runs your test suite.<\/li>\n<\/ul>\n<h2>Step 4: Commit and Verify<\/h2>\n<p>Push the workflow file to your repository. GitHub will automatically detect it and start the CI pipeline. Go to the &#8220;Actions&#8221; tab to see the run.<\/p>\n<ul>\n<li>Green checkmark means all steps passed. Red means a failure \u2013 click into the run to view logs and debug.<\/li>\n<li>If tests fail, check your YAML syntax or ensure your test script is correct in <code>package.json<\/code>.<\/li>\n<li>Once verified, you can add extra steps like linting, code coverage, or deployment to staging.<\/li>\n<\/ul>\n<p>That\u2019s it! You now have a fully automated CI pipeline with GitHub Actions. Every commit to your repository will trigger a build and test run, keeping your codebase healthy. Start simple and expand as your project grows.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Set Up Continuous Integration with GitHub Actions: A Step-by-Step Guide Continuous Integration (CI) automatically builds and tests your code every time you push changes, catching bugs early. GitHub Actions makes this simple by letting you define workflows directly in your repository. This tutorial walks you through setting up a basic CI pipeline for &hellip; <\/p>\n","protected":false},"author":2716,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-2108","post","type-post","status-publish","format-standard","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/2108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/users\/2716"}],"replies":[{"embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/comments?post=2108"}],"version-history":[{"count":0,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/posts\/2108\/revisions"}],"wp:attachment":[{"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/media?parent=2108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/categories?post=2108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumberlaba.com\/index.php\/wp-json\/wp\/v2\/tags?post=2108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}