Skip to content

Commit

Permalink
Feature/rcs/initial develop (#1)
Browse files Browse the repository at this point in the history
* initial github actions files

* initial MIT license file

* renamed python package

* pyproject.toml metadata changes

* initial file schema

* initial file io

* implement do_snapshot. fix module name in old tests

* move create_file_hash to _hash module

* formatting. types-aiofiles dev dependency.

* initial pipeline docker image

* initial snapshot packaging

* update README

* fix copyright headers

* step back to python 3.8

* add py.typed

* implemented --git-ref option

* enhanced logging. correct git archive prefix directory

* refactor entry points for re-use

* add azure module
  • Loading branch information
blueskyjunkie authored Mar 1, 2022
1 parent f04e79c commit ea3f986
Show file tree
Hide file tree
Showing 29 changed files with 1,828 additions and 29 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
286 changes: 286 additions & 0 deletions .github/workflows/python_harness.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
name: Python build harness
on:
- push

env:
FLIT_ROOT_INSTALL: 1

PYPI_API_USER: __token__

VENV_DIR: /venv
VENV_BIN: /venv/bin

CALL_TARGET: /venv/bin/build-harness

IMAGE_PATH: "foodxtech/foodx-devops-tools-pipeline:${{ github.sha }}"


jobs:
build-docker-image:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: |
docker build \
-t ${{ env.IMAGE_PATH }} \
docker/pipeline
docker push ${{ env.IMAGE_PATH }}
formatting-check:
env:
TARGET: formatting --check
needs:
- build-docker-image

container:
image: "foodxtech/foodx-devops-tools-pipeline:${{ github.sha }}"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- run: |
${{ env.CALL_TARGET }} \
--log-enable-console \
--log-level debug \
${TARGET}
flake8-check:
env:
TARGET: static-analysis --analysis flake8
needs:
- build-docker-image

container:
image: "foodxtech/foodx-devops-tools-pipeline:${{ github.sha }}"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- run: |
echo "system Python version: "$(python3 --version)
echo "venv Python version: "$(${{ env.VENV_BIN }}/python3 --version)
${{ env.CALL_TARGET }} \
--log-enable-console \
--log-level debug \
${TARGET}
mypy-check:
env:
TARGET: static-analysis --analysis mypy
needs:
- build-docker-image

container:
image: "foodxtech/foodx-devops-tools-pipeline:${{ github.sha }}"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- run: |
${{ env.CALL_TARGET }} \
--log-enable-console \
--log-level debug \
${TARGET}
pydocstyle-check:
env:
TARGET: static-analysis --analysis pydocstyle
needs:
- build-docker-image

container:
image: "foodxtech/foodx-devops-tools-pipeline:${{ github.sha }}"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- run: |
${{ env.CALL_TARGET }} \
--log-enable-console \
--log-level debug \
${TARGET}
unit-tests:
env:
# have to avoid the new manual directory in CI pipeline
TARGET: unit-test --test-dir tests/ci
needs:
- build-docker-image

container:
image: "foodxtech/foodx-devops-tools-pipeline:${{ github.sha }}"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- run: |
${{ env.CALL_TARGET }} \
--log-enable-console \
--log-level debug \
${TARGET}
- uses: actions/upload-artifact@v2
if: failure()
with:
name: unittests-log
path: build_harness.log


unit-tests-coverage-report:
env:
# Don't forget to update the coverage threshold in .pre-commit-config.yaml
# have to avoid the new manual directory in CI pipeline
TARGET: unit-test --test-dir tests/ci --coverage-html
needs:
- build-docker-image

container:
image: "foodxtech/foodx-devops-tools-pipeline:${{ github.sha }}"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- run: ${{ env.CALL_TARGET }} ${TARGET}
- uses: actions/upload-artifact@v2
with:
name: coverage-report-artifacts-${{ matrix.python-version }}
path: dist/coverage_report


unit-tests-coverage-check:
env:
# Don't forget to update the coverage threshold in .pre-commit-config.yaml
# Setting CI threshold to 80% because GHA calculates a different coverage result than locally (92%);
# the problem seems to be with several files, including foodx_devops_tools/pull/puffignore.py (32% coverage in
# GHA, 100% coverage locally).
# have to avoid the new manual directory in CI pipeline
TARGET: unit-test --test-dir tests/ci --check 80
needs:
- build-docker-image

container:
image: "foodxtech/foodx-devops-tools-pipeline:${{ github.sha }}"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- run: ${{ env.CALL_TARGET }} ${TARGET}


build-packages:
needs:
- build-docker-image

container:
image: "foodxtech/foodx-devops-tools-pipeline:${{ github.sha }}"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
with:
# need all tags and branch info for release-flow utility.
# https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
fetch-depth: 0
- name: Build package
run: |
git config user.name github-actions
git config user.email github-actions@github.com
export THIS_VERSION=$(${{ env.VENV_BIN }}/release-flow --default-branch main)
echo ${THIS_VERSION}
${{ env.CALL_TARGET }} \
--log-enable-console \
--log-level debug \
package \
--release-id ${THIS_VERSION}
- uses: actions/upload-artifact@v2
if: failure()
with:
name: build-log
path: build_harness.log
- uses: actions/upload-artifact@v2
with:
name: distribution-package-artifacts
path: dist


install-check:
needs:
- build-packages

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: distribution-package-artifacts
path: dist
- run: |
python3 -m venv venv
ls dist
venv/bin/pip install dist/*.whl
publish-packages:
concurrency: publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
needs:
- build-packages
- build-docker-image
# don't "need" anything from install-check, but definitely don't want to publish if it fails
- install-check

container:
image: "foodxtech/foodx-devops-tools-pipeline:${{ github.sha }}"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v2
with:
name: distribution-package-artifacts
path: dist
- if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
name: Publish package
# something seems to be broken with `build-harness publish` so use twine directly instead, for now
run: |
git --version
${{ env.VENV_BIN }}/twine upload \
--disable-progress-bar \
--non-interactive \
--password ${PYPI_TOKEN} \
--username ${{ env.PYPI_API_USER }} \
--verbose \
dist/*
- if: ${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') }}
name: Publish package dryrun
run: |
git --version
echo ${PYPI_TOKEN} |
${CALL_TARGET} \
--log-enable-console \
--log-level debug \
publish \
--user ${{ env.PYPI_API_USER }} \
--password-file - \
--publish dryrun
- if: failure()
uses: actions/upload-artifact@v2
with:
name: publish-log
path: build_harness.log
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2022 Food-X Technologies

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
start
=============
foodx_backup_source
===================

A project that does something.
Snapshot git repositories and package up into a verifiable package.

.. contents::

Expand All @@ -11,9 +11,9 @@ A project that does something.
Installation
------------

The ``start`` package is available from PyPI. Installing into a virtual
The ``foodx_backup_source`` package is available from PyPI. Installing into a virtual
environment is recommended.

.. code-block::
python3 -m venv .venv; .venv/bin/pip install start
python3 -m venv .venv; .venv/bin/pip install foodx-backup-source
7 changes: 0 additions & 7 deletions backup_source/__init__.py

This file was deleted.

Loading

0 comments on commit ea3f986

Please sign in to comment.