Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 47 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,55 @@ permissions:
contents: read

jobs:
test:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Build Docker image
run: docker build . -t flask-inputfilter
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-flask-inputfilter-${{ hashFiles('Dockerfile') }}
restore-keys: |
${{ runner.os }}-docker-flask-inputfilter-

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: image=moby/buildkit:latest

- name: Build flask-inputfilter image with cache
run: |
docker buildx build \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache,mode=max \
-t flask-inputfilter . --load

# - name: Save flask-inputfilter image
# run: docker save -o flask-inputfilter.tar flask-inputfilter
#
# - name: Upload flask-inputfilter artifact
# uses: actions/upload-artifact@v4
# with:
# name: flask-inputfilter-image
# path: flask-inputfilter.tar
#
# test:
# runs-on: ubuntu-latest
#
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Download flask-inputfilter artifact
# uses: actions/download-artifact@v4
# with:
# name: flask-inputfilter-image
#
# - name: Load flask-inputfilter image
# run: docker load -i flask-inputfilter.tar

- name: Run tests in Docker and upload coverage to Coveralls
env:
Expand All @@ -25,12 +65,12 @@ jobs:
set -e # Exit immediately if a command exits with a non-zero status.
set -u # Exit immediately if a variable is not defined.

docker run -e COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} flask-inputfilter sh -c "coverage run --source=flask_inputfilter -m pytest test/ && coveralls"
docker run --rm -e COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} flask-inputfilter sh -c "coverage run --source=flask_inputfilter -m pytest test/ && coveralls"

- name: Run code style checks
run: |
set -x # Print commands and their arguments as they are executed
set -e # Exit immediately if a command exits with a non-zero status
set -u # Exit immediately if a variable is not defined

docker run flask-inputfilter flake8
docker run --rm flask-inputfilter flake8
25 changes: 22 additions & 3 deletions .github/workflows/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,32 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Build Docker image
run: docker build -f env_configs/Dockerfile . -t flask-inputfilter-env
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-flask-inputfilter-env-${{ hashFiles('Dockerfile') }}
restore-keys: |
${{ runner.os }}-docker-flask-inputfilter-env-

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: image=moby/buildkit:latest

- name: Build flask-inputfilter-env image with cache
run: |
docker buildx build \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache,mode=max \
-t flask-inputfilter-env \
-f env_configs/Dockerfile \
. --load

- name: Run tests in Docker
run: |
set -x # Print commands and their arguments as they are executed.
set -e # Exit immediately if a command exits with a non-zero status.
set -u # Exit immediately if a variable is not defined.

docker run flask-inputfilter-env tox
docker run --rm flask-inputfilter-env tox
Loading