Skip to content

Commit

Permalink
Add branch continuous integration (#333)
Browse files Browse the repository at this point in the history
* Add CI testing to branches

* Add checkout of repo

* Add shell

* Add python version

* Fix linter issues

* Upgrade black dependency to fix bug

Fixes bug that appears when trying to run pre-commit

   ImportError: cannot import name '_unicodefun' from 'click'
  • Loading branch information
jordanpadams authored Jun 16, 2022
1 parent b4c11b4 commit 0a00458
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 105 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/branch-cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# 🏃‍♀️ Continuous Integration and Delivery: Branch Testing
# ======================================================


---

name: 🔁 Branch integration testing


# Driving Event
# -------------
#
# What event starts this workflow: a push to any branch other than main

on:
push:
branches:
- '**'
- '!main'


# What to Do
# ----------
#
# Test the software with tox

jobs:
branch-testing:
name: 🪵 Branch Testing
runs-on: ubuntu-latest
if: github.actor != 'pdsen-ci'

steps:
-
name: 💳 Checkout
uses: actions/checkout@v2
with:
lfs: true
fetch-depth: 0
token: ${{secrets.ADMIN_GITHUB_TOKEN}}
-
name: Set up Python 3
uses: actions/setup-python@v1
with:
python-version: '3.9'
-
name: 💵 Python Cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
# The "key" used to indicate a set of cached files is the operating system runner
# plus "py" for Python-specific builds, plus a hash of the wheels, plus "pds" because
# we pds-prefix everything with "pds" in PDS! 😅
key: pds-${{runner.os}}-py-${{hashFiles('**/*.whl')}}
# To restore a set of files, we only need to match a prefix of the saved key.
restore-keys: pds-${{runner.os}}-py-
-
name: Update default configuration
run: |
import sys
import os
print("Running python version {}".format(sys.version))
conf_file = "pds_doi_service.ini"
print("Create config file for unit test {}".format(conf_file))
with open(conf_file, "w") as f:
f.write("[OSTI]\n")
f.write("user = {}\n".format("${{secrets.osti_login}}"))
f.write("password = {}\n".format("${{secrets.osti_password}}"))
shell: python
-
name: 🩺 Test Software
run:
pip install --editable '.[dev]'

tox
shell: bash
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
]

- repo: https://github.com/python/black
rev: 21.7b0
rev: 22.3.0
hooks:
- id: black
files: ^src/|tests/
Expand Down
Loading

0 comments on commit 0a00458

Please sign in to comment.