Skip to content

Build and push deployment images #1407

Build and push deployment images

Build and push deployment images #1407

Workflow file for this run

name: Build and push deployment images
on:
push:
branches:
- master
- develop
schedule:
- cron: '0 17 * * *'
workflow_dispatch:
env:
DOCKER_REPO: ${{ 'gmrukwa/divik' }}
jobs:
push_images:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Setup poetry
uses: abatilo/actions-poetry@v2.2.0
- name: Authenticate to Docker Hub
run: echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
- name: Build image
run: |
docker build \
--file docker/deploy.dockerfile \
--tag deployment \
.
- name: Push annotated images
run: |
VERSION=$(poetry version -s)
echo "VERSION=$VERSION"
docker tag deployment $DOCKER_REPO:$VERSION
docker push $DOCKER_REPO:$VERSION
- name: Push latest image for master branch
if: github.event_name == 'push' && endsWith(github.event.ref, 'heads/master')
run: |
docker tag deployment $DOCKER_REPO:latest
docker push $DOCKER_REPO:latest
push_sdist:
if: github.event_name != 'schedule'
name: Source distribution
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Setup poetry
uses: abatilo/actions-poetry@v2.2.0
- name: Build Python package
run: |
poetry install
poetry build -f sdist
- name: Publish Python package
uses: pypa/gh-action-pypi-publish@release/v1.6
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
push_wheels:
if: github.event_name != 'schedule'
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9' ]
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
fail-fast: false
name: Python ${{ matrix.python-version }} ${{ matrix.os }} wheel
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install LLVM
run: brew install llvm
if: matrix.os == 'macos-latest'
- name: Install OpenMP
run: brew install libomp
if: matrix.os == 'macos-latest'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgomp1
if: matrix.os == 'ubuntu-latest'
- name: Setup poetry
run: |
pip install poetry poetry-core
- name: Setup C++ env
run: |
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
echo "C_INCLUDE_PATH=/usr/local/opt/llvm/include:$C_INCLUDE_PATH" >> $GITHUB_ENV
echo "CPLUS_INCLUDE_PATH=/usr/local/opt/llvm/include:$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
echo "LIBRARY_PATH=/usr/local/opt/llvm/lib:/usr/local/opt/libomp/lib:$LIBRARY_PATH" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=/usr/local/opt/llvm/lib:/usr/local/opt/libomp/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
echo "CC=/usr/local/opt/llvm/bin/clang" >> $GITHUB_ENV
echo "CXX=/usr/local/opt/llvm/bin/clang++" >> $GITHUB_ENV
if: matrix.os == 'macos-latest'
- name: Build Python package
run: |
poetry install
poetry build -f wheel
- name: Publish Python package
run: poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}
push_aarch64_wheels:
if: github.event_name != 'schedule'
strategy:
matrix:
pyver: [ cp37-cp37m, cp38-cp38, cp39-cp39 ]
fail-fast: false
name: ${{ matrix.pyver }} ubuntu-latest aarch64 wheel
runs-on: ubuntu-latest
env:
py: /opt/python/${{ matrix.pyver }}/bin/python
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
- name: Build Python package
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
quay.io/pypa/manylinux2014_aarch64 \
bash -exc '${{ env.py }} -m venv .env && \
source .env/bin/activate && \
yum install -y epel-release && \
yum repolist && \
yum install -y hdf5-devel && \
pip install --upgrade pip && \
pip install poetry poetry-core && \
poetry run pip install oldest-supported-numpy && \
poetry install && \
poetry build -f wheel && \
deactivate'
- name: Publish Python package
run: |
pip install poetry
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}