Skip to content

docs: update dev docs, specifically on running the Python linter (#2103) #391

docs: update dev docs, specifically on running the Python linter (#2103)

docs: update dev docs, specifically on running the Python linter (#2103) #391

Workflow file for this run

name: Docker Image Build
on:
push:
branches:
- master
paths:
- '**'
- '!webview/**'
- '!website/**'
- '!.github/workflows/deploy-website.yaml'
- '!.github/workflows/build-webview.yaml'
- '!.github/workflows/build-balena-disk-image.yaml'
- '!.github/workflows/python-lint.yaml'
- '!README.md'
- '!docs/**'
- '!bin/install.sh'
- '!bin/upgrade_containers.sh'
- '!tests/**'
jobs:
run-tests:
uses: ./.github/workflows/docker-test.yaml
buildx:
needs: run-tests
strategy:
matrix:
board: ['pi1', 'pi2', 'pi3', 'pi4', 'x86']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ matrix.board }}
restore-keys: |
${{ runner.os }}-${{ matrix.board }}
- name: Login to DockerHub
if: success() && github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Containers
run: |
export BUILD_TARGET=${{ matrix.board }}
export PUSH=1
export SKIP_TEST=1
./bin/build_containers.sh
balena:
if: ${{ github.ref == 'refs/heads/master' }}
needs: buildx
strategy:
matrix:
board: ['pi1', 'pi2', 'pi3', 'pi4']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Docker tag
run: |
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "BOARD=${{ matrix.board }}" >> $GITHUB_ENV
echo "SHM_SIZE=256mb" >> $GITHUB_ENV
- name: Prepare Balena file
run: |
# Generage a docker-compose file for Balena with the correct board
mkdir -p balena-deploy
# Copy in the Balena yaml file
cp balena.yml balena-deploy/
# Generate the docker-compose file
cat docker-compose.balena.yml.tmpl | \
envsubst > balena-deploy/docker-compose.yml
- uses: balena-io/deploy-to-balena-action@master
id: build
continue-on-error: true
with:
balena_token: ${{ secrets.BALENA_TOKEN }}
fleet: screenly_ose/anthias-${{ matrix.board }}
source: balena-deploy
- name: Sleep random sleep before retry
if: ${{ failure() && steps.build.conclusion == 'failure' }}
run: |
sleep $((120 + RANDOM % 900));
# Balena deploy often fails with 'ESOCKETTIMEDOUT'.
# This adds some retry logic.
- uses: balena-io/deploy-to-balena-action@master
id: build-retry
if: ${{ failure() && steps.build.conclusion == 'failure' }}
with:
balena_token: ${{ secrets.BALENA_TOKEN }}
fleet: screenly_ose/anthias-${{ matrix.board }}
source: balena-deploy