Skip to content

Instantly share code, notes, and snippets.

@bdmorin
Created June 15, 2024 17:49
Show Gist options
  • Save bdmorin/b26ecf65827cfb06cc319d93beb86818 to your computer and use it in GitHub Desktop.
Save bdmorin/b26ecf65827cfb06cc319d93beb86818 to your computer and use it in GitHub Desktop.
example GH wf
name: CI Pipeline
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Docker image
run: docker build --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache -t my-app:latest .
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run tests in Docker
run: docker run my-app:latest pytest tests/
lint:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run linting in Docker
run: docker run my-app:latest flake8 .
analysis:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run static analysis in Docker
run: docker run my-app:latest mypy .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment