Skip to content

Commit 0e1488f

Browse files
committed
15 | Added caching to builds
1 parent 2f4b22c commit 0e1488f

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

.github/workflows/test.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,25 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v4
1616

17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v2
19+
20+
- name: Cache Docker layers
21+
uses: actions/cache@v3
22+
with:
23+
path: /tmp/.buildx-cache
24+
key: ${{ runner.os }}-buildx-${{ github.sha }}
25+
restore-keys: |
26+
${{ runner.os }}-buildx-
27+
1728
- name: Build Docker image
18-
run: docker build . -t flask-inputfilter
29+
run: |
30+
docker buildx create --use
31+
docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache-new -t flask-inputfilter .
32+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
33+
34+
- name: Verify Docker image
35+
run: docker images flask-inputfilter
1936

2037
- name: Run tests in Docker and upload coverage to Coveralls
2138
env:
@@ -32,5 +49,5 @@ jobs:
3249
set -x # Print commands and their arguments as they are executed
3350
set -e # Exit immediately if a command exits with a non-zero status
3451
set -u # Exit immediately if a variable is not defined
35-
52+
3653
docker run flask-inputfilter flake8

.github/workflows/test_env.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,22 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v4
1616

17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v2
19+
20+
- name: Cache Docker layers
21+
uses: actions/cache@v3
22+
with:
23+
path: /tmp/.buildx-cache
24+
key: ${{ runner.os }}-buildx-${{ github.sha }}
25+
restore-keys: |
26+
${{ runner.os }}-buildx-
27+
1728
- name: Build Docker image
18-
run: docker build -f env_configs/Dockerfile . -t flask-inputfilter-env
29+
run: |
30+
docker buildx create --use
31+
docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache-new -f env_configs/Dockerfile . -t flask-inputfilter-env --load
32+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
1933
2034
- name: Run tests in Docker
2135
run: |

CHAGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
1212
- Added tracking of coverage in tests. [Check it out](https://coveralls.io/github/LeanderCS/flask-inputfilter)
1313
- New functionality for global filters and validators in InputFilters.
1414
- New functionality to define custom supported methods.
15+
- Added caching to build
1516

1617
### Validator
1718

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Usage
9393
-----
9494

9595
To use the `InputFilter` class, call the `validate` method on the class instance.
96-
After calling `validate`, the validated data will be available in `g.validatedData`.
96+
After calling `validate`, the validated data will be available in `g.validated_data`.
9797
If the data is invalid, a 400 response with an error message will be returned.
9898

9999
.. code-block:: python
@@ -106,7 +106,7 @@ If the data is invalid, a 400 response with an error message will be returned.
106106
@app.route('/update-zipcode', methods=['POST'])
107107
@UpdateZipcodeInputFilter.validate()
108108
def updateZipcode():
109-
data = g.validatedData
109+
data = g.validated_data
110110
111111
# Do something with validated data
112112
id = data.get('id')

0 commit comments

Comments
 (0)