Redirect curl output and make file executable in README.md #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test, Build, and Push Docker Image | |
on: | |
push: | |
branches: ["main"] | |
tags: | |
- "v*" | |
pull_request: | |
branches: ["main"] | |
release: | |
types: ["created"] | |
# GOAL: | |
# - run test job on pushes to main branch or v* tag | |
# - run test job on PRs against main branch | |
# - run test job on Release creation | |
# - run docker job on the above events when the triggered actor is the repo owner | |
# - run docker job on Release creation (ex: maybe a maintainer that isn't repo owner) | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
env: | |
test_dir: tests | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run Python unit tests | |
run: python -m unittest discover -v -s ${{ env.test_dir }} | |
docker: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
needs: | |
- "test" | |
if: >- | |
${{ | |
github.triggering_actor == github.repository_owner || | |
github.event_name == 'release' && github.event.action == 'created' | |
}} | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=ref,event=tag | |
type=ref,event=branch | |
type=ref,event=pr | |
# git short commit | |
type=sha | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} |