Skip to content

Instantly share code, notes, and snippets.

View rockedscience's full-sized avatar
:octocat:
Coding

RockedScience.net rockedscience

:octocat:
Coding
View GitHub Profile
@rockedscience
rockedscience / gadockercicd_03_full_pipeline.yml
Last active January 4, 2021 20:57
A complete GitHub Action to lint code, run tests, build and push a Docker image to the Docker Hub. Article: https://medium.com/rockedscience/docker-ci-cd-pipeline-with-github-actions-6d4cd1731030
# Article: https://medium.com/rockedscience/docker-ci-cd-pipeline-with-github-actions-6d4cd1731030
name: Lint the code, run tests, build and push Docker image
on:
push:
branches:
- '*'
pull_request:
branches:
- '**'
@rockedscience
rockedscience / gadockercicd_02_build_push_docker.yml
Last active January 4, 2021 20:58
A simple GitHub Action to build Docker images and push them to the Docker Hub when a new release is published. Article: https://medium.com/rockedscience/docker-ci-cd-pipeline-with-github-actions-6d4cd1731030
# Article: https://medium.com/rockedscience/docker-ci-cd-pipeline-with-github-actions-6d4cd1731030
name: Build and push Docker image upon release
on:
# Build and push Docker images *only* for releases.
release:
types: [published] # , created, edited
jobs:
push_to_registry:
@rockedscience
rockedscience / gadockercicd_01_run_tests_set_triggers.yml
Last active January 2, 2021 16:40
Specify events and filters for a Google Action to be triggered.
# Extends: https://gist.github.com/rockedscience/1dc1a7b9d9ab7e8bce904d394d1ae1c7
# ...
on:
# Event: commits are pushed to the repository
push:
branches:
- '*' # Select all branches *WITHOUT* a "/" in the name
@rockedscience
rockedscience / gadockercicd_01_run_tests.yml
Last active January 4, 2021 20:58
A simple Google Action to run lint Python code and run tests when commits are pushed to the remote. Article: https://medium.com/rockedscience/docker-ci-cd-pipeline-with-github-actions-6d4cd1731030
# Article: https://medium.com/rockedscience/docker-ci-cd-pipeline-with-github-actions-6d4cd1731030
name: Run unit tests with Python
# Sets the events which will trigger the Action
# `push` = any "push" action to the GitHub "remote",
# changes to any branch will be considered
on: [push]
jobs:
# `build` is a user-defined name for this job
@rockedscience
rockedscience / server.py
Created December 4, 2015 16:42
Simple HTTP server in Python to test incoming connections
import socket
import logging
import datetime
from BaseHTTPServer import BaseHTTPRequestHandler
from StringIO import StringIO
class HTTPRequest(BaseHTTPRequestHandler):
def __init__(self, request_text):
self.rfile = StringIO(request_text)