From ff7d41e677df6a3419f016179b7fc4c8bc5c5d0b Mon Sep 17 00:00:00 2001 From: Pawngrubber Date: Sat, 5 Nov 2022 10:59:39 -0400 Subject: [PATCH] merge tests (#28) * merge tests * Update README.md --- .github/workflows/pre-commit.yaml | 40 ------------------- .../workflows/{unittests.yaml => tests.yaml} | 7 +++- README.md | 23 ++++++++++- 3 files changed, 27 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/pre-commit.yaml rename .github/workflows/{unittests.yaml => tests.yaml} (87%) diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml deleted file mode 100644 index b838c9b..0000000 --- a/.github/workflows/pre-commit.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# pre-commit workflow -# -# Ensures the codebase passes the pre-commit stack. -# We run this on GHA to catch issues in commits from contributors who haven't -# set up pre-commit. - -name: pre-commit - -on: [push] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: . - target: dev - push: false - tags: ${{ secrets.REPO_NAME }}:gha - cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.REPO_NAME }}:cache - cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.REPO_NAME }}:cache,mode=max - outputs: type=docker - - - name: Run tests - run: docker run ${{ secrets.REPO_NAME }}:gha pre-commit run --all-files diff --git a/.github/workflows/unittests.yaml b/.github/workflows/tests.yaml similarity index 87% rename from .github/workflows/unittests.yaml rename to .github/workflows/tests.yaml index 0b0973e..8080c2b 100644 --- a/.github/workflows/unittests.yaml +++ b/.github/workflows/tests.yaml @@ -1,6 +1,6 @@ # Run python unit tests -name: unittests +name: tests on: push: @@ -37,5 +37,8 @@ jobs: cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.REPO_NAME }}:cache,mode=max outputs: type=docker - - name: Run tests + name: Unit tests run: docker run ${{ secrets.REPO_NAME }}:gha pytest + - + name: Style tests + run: docker run ${{ secrets.REPO_NAME }}:gha pre-commit run --all-files diff --git a/README.md b/README.md index 8de4416..fcf917c 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,28 @@ Code development is in a Docker image, use these steps to spin up the image exit ``` -## Updating the Environment +## Develop without Docker +1. Create a Python virtual environment + ``` + python3 -m venv + ``` +2. In this virtual environment, install necessary requirements files + ``` + python -m pip install -r requirements/dev.txt + python -m pip install -r requirements/prod.txt + ``` +3. Build and install + ``` + python -m build + python -m pip install -e . --no-deps + ``` +4. Test things + ``` + pre-commit run --all-files + pytest + ``` + +## Updating requirements folder 1. Use pip-compile to build a new pinned requirements file. ``` pip-compile requirements/prod.in --output-file=requirements/prod.txt