-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (41 loc) · 1.73 KB
/
test.yaml
File metadata and controls
52 lines (41 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Run Tests and Lint
on: [push]
permissions:
actions: read
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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: Run tests in Docker and upload coverage to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
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 --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 --rm flask-inputfilter flake8