@@ -7,15 +7,55 @@ permissions:
7
7
contents : read
8
8
9
9
jobs :
10
- test :
10
+ build :
11
11
runs-on : ubuntu-latest
12
12
13
13
steps :
14
- - name : Checkout code
15
- uses : actions/checkout@v4
14
+ - uses : actions/checkout@v4
16
15
17
- - name : Build Docker image
18
- run : docker build . -t flask-inputfilter
16
+ - name : Cache Docker layers
17
+ uses : actions/cache@v4
18
+ with :
19
+ path : /tmp/.buildx-cache
20
+ key : ${{ runner.os }}-docker-flask-inputfilter-${{ hashFiles('Dockerfile') }}
21
+ restore-keys : |
22
+ ${{ runner.os }}-docker-flask-inputfilter-
23
+
24
+ - name : Set up Docker Buildx
25
+ uses : docker/setup-buildx-action@v2
26
+ with :
27
+ driver-opts : image=moby/buildkit:latest
28
+
29
+ - name : Build flask-inputfilter image with cache
30
+ run : |
31
+ docker buildx build \
32
+ --cache-from=type=local,src=/tmp/.buildx-cache \
33
+ --cache-to=type=local,dest=/tmp/.buildx-cache,mode=max \
34
+ -t flask-inputfilter . --load
35
+
36
+ # - name: Save flask-inputfilter image
37
+ # run: docker save -o flask-inputfilter.tar flask-inputfilter
38
+ #
39
+ # - name: Upload flask-inputfilter artifact
40
+ # uses: actions/upload-artifact@v4
41
+ # with:
42
+ # name: flask-inputfilter-image
43
+ # path: flask-inputfilter.tar
44
+ #
45
+ # test:
46
+ # runs-on: ubuntu-latest
47
+ #
48
+ # steps:
49
+ # - name: Checkout code
50
+ # uses: actions/checkout@v4
51
+ #
52
+ # - name: Download flask-inputfilter artifact
53
+ # uses: actions/download-artifact@v4
54
+ # with:
55
+ # name: flask-inputfilter-image
56
+ #
57
+ # - name: Load flask-inputfilter image
58
+ # run: docker load -i flask-inputfilter.tar
19
59
20
60
- name : Run tests in Docker and upload coverage to Coveralls
21
61
env :
@@ -25,12 +65,12 @@ jobs:
25
65
set -e # Exit immediately if a command exits with a non-zero status.
26
66
set -u # Exit immediately if a variable is not defined.
27
67
28
- docker run -e COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} flask-inputfilter sh -c "coverage run --source=flask_inputfilter -m pytest test/ && coveralls"
68
+ docker run --rm - e COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }} flask-inputfilter sh -c "coverage run --source=flask_inputfilter -m pytest test/ && coveralls"
29
69
30
70
- name : Run code style checks
31
71
run : |
32
72
set -x # Print commands and their arguments as they are executed
33
73
set -e # Exit immediately if a command exits with a non-zero status
34
74
set -u # Exit immediately if a variable is not defined
35
75
36
- docker run flask-inputfilter flake8
76
+ docker run --rm flask-inputfilter flake8
0 commit comments