본문으로 건너뛰기
cccskills
무료GitHub에 공개

github-actions-ci

GitHub Actions CI/CD setup for Python, R, and multi-platform testing. Use when creating, debugging, or optimizing CI/CD pipelines.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구SlackGitHubDocker
설치 방법 보기

포함된 파일(1)

  • SKILL.md11.3 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

GitHub Actions CI/CD Setup

Overview

GitHub Actions automates testing, linting, and deployment on every push and pull request. This guide covers common workflows for Python, R, and multi-platform testing.

Templates by Language

  • Python -- Minimal workflow + testing + linting + coverage
  • R -- Multi-platform matrix testing + CRAN check
  • Node.js -- Matrix testing + type checking + publishing
  • Go -- Build matrix + Docker builds + release artifacts
  • Multi-language -- Orchestrated jobs across repos

Find your language below and copy the workflow template directly into .github/workflows/.

Quick Start: Python Project

Minimal Python Testing Workflow

Create .github/workflows/test.yml:

name: Python Tests

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ['3.8', '3.9', '3.10', '3.11']

    steps:
      - uses: actions/checkout@v3

      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements-dev.txt

      - name: Lint with Ruff
        run: ruff check .

      - name: Type check with mypy
        run: mypy src/

      - name: Format check with Black
        run: black --check .

      - name: Run tests with pytest
        run: pytest --cov=src --cov-report=xml

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v3
        with:
          files: ./coverage.xml

Commit and push:

git add .github/workflows/test.yml
git commit -m "Add GitHub Actions CI/CD"
git push

R Package Testing Workflow

Comprehensive R Testing

# .github/workflows/r-check.yml
name: R Package Check

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  check:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        r-version: ['4.2', '4.3', '4.4']

    steps:
      - uses: actions/checkout@v3

      - name: Set up R
        uses: r-lib/actions/setup-r@v2
        with:
          r-version: ${{ matrix.r-version }}

      - name: Install system dependencies (Ubuntu)
        if: runner.os == 'Linux'
        run: |
          sudo apt-get update
          sudo apt-get install -y \
            libgdal-dev \
            libgeos-dev \
            libproj-dev \
            libspatialindex-dev

      - name: Install system dependencies (macOS)
        if: runner.os == 'macOS'
        run: |
          brew install gdal geos proj spatialindex

      - name: Install dependencies
        uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: any::devtools, any::roxygen2, any::testthat

      - name: Run roxygen
        run: Rscript -e "devtools::load_all(); roxygen2::roxygenise()"

      - name: Check
        uses: r-lib/actions/check-r-package@v2
        with:
          upload-snapshots: true

      - name: Test coverage
        run: |
          Rscript -e "install.packages('covr')"
          Rscript -e "covr::codecov()"

R Memory Testing (ASAN)

# .github/workflows/r-memory-test.yml
name: R Memory Tests

on: [push, pull_request]

jobs:
  asan-test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Set up R
        uses: r-lib/actions/setup-r@v2
        with:
          r-version: '4.3'

      - name: Install ASAN
        run: |
          sudo apt-get update
          sudo apt-get install -y clang valgrind

      - name: Install package with ASAN
        run: |
          export CC=clang
          export CFLAGS="-fsanitize=address -g"
          export LDFLAGS="-fsanitize=address"
          R CMD INSTALL .

      - name: Run tests under ASAN
        run: |
          export ASAN_OPTIONS="halt_on_error=1"
          Rscript -e "testthat::test_all()"

      - name: Valgrind testing
        run: |
          valgrind --leak-check=full \
            Rscript -e "library(mypackage); TRUE"

Docker-Based Testing

Multi-OS Testing with Docker

# .github/workflows/docker-test.yml
name: Docker Tests

on: [push, pull_request]

jobs:
  docker:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os: ['ubuntu:22.04', 'ubuntu:20.04', 'debian:11']

    steps:
      - uses: actions/checkout@v3

      - name: Build and test with ${{ matrix.os }}
        run: |
          docker run --rm -v $(pwd):/workspace -w /workspace \
            ${{ matrix.os }} \
            bash -c "
              apt-get update && apt-get install -y \
                r-base-dev build-essential gfortran &&
              R CMD INSTALL . &&
              Rscript -e 'testthat::test_all()'
            "

Conditional Steps

Only on Main Branch

- name: Deploy to production
  if: github.ref == 'refs/heads/main'
  run: ./deploy.sh

Only on Pull Requests

- name: Comment on PR
  if: github.event_name == 'pull_request'
  run: echo "Running PR checks"

Only on Tags

- name: Create release
  if: startsWith(github.ref, 'refs/tags/')
  run: ./release.sh

Skip Specific Commits

- uses: actions/checkout@v3
  if: "!contains(github.event.head_commit.message, '[skip ci]')"

Environment Variables and Secrets

Use Repository Secrets

  1. Go to Settings > Secrets and variables > Actions
  2. Click "New repository secret"
  3. Add API_KEY, DOCKER_TOKEN, etc.

In workflow:

- name: Use secret
  env:
    API_KEY: ${{ secrets.API_KEY }}
  run: ./script.sh

Set Workflow-Level Variables

env:
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      BUILD_TYPE: release
    steps:
      - run: echo "Building ${{ env.IMAGE_NAME }}"

Artifact Handling

Upload Test Results

- name: Run tests
  run: pytest --junit-xml=results.xml

- name: Upload test results
  if: always()
  uses: actions/upload-artifact@v3
  with:
    name: test-results-${{ matrix.os }}
    path: results.xml

Download and Use Artifacts

- name: Download artifacts
  uses: actions/download-artifact@v3
  with:
    name: test-results

- name: Process results
  run: cat results.xml

Matrix Testing

Test Multiple Combinations

strategy:
  matrix:
    os: [ubuntu-latest, macos-latest]
    python: ['3.8', '3.9', '3.10']
    include:
      - os: windows-latest
        python: '3.11'  # Only test Windows with Python 3.11
    exclude:
      - os: macos-latest
        python: '3.8'   # Skip old Python on macOS

Caching Dependencies

Cache Python Dependencies

- uses: actions/setup-python@v4
  with:
    python-version: '3.10'
    cache: 'pip'
    cache-dependency-path: requirements*.txt

Cache R Dependencies

- uses: r-lib/actions/setup-r-dependencies@v2
  with:
    cache-version: 1

Manual Cache

- name: Cache Maven packages
  uses: actions/cache@v3
  with:
    path: ~/.m2/repository
    key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
    restore-keys: |
      ${{ runner.os }}-maven-

Notifications and Reports

Create Badge

Add to README.md:

![Tests](https://github.com/username/repo/actions/workflows/test.yml/badge.svg)

Send Slack Notification

- name: Notify Slack
  if: failure()
  uses: slackapi/slack-github-action@v1
  with:
    webhook-url: ${{ secrets.SLACK_WEBHOOK }}
    payload: |
      {
        "text": "Build failed for ${{ github.repository }}",
        "blocks": [
          {
            "type": "section",
            "text": {
              "type": "mrkdwn",
              "text": "Failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
            }
          }
        ]
      }

Publish Test Report

- name: Publish test results
  uses: EnricoMi/publish-unit-test-result-action@v2
  if: always()
  with:
    files: 'test-results.xml'

Code Coverage

Generate and Upload Coverage

- name: Generate coverage
  run: |
    pip install coverage
    coverage run -m pytest
    coverage xml

- name: Upload to Codecov
  uses: codecov/codecov-action@v3
  with:
    file: ./coverage.xml
    flags: unittests
    fail_ci_if_error: false

Add Coverage Badge

In README:

[![codecov](https://codecov.io/gh/username/repo/branch/main/graph/badge.svg)](https://codecov.io/gh/username/repo)

Common Workflow Patterns

Full Test Suite

name: Complete CI

on: [push, pull_request]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.10'
      - run: pip install -r requirements-dev.txt
      - run: black --check .
      - run: ruff check .

  test:
    runs-on: ubuntu-latest
    needs: lint
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.10'
      - run: pip install -r requirements.txt
      - run: pytest

  security:
    runs-on: ubuntu-latest
    needs: lint
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.10'
      - run: pip install bandit safety
      - run: bandit -r src/
      - run: safety check

Troubleshooting

Debug Workflow

Add debug: true to step:

- run: echo "Debugging..."
  shell: bash
  env:
    ACTIONS_STEP_DEBUG: true

View detailed logs in job output.

Re-run Failed Jobs

In GitHub UI: Click "Re-run jobs" on failed workflow

Or via CLI:

gh run rerun <run_id>

Disable Workflow

Rename file or add to .github/workflows/workflow.yml:

# Add this at top to disable
on:
  workflow_dispatch:  # Manual only

Performance Optimization

Parallel Jobs with Needs

jobs:
  setup:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Setup complete"

  test1:
    runs-on: ubuntu-latest
    needs: setup
    steps:
      - run: npm test -- src/module1

  test2:
    runs-on: ubuntu-latest
    needs: setup
    steps:
      - run: npm test -- src/module2

Use Actions/runner

Pin versions for reproducibility:

- uses: actions/checkout@v3  # Pinned version
- uses: actions/setup-python@v4

Best Practices

  1. Keep workflows simple: One workflow per CI concern (test, lint, security)
  2. Use matrix for variations: Test multiple versions systematically
  3. Cache dependencies: Reduce setup time
  4. Fail fast: Use conditional steps to skip unnecessary work
  5. Document secrets: List required secrets in README
  6. Use workflow templates: Create reusable workflows in .github/workflows/
  7. Monitor build times: Keep under 30 minutes
  8. Test locally first: Use act to run workflows locally:
    brew install act
    act -j test
    

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Distills enduring architectural decisions and design rationale from wave orchestration plans or historical git changes into structured, tracked Architecture Decision Records (ADRs). Use pre-wave to resolve active architectural constraints or post-wave to record enduring decisions in docs/decisions/.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

AndrewBrown-USDA/aigb-skills-usda62026년 10월 16일 업데이트

Create and maintain AGENTS.md files for project onboarding and grounding. Use when initialized in a new project, when project structure changes significantly, or when creating subfolder-level AGENTS.md files for complex monorepos.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

AndrewBrown-USDA/aigb-skills-usda62026년 10월 16일 업데이트

Audit and update an arbitrary codebase to follow the Code.mil federal open-source licensing model (MIT with 17 U.S.C. Section 105 disclaimers and INTENT.md), including CRAN/R package DESCRIPTION setup.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

AndrewBrown-USDA/aigb-skills-usda62026년 10월 16일 업데이트

caveman

무료

Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy. Levels: lite, full, ultra and the wenyan variants. Use for /caveman, "caveman mode", "talk like caveman", "be brief" or "less tokens".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

AndrewBrown-USDA/aigb-skills-usda62026년 10월 16일 업데이트

Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes - Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

AndrewBrown-USDA/aigb-skills-usda62026년 10월 16일 업데이트

Reads Copilot conversation history and extracts executive-ready success stories. Use when the user asks to study prior Copilot sessions, summarize what was done before, mine evidence, or quantify time, cost, risk, and priority alignment from GitHub Copilot history in any workspace or repository.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

AndrewBrown-USDA/aigb-skills-usda62026년 10월 16일 업데이트

AndrewBrown-USDA의 스킬 모두 보기

이 스킬의 문제 신고