Added poetry depenency management and pre-commit #16
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: build | |
# Actions that take place on every change. | |
# ----------------- | |
# Control variables (GitHub Secrets) | |
# ----------------- | |
# | |
# At the GitHub 'organisation' or 'project' level you must have the following | |
# GitHub 'Repository Secrets' defined (i.e. via 'Settings -> Secrets'): - | |
# | |
# DOCKERHUB_USERNAME | |
# DOCKERHUB_TOKEN | |
# | |
# ----------- | |
# Environment (GitHub Environments) | |
# ----------- | |
# | |
# Environment (n/a) | |
on: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
- '**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip pip install --no-cache-dir poetry==${POETRY_VERSION} | |
poetry install --only dev | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# We build the image with the branch slug - a tag | |
# we pass to Jote for testing. This way the job-definitions | |
# can (and should) use a formal tag rather than 'latest', | |
# which is discouraged. | |
- name: Set lower-case REPOSITORY | |
run: | | |
echo "REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ env.REPOSITORY }}:${{ env.GITHUB_REF_SLUG }} | |
- name: Test | |
run: | | |
jote --image-tag ${{ env.GITHUB_REF_SLUG }} |