Skip to content

Tomo1912/github-actions-variables

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

CI Pipeline Demonstration

Welcome to my GitHub Actions demo repository! This project showcases a well-structured Continuous Integration (CI) pipeline using GitHub Actions. Below, I’ll walk you through what this workflow does, how it’s set up, and why I designed it this way—perfect for anyone exploring my GitHub profile to see my skills in action!

What This Repository Does

This repository contains a GitHub Actions workflow that automates the build and test process for a sample application. It’s a demonstration of how I approach CI pipelines to ensure code quality and reliability in real-world projects.

The Workflow: CI Pipeline Demonstration

The workflow is defined in .github/workflows/ci-demo.yml. Here’s what it does:

Triggers

  • Runs on:
    • Push events to main or develop branches
    • Pull requests targeting the main branch
  • Why: This ensures the pipeline runs automatically whenever code is updated or reviewed, catching issues early.

Environment

  • Runner: ubuntu-latest (a cost-effective, widely-used Linux environment)
  • Variables:
    • ACCESS_ID: A secure credential stored in GitHub Secrets
    • NODE_VERSION: Set to 18 for consistent Node.js builds
  • Why: Using secrets keeps sensitive data safe, and version pinning ensures reproducibility.

Steps

  1. Checkout Repository: Pulls the latest code using actions/checkout@v4.
  2. Setup Node.js: Configures Node.js (v18) using actions/setup-node@v3.
  3. Install Dependencies: Runs npm install with a fallback if no package.json is found.
  4. Display Access ID: Shows how to securely use environment variables with ACCESS_ID.
  5. Run Tests: Executes npm test (with a fallback message if no tests exist).
  6. Debug on Failure: If anything fails, it prints environment details for troubleshooting.
  • Why: These steps mimic a real CI process—code retrieval, environment setup, dependency management, testing, and debugging—while staying flexible for minimal setups.

Why This Matters

  • Automate Processes: Streamline development with CI.
  • Handle Security: Use GitHub Secrets for sensitive data.
  • Write Maintainable Code: Structure workflows with clear steps and error handling.
  • Think Practically: Include fallbacks and debugging to handle edge cases gracefully.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published