-
Notifications
You must be signed in to change notification settings - Fork 627
166 lines (158 loc) · 5.36 KB
/
build_test.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Build Tests
on:
push:
paths-ignore:
- ".github/**"
- ".gitattributes"
- ".gitignore"
- "LICENSE"
- "docs/**"
- "**.md"
- "**/*.md"
jobs:
ci_skip:
runs-on: [ubuntu-latest]
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Pass on [ci skip]
run: echo ci skip by git commit
- name: Current version
run: echo ${GITHUB_REF}
build_all_without_diff:
runs-on: ubuntu-latest
needs: [ci_skip]
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Fonts
run: setup_lipsum=n ./script/ci/setup.sh
- name: Build Grad in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_grad.sh
- name: Build Undergrad in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_undergrad.sh
- name: Upload Output Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: dist-all
path: dist
- name: Upload Log Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: out-ci-all
path: out-ci
build_undergrad:
runs-on: ubuntu-latest
needs: [ci_skip]
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Fonts
run: ./script/ci/setup.sh
- name: Build Test in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_undergrad.sh
- name: Upload Output Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: dist-undergrad
path: dist
- name: Upload Log Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: out-ci-undergrad
path: out-ci
build_grad:
runs-on: ubuntu-latest
needs: [ci_skip]
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Fonts
run: ./script/ci/setup.sh
- name: Build Test in Docker
run: docker run --mount src=$GITHUB_WORKSPACE/,target=/zjuthesis,type=bind adnrv/texlive:full /zjuthesis/script/ci/github-action/build_grad.sh
- name: Upload Output Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: dist-grad
path: dist
- name: Upload Log Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: out-ci-grad
path: out-ci
diff_pdf:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: [build_grad, build_undergrad]
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Move Artifacts
run: |
mkdir -p dist
mv dist-grad/*.pdf dist/
mv dist-undergrad/*.pdf dist/
- name: PDF Diff
run: bash script/ci/pdf-diff/diff_report.sh
- name: Upload PDF Diff Files
if: ${{ always() }}
uses: actions/upload-artifact@v1
with:
name: pdf-diff-${{ github.sha }}
path: diff
overleaf_update:
runs-on: ubuntu-latest
needs: [diff_pdf, build_all_without_diff]
if: "contains(github.repository_owner, 'TheNetAdmin')"
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Git setup username
run: git config --global user.name "TheNetAdmin"
- name: Git setup email
run: git config --global user.email "[email protected]"
- name: Install Python packages
run: pip3 install pexpect click
- name: Clone Overleaf Repo
run: python3 ./script/ci/overleaf/overleaf.py ${{ secrets.OVERLEAF_ID }} zjuthesis ${{ secrets.OVERLEAF_USER }} ${{ secrets.OVERLEAF_PASSWD }} clone
- name: Update Overleaf Repo
run: python3 ./script/ci/overleaf/overleaf.py ${{ secrets.OVERLEAF_ID }} zjuthesis ${{ secrets.OVERLEAF_USER }} ${{ secrets.OVERLEAF_PASSWD }} update
- name: Push Overleaf Repo
run: python3 ./script/ci/overleaf/overleaf.py ${{ secrets.OVERLEAF_ID }} zjuthesis ${{ secrets.OVERLEAF_USER }} ${{ secrets.OVERLEAF_PASSWD }} push
- name: Check result
run: ls -la ./zjuthesis
gitee_sync:
runs-on: ubuntu-latest
needs: [diff_pdf, build_all_without_diff]
if: "contains(github.repository_owner, 'TheNetAdmin')"
steps:
- name: Checkout Repo
uses: actions/checkout@v1
- name: Current version
run: echo $GITHUB_REF
- name: Sync to Gitee
uses: Yikun/[email protected]
with:
src: github/TheNetAdmin
dst: gitee/netadmin
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: "zjuthesis"