10
10
RUST_BACKTRACE : 1
11
11
12
12
jobs :
13
- test :
14
- name : Test
13
+ build :
15
14
runs-on : ubuntu-latest
16
-
17
15
steps :
18
16
- uses : actions/checkout@master
19
17
- id : install
25
23
- name : restore build & cargo cache
26
24
uses : Swatinem/rust-cache@v1
27
25
26
+ - name : Build
27
+ run : cargo build --workspace --locked
28
+
29
+ - name : compile test binaries
30
+ run : |
31
+ cargo test --no-run
32
+ mkdir ./test-binaries/
33
+ find ./target \
34
+ -name "docs_rs*" \
35
+ -executable -type f \
36
+ -exec cp {} ./test-binaries/ \;
37
+
38
+ - name : set up test binaries to cache
39
+ uses : actions/cache@v2
40
+ with :
41
+ path : " ./test-binaries"
42
+ key : test-binaries-${{ github.sha }}
43
+
44
+ test :
45
+ runs-on : ubuntu-latest
46
+ needs : build
47
+ steps :
48
+ - uses : actions/checkout@master
49
+
50
+ - name : get test binaries from cache
51
+ uses : actions/cache@v2
52
+ with :
53
+ path : " ./test-binaries"
54
+ key : test-binaries-${{ github.sha }}
55
+
28
56
- name : Launch postgres and min.io
29
57
run : |
30
58
cp .env.sample .env
@@ -36,17 +64,50 @@ jobs:
36
64
# Make sure the database is actually working
37
65
psql "${CRATESFYI_DATABASE_URL}"
38
66
39
- - name : Build
40
- run : cargo build --workspace --locked
67
+ - name : run tests
68
+ shell : bash
69
+ run : |
70
+ for f in ./test-binaries/*; do
71
+ echo "running $f"
72
+ $f || exit 1
73
+ done
41
74
42
- - name : fast tests
43
- run : cargo test --workspace --locked
75
+ - name : Clean up the database
76
+ run : docker-compose down --volumes
77
+
78
+ build_tests :
79
+ runs-on : ubuntu-latest
80
+ needs : build
81
+
82
+ steps :
83
+ - uses : actions/checkout@master
84
+
85
+ - name : get test binaries from cache
86
+ uses : actions/cache@v2
87
+ with :
88
+ path : " ./test-binaries"
89
+ key : test-binaries-${{ github.sha }}
90
+
91
+ - name : Launch postgres and min.io
92
+ run : |
93
+ cp .env.sample .env
94
+ . .env
95
+ mkdir -p ${CRATESFYI_PREFIX}/public-html
96
+ docker-compose up -d db s3
97
+ # Give the database enough time to start up
98
+ sleep 5
99
+ # Make sure the database is actually working
100
+ psql "${CRATESFYI_DATABASE_URL}"
44
101
45
102
- name : slow tests
46
103
env :
47
104
DOCSRS_INCLUDE_DEFAULT_TARGETS : true
48
105
DOCSRS_DOCKER_IMAGE : ghcr.io/rust-lang/crates-build-env/linux-micro
49
- run : cargo test --workspace --locked -- --ignored
106
+ run : |
107
+ for f in ./test-binaries/*; do
108
+ echo "running $f"
109
+ $f --ignored || exit 1
110
+ done
50
111
51
112
- name : Clean up the database
52
113
run : docker-compose down --volumes
0 commit comments