Skip to content

Commit

Permalink
Trying the GUI commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nmagee committed Aug 7, 2024
1 parent fba5afc commit f92b627
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/git-advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Useful commands for tagging in `git`:

Tags can be signed by the developer creating them. They can contain annotations (longer comments), and the author name and date are captured in the `git` database whenever a tag is created or modified.

Tags can also be incredibly useful when coupled with automations in [**GitHub Actions**](/docs/github-actions/). For instance, a test suite or build can be invoked when specific tags occur, instead of with every push.
Tags can also be incredibly useful when coupled with automations in [**GitHub Actions**](/docs/github-actions/). For instance, a test suite or build can be invoked when specific tags occur, instead of with every push or PR.

{: .success :}
[**Learn more about tagging**](https://git-scm.com/book/en/v2/Git-Basics-Tagging)
Expand Down
47 changes: 45 additions & 2 deletions docs/github-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,52 @@ jobs:
run: docker run -e BRANCH=$BRANCH_NAME -e DISTRIBUTION_ID=${{ secrets.DISTRIBUTION_ID }} -e BUCKET_NAME_STAGING=${{ secrets.BUCKET_NAME_STAGING }} -e STAGING_DISTRIBUTION_ID=${{ secrets.STAGING_DISTRIBUTION_ID }} -e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} -e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} -e MAX_AGE=${{ secrets.MAX_AGE}} ghcr.io/uvarc/hugo-build:v2 /root/build-site.sh uvarc/rc-website hugo-0.80.0-ext
```

## Example 2 - Build and push a container with all new tagged releases
## Example 2 - Perform tests against your code

This GitHub Action detects any tagged push (matching the format `*.*`, i.e. 1.4, 13.9, etc.) and performs a multi-architecture container build and push for both amd64 and arm64 platforms.
This GitHub Action tests your code for basic errors using `pytest` against multiple versions of Python. This requires you write the appropriate test file(s) to demonstrate success/failure in your application.

In industry, it is **extremely common** to run production code through dozens or hundreds of various tests before it is released. While Data Science does not generally impact production systems, it is to no one's advantage to release broken, buggy code in this setting.

> .github/workflows/python-version-testing.yaml
```
name: Python Testing
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# Test against multiple versions of Python
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Install packages you need for the testing
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Finally run a test unit using pytest / ruff / tox, etc.
- name: Test with pytest
run: |
pip install pytest pytest-cov
pytest tests.py --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
```

{: .success }
Learn more about [**Building and Testing in Python**](https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python) using GitHub Actions.

## Example 3 - Build and push a container with all new tagged releases

This GitHub Action detects any tagged push (matching the format `*.*`, i.e. 1.4, 13.9, 989.14, etc.) and performs a multi-architecture container build and push for both amd64 and arm64 platforms.

{: .note }
Note at the end the Action performs a "Remote Dispatch" where it updates a separate repository with a new value, which in turn triggers a deployment from that repository.
Expand Down

0 comments on commit f92b627

Please sign in to comment.