@@ -7,15 +7,55 @@ permissions:
77 contents : read
88
99jobs :
10- test :
10+ build :
1111 runs-on : ubuntu-latest
1212
1313 steps :
14- - name : Checkout code
15- uses : actions/checkout@v4
14+ - uses : actions/checkout@v4
1615
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
1959
2060 - name : Run tests in Docker and upload coverage to Coveralls
2161 env :
@@ -25,12 +65,12 @@ jobs:
2565 set -e # Exit immediately if a command exits with a non-zero status.
2666 set -u # Exit immediately if a variable is not defined.
2767
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"
2969
3070 - name : Run code style checks
3171 run : |
3272 set -x # Print commands and their arguments as they are executed
3373 set -e # Exit immediately if a command exits with a non-zero status
3474 set -u # Exit immediately if a variable is not defined
3575
36- docker run flask-inputfilter flake8
76+ docker run --rm flask-inputfilter flake8
0 commit comments