Skip to content

Bump actions/checkout from 3 to 4 #497

Bump actions/checkout from 3 to 4

Bump actions/checkout from 3 to 4 #497

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
pull_request_review:
types: [submitted]
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: psf/black@stable
build:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.9']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# The GitHub editor is 127 chars wide
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
- name: Install package
run: pip install -e .
- name: Test with pytest
run: pytest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
flags: unittests
docker:
runs-on: ubuntu-22.04
strategy:
matrix:
arch: [linux/amd64, linux/arm64]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-build-x-${{ matrix.arch }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-x-${{ matrix.arch }}-
- name: Build
uses: docker/[email protected]
with:
platforms: ${{ matrix.arch }}
push: false
load: true
tags: oittaa/gcp-storage-emulator:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
-
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Docker container up
run: docker run -d --rm -p 8080:8080 --name gcp-storage-emulator oittaa/gcp-storage-emulator
- name: Wait 10 seconds
run: sleep 10
- name: Check running containers
run: docker ps -a
- name: Check the container reachability
run: curl -s --retry 10 --retry-connrefused http://localhost:8080/
- name: Check Docker logs
run: docker logs gcp-storage-emulator
- name: Docker container down
run: docker stop gcp-storage-emulator
publish:
if: ${{ github.event_name == 'push' }}
needs: [lint, build, docker]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-build-x-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-x-
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/[email protected]
with:
platforms: linux/amd64,linux/arm64
push: true
tags: oittaa/gcp-storage-emulator:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}