This repository has been archived by the owner on Jan 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 533
102 lines (89 loc) · 4.76 KB
/
buildwebsite.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
name: continuous build - docs
on: [push, pull_request_target]
defaults:
run:
shell: bash
jobs:
website-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.7
architecture: x64
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Install Other Dependencies
run: |
python -m pip install --quiet --upgrade pip
python -m pip install --quiet boto3
- name: Build Website (For push)
if: ${{ (failure() || success()) && github.event_name == 'push' }}
run: |
python ./tools/batch/submit-job.py --region us-east-1 \
--job-type g4dn.4x \
--name GluonNLP-Website-${{ github.ref }} \
--remote https://github.com/${{ github.repository }} \
--source-ref ${{ github.ref }} \
--work-dir . \
--saved-output docs/tutorials \
--save-path tutorials \
--command "python -m pip install --quiet -e .[web] && \
apt-get install -y pandoc zip && \
./tools/batch/batch_states/compile_notebooks.sh \
'push' ${GITHUB_REF##*/}" \
--wait | tee build_website.log
- name: Build Website (For pull request)
if: ${{ (failure() || success()) && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }}
run: |
python ./tools/batch/submit-job.py --region us-east-1 \
--job-type g4dn.4x \
--name GluonNLP-Website-PR#${{ github.event.number }} \
--remote https://github.com/${{ github.event.pull_request.head.repo.full_name }} \
--source-ref ${{ github.event.pull_request.head.sha }} \
--work-dir . \
--saved-output docs/tutorials \
--save-path tutorials \
--command "python -m pip install --quiet -e .[web] && \
apt-get install -y pandoc zip && \
./tools/batch/batch_states/compile_notebooks.sh \
${{ github.event.number }} ${{ github.event.pull_request.head.sha }}" \
--wait | tee build_website.log
- name: Wait for job and copy logs from AWS s3
if: ${{ failure() || success() }}
run: |
head -100 build_website.log | grep -oP -m 1 'jobId: \K(.*)' > jobid.log
echo "Job ID is"
cat jobid.log
cat jobid.log | xargs -i python ./tools/batch/wait-job.py --job-id {}
echo "Copy Log file"
cat jobid.log | xargs -i aws s3api wait object-exists --bucket gluon-nlp-dev --key batch/{}/tutorials/index.rst
cat jobid.log | xargs -i aws s3 cp s3://gluon-nlp-dev/batch/{}/tutorials tutorials --recursive
- name: Upload Notebook Compile Logs
if: ${{ failure() || success() }}
uses: actions/upload-artifact@v2
with:
name: Notebook_Logs
path: ./tutorials/**/*.stdout.log
- name: Upload Website Build Log
if: ${{ failure() || success() }}
uses: actions/upload-artifact@v2
with:
name: Website_Log
path: ./build_website.log
- name: Create comment
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.number }}
body: |
The documentation website for preview: http://gluon-nlp-staging.s3-accelerate.dualstack.amazonaws.com/PR${{ github.event.number }}/${{ github.event.pull_request.head.sha }}/index.html