Github Actions

My first project

  • New Python project
  • Feature cards written out
  • Set up locally
  • Started writing code + tests
  • Needed to get reviews
  • Validate everything works as expected
    • "Set up TeamCity"

Pros of TeamCity

  • Runs tests automatically
  • Can run deployments
  • Receive feedback
  • Have multiple ways to run a build (automated vs manual)

Day One experience

  • Did not have permissions
  • Got permissions to view
  • Could not set up project

What is Github Actions

  • CI/CD offered by Github
    • Similar offerings from Gitlab, Bitbucket
  • Manifest(s) stay in codebase
    • Self contained

Why Github Actions?

  • Easy to start creating
    • As soon as your Github project is created
  • Works as setup documentation
    • Writing file to work for tests = local setup
  • Consists of Docker containers
    • Public or private
  • Not limited by environments (came up during RSAPI testing)
  • 10k minutes of build per month

Writing a manifest

  • YML based
  • Goes in .github/actions/FILENAME.yml

First part

Writing the name of the action + when its triggered

name: "Name of action when displayed in UI"
# Below is when action is triggered
      - master
      - v[0-9]+.[0-9]+.[0-9]+
  pull_request: {}
      - cron: "0 * * * *"

Writing the job(s)

A job consists of one or more steps

    runs-on: ubuntu-18.04
      - uses: actions/checkout@v1
      - uses: actions/setup-python@v1
    python-version: '3.6'
    architecture: 'x64'
  - name: Set up flask environment variables
    run: |
      echo "FLASK_ENV=development" > .env
  - name: Install dependencies
    run: |
      pip install pipenv
      pipenv sync --dev --bare
  - name: Run unit tests via coverage
    run: |
      find tests -name "*.py" | xargs pipenv run coverage run -m pytest