-
Notifications
You must be signed in to change notification settings - Fork 68
117 lines (114 loc) · 3.48 KB
/
deploy.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
name: Build, test and deploy webR
on:
push:
branches:
- "main"
tags:
- "v*.*"
workflow_dispatch:
env:
QUARTO_URL: https://github.com/quarto-dev/quarto-cli/releases/download/v1.2.335/quarto-1.2.335-linux-amd64.deb
jobs:
build:
name: Build webR
runs-on: ubuntu-latest
container: georgestagg/webr-flang:latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
- uses: actions/checkout@v3
- name: Install Quarto
run: |
wget -O /tmp/quarto-linux-amd64.deb $QUARTO_URL
dpkg -i /tmp/quarto-linux-amd64.deb
- name: Configure webR for flang
run: ./configure
- name: Copy flang into webR tree
run: |
cp -r /opt/flang/wasm .
cp -r /opt/flang/host .
cp /opt/flang/emfc ./host/bin/emfc
- name: Setup Emscripten PATH
run: echo "/opt/emsdk:/opt/emsdk/upstream/emscripten" >> $GITHUB_PATH
- name: Set Emscripten EM_NODE_JS
run: echo "EM_NODE_JS=$(which node)" >> $GITHUB_ENV
- name: Set the webR CDN URL as the BASE_URL
run: echo "BASE_URL=https://webr.r-wasm.org/${{ github.ref_name }}/" > "$HOME/.webr-config.mk"
shell: bash
- name: Build all optional wasm libs
env:
EMSDK: /opt/emsdk
run: cd libs && make all
- name: Build webR
env:
EMSDK: /opt/emsdk
run: make && make check-pr
shell: bash
- name: Build webR documentation
run: cd src/docs && make
shell: bash
- name: Report code coverage
uses: codecov/codecov-action@v3
with:
files: src/coverage/lcov.info
flags: unittests
name: codecov-webr
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CC_TOKEN }}
- name: Archive webR build artifacts
uses: actions/upload-artifact@v3
with:
name: webr-dist
path: |
dist
- name: Archive webR documentation artifacts
uses: actions/upload-artifact@v3
with:
name: webr-docs
path: |
src/docs/_site
deploy:
name: Deploy webR to S3
needs: build
runs-on: ubuntu-latest
environment: deploy
permissions:
id-token: write
contents: read
steps:
- name: Download build archive
uses: actions/download-artifact@v3
with:
name: webr-dist
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Upload files to S3 bucket
run: |
aws s3 sync . s3://${{ secrets.AWS_S3_BUCKET }}/_webr/${{ github.ref_name }}/
deploy_docs:
name: Deploy webR documentation to S3
needs: build
runs-on: ubuntu-latest
environment: deploy
permissions:
id-token: write
contents: read
steps:
- name: Download docs archive
uses: actions/download-artifact@v3
with:
name: webr-docs
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Upload files to S3 bucket
run: |
aws s3 sync . s3://${{ secrets.AWS_S3_BUCKET }}/_docs/webr/${{ github.ref_name }}/