|
3 | 3 | build: |
4 | 4 | docker: |
5 | 5 | - image: martinthomson/i-d-template:latest |
6 | | - resource_class: small |
7 | 6 | working_directory: ~/draft |
8 | 7 |
|
9 | 8 | steps: |
10 | | - - run: |
11 | | - name: "Print Configuration" |
12 | | - command: | |
13 | | - xml2rfc --version |
14 | | - gem list -q kramdown-rfc |
15 | | - echo -n 'mmark '; mmark --version |
16 | | -
|
17 | | - - restore_cache: |
18 | | - name: "Restoring cache - Git" |
19 | | - keys: |
20 | | - - v2-cache-git-{{ .Branch }}-{{ .Revision }} |
21 | | - - v2-cache-git-{{ .Branch }} |
22 | | - - v2-cache-git- |
23 | | - |
24 | | - - restore_cache: |
25 | | - name: "Restoring cache - References" |
26 | | - keys: |
27 | | - - v1-cache-references-{{ epoch }} |
28 | | - - v1-cache-references- |
29 | | - |
30 | | - # Workaround for https://discuss.circleci.com/t/22437 |
31 | | - - run: |
32 | | - name: Tag Checkout |
33 | | - command: | |
34 | | - if [ -n "$CIRCLE_TAG" ] && [ -d .git ]; then |
35 | | - remote=$(echo "$CIRCLE_REPOSITORY_URL" | \ |
36 | | - sed -e 's,/^git.github.com:,https://github.com/,') |
37 | | - git fetch -f "$remote" "refs/tags/$CIRCLE_TAG:refs/tags/$CIRCLE_TAG" || \ |
38 | | - (echo 'Removing .git cache for tag build'; rm -rf .git) |
39 | | - fi |
40 | | -
|
41 | 9 | - checkout |
42 | 10 |
|
43 | | - # Build txt and html versions of drafts |
44 | | - - run: |
45 | | - name: "Build Drafts" |
46 | | - command: make |
47 | | - |
48 | | - # Update editor's copy on gh-pages |
49 | 11 | - run: |
50 | | - name: "Update GitHub Pages" |
| 12 | + name: "Check Formatting" |
51 | 13 | command: | |
52 | | - if [ "${CIRCLE_TAG#draft-}" == "$CIRCLE_TAG" ]; then |
53 | | - make gh-pages |
54 | | - fi |
| 14 | + pip3 install --user black==19.3b0 && ln -s $HOME/.local/bin/black $BINDIR |
| 15 | + black --check . |
55 | 16 |
|
56 | | - # For tagged builds, upload to the datatracker. |
57 | | - - deploy: |
58 | | - name: "Upload to Datatracker" |
| 17 | + - run: |
| 18 | + name: "Run Tests" |
59 | 19 | command: | |
60 | | - if [ "${CIRCLE_TAG#draft-}" != "$CIRCLE_TAG" ]; then |
61 | | - make upload |
| 20 | + if [ -z "$CIRCLE_TAG" ]; then |
| 21 | + pip3 install --user behave && ln -s $HOME/.local/bin/behave $BINDIR |
| 22 | + mkdir -p /tmp/artifacts |
| 23 | + behave --junit --junit-directory /tmp/artifacts tests/*.feature |
62 | 24 | fi |
63 | 25 |
|
64 | | - # Archive GitHub Issues |
65 | | - - run: |
66 | | - name: "Archive GitHub Issues" |
67 | | - command: "make archive || make archive DISABLE_ARCHIVE_FETCH=true && make gh-archive" |
68 | | - |
69 | | - # Create and store artifacts |
70 | | - - run: |
71 | | - name: "Create Artifacts" |
72 | | - command: "make artifacts CI_ARTIFACTS=/tmp/artifacts" |
73 | | - |
74 | 26 | - store_artifacts: |
75 | 27 | path: /tmp/artifacts |
76 | 28 |
|
77 | | - - run: |
78 | | - name: "Prepare for Caching" |
79 | | - command: "git reflog expire --expire=now --all && git gc --prune=now" |
80 | | - |
81 | | - - save_cache: |
82 | | - name: "Saving Cache - Git" |
83 | | - key: v2-cache-git-{{ .Branch }}-{{ .Revision }} |
84 | | - paths: |
85 | | - - ~/draft/.git |
86 | | - |
87 | | - - save_cache: |
88 | | - name: "Saving Cache - Drafts" |
89 | | - key: v1-cache-references-{{ epoch }} |
90 | | - paths: |
91 | | - - ~/.cache/xml2rfc |
92 | | - |
93 | 29 |
|
94 | 30 | workflows: |
95 | 31 | version: 2 |
|
0 commit comments