Feature/fc constance #82
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: CI | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
env: | |
DOCKER_CACHE_IMAGE: ${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images | |
DOCKER_DEFAULT_PLATFORM: linux/amd64 | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
outputs: | |
docker-image: ${{ steps.image_name.outputs.name }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/hash | |
id: release_hash | |
- name: Image name | |
id: image_name | |
run: | | |
image_name="$DOCKER_CACHE_IMAGE:hde-dev-${{ steps.release_hash.outputs.hash }}" | |
image_name_latest="$DOCKER_CACHE_IMAGE:hde-dev-latest" | |
echo "name=$image_name" >> $GITHUB_OUTPUT | |
echo "latest=$image_name_latest" >> $GITHUB_OUTPUT | |
- name: Check if image exists | |
uses: ./.github/actions/image_exists | |
id: image_exists | |
with: | |
image: ${{ steps.image_name.outputs.name }} | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Dev Image | |
if: ${{ !steps.image_exists.outputs.exists || contains(github.event.head_commit.message, 'rebuild') }} | |
id: docker_build | |
run: | | |
BUILD_DATE=$(date +"%Y-%m-%d %H:%M") | |
docker buildx create --use --platform x86_64 --name builder --driver docker-container | |
docker buildx build \ | |
--platform x86_64 \ | |
--builder builder \ | |
--build-arg BUILD_DATE="${BUILD_DATE}" \ | |
--progress=plain \ | |
--cache-to type=local,ref=${DOCKER_CACHE_IMAGE}:hde-dev-latest,dest=./.AAA \ | |
--cache-from ${DOCKER_CACHE_IMAGE}:hde-dev-latest \ | |
-t ${{ steps.image_name.outputs.name }} \ | |
-t ${{ steps.image_name.outputs.latest }} \ | |
-f ./docker/Dockerfile \ | |
--push \ | |
--target python_dev_deps . | |
lint: | |
runs-on: ubuntu-20.04 | |
needs: [build] | |
container: | |
image: unicef/hope-support-images:hde-dev-latest | |
credentials: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Black | |
run: black --check src/ | |
- name: Flake8 | |
run: flake8 src/ |