change requirement for numpy to 2.0.0 #442
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 CraftBeerPi4' | |
on: | |
push: | |
branches: | |
- main | |
- master | |
- development | |
pull_request: | |
env: | |
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/craftbeerpi4 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
name: Builds the source distribution package | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- name: Setup python environment | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install packages | |
run: sudo apt install -y libsystemd-dev | |
- name: Clean | |
run: python setup.py clean --all | |
- name: Install Requirements | |
run: pip3 install -r requirements.txt | |
- name: Run tests | |
run: coverage run --source cbpi -m pytest tests | |
- name: Build source distribution package for CraftBeerPi | |
run: python setup.py sdist | |
- name: Upload CraftBeerPi package to be used in next step | |
uses: actions/[email protected] | |
with: | |
name: craftbeerpi4 | |
path: dist/cbpi4-*.tar.gz | |
if-no-files-found: error | |
docker: | |
runs-on: ubuntu-latest | |
name: Builds the docker image(s) | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Prepare docker image and tag names | |
id: prep | |
run: | | |
IMAGE_NAME_LOWERCASE=${IMAGE_NAME,,} | |
echo "Using image name $IMAGE_NAME_LOWERCASE" | |
PUBLISH_IMAGE=false | |
TAGS="$IMAGE_NAME_LOWERCASE:dev" | |
# Define the image that will be used as a cached image | |
# to speed up the build process | |
BUILD_CACHE_IMAGE_NAME=${TAGS} | |
if [[ $GITHUB_REF_NAME == master ]] || [[ $GITHUB_REF_NAME == main ]]; then | |
# when building master/main use :latest tag and the version number | |
# from the cbpi/__init__.py file | |
VERSION=$(grep -o -E "(([0-9]{1,2}[.]?){2,3}[0-9]+)" cbpi/__init__.py) | |
LATEST_IMAGE=$IMAGE_NAME_LOWERCASE:latest | |
BUILD_CACHE_IMAGE_NAME=${LATEST_IMAGE} | |
TAGS="${LATEST_IMAGE},$IMAGE_NAME_LOWERCASE:v${VERSION}" | |
PUBLISH_IMAGE="true" | |
elif [[ $GITHUB_REF_NAME == development ]]; then | |
PUBLISH_IMAGE="true" | |
fi | |
echo "tags: $TAGS" | |
echo "publish_image: $PUBLISH_IMAGE" | |
echo "cache_name: $BUILD_CACHE_IMAGE_NAME" | |
echo "tags=$TAGS" >> $GITHUB_OUTPUT | |
echo "publish_image=$PUBLISH_IMAGE" >> $GITHUB_OUTPUT | |
echo "cache_name=$BUILD_CACHE_IMAGE_NAME" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@master | |
with: | |
platforms: all | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@v4 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
target: deploy | |
push: ${{ steps.prep.outputs.publish_image == 'true' }} | |
tags: ${{ steps.prep.outputs.tags }} | |
cache-from: type=registry,ref=${{ steps.prep.outputs.cache_name }} | |
cache-to: type=inline | |
labels: | | |
org.opencontainers.image.title=${{ github.event.repository.name }} | |
org.opencontainers.image.description=${{ github.event.repository.description }} | |
org.opencontainers.image.url=${{ github.event.repository.html_url }} | |
org.opencontainers.image.revision=${{ github.sha }} |