-
Notifications
You must be signed in to change notification settings - Fork 9
147 lines (147 loc) · 5.82 KB
/
emscripten.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
---
name: Angular and Emscripten
on:
workflow_run:
workflows: ['format']
types:
- completed
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- config: Debug
config-angular: -dev
emcc_debug: '2'
- config: Release
config-angular: ''
emcc_debug: '0'
env:
VCPKG_DEFAULT_TRIPLET: 'wasm32-emscripten'
VCPKG_INSTALLED_DIR: '${{ github.workspace }}/vcpkg/installed'
EMCC_DEBUG: ${{ matrix.emcc_debug }}
steps:
- name: Stop if format failed
if: ${{ github.event.workflow_run.conclusion != 'success' }}
run: |
echo ${{ github.event.workflow_run.conclusion }}
exit 1
- uses: bansan85/action-workflow_run-status@main
env:
MATRIX_CONTEXT: ${{ toJSON(matrix) }}
- uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ github.event.workflow_run.head_commit.id }}
- uses: actions/setup-node@v3
with:
node-version: '18.12.0'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install SSH key
if: ${{ github.event.workflow_run.head_branch == 'master' }}
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.GITHUBCI_PRIVATE_KEY }}
known_hosts: localhost ssh-rsa ${{ secrets.GITHUBCI_KNOW_HOSTS }}
- name: Install packages
run: sudo apt-get install -yq sshpass
- name: Install emscripten
run: |
git clone --depth=1 https://github.com/bansan85/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
echo "EMSDK=${{ github.workspace }}/emsdk" >> $GITHUB_ENV
echo "EM_CONFIG=${{ github.workspace }}/emsdk/.emscripten" >> $GITHUB_ENV
echo "${{ github.workspace }}/emsdk" >> $GITHUB_PATH
echo "${{ github.workspace }}/emsdk/upstream/emscripten" >> $GITHUB_PATH
cd ..
- name: Install Windows Vcpkg
uses: lukka/run-vcpkg@v10
with:
vcpkgJsonGlob: '${{ github.workspace }}/config/emscripten/vcpkg.json'
runVcpkgInstall: true
- name: cmake
run: |
source ./emsdk/emsdk_env.sh
npm install -g npm
mkdir build
emcmake cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${{ env.EMSDK }}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DVCPKG_TARGET_TRIPLET=wasm32-emscripten -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_PREFIX_PATH=${{ github.workspace }}/vcpkg/installed/wasm32-emscripten/share/spdlog
cmake --build build/ --target all --config ${{ matrix.config }}
- name: ctest
shell: bash
run: |
cd build || exit 1
ctest -O test-result.xml --output-on-failure --verbose
cd .. || exit 1
- name: Start server
run: |
cd src/angular || exit 1
npm run start &
- name: Cypress run
uses: cypress-io/github-action@v4
with:
working-directory: src/angular
wait-on: 'http://localhost:4200'
wait-on-timeout: 300
browser: chrome
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: |
src/angular/cypress/screenshots
src/angular/projects/app-main/dist
- uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos
path: src/angular/cypress/videos
- name: pa11y
run: |
cd src/angular || exit 1
npx pa11y http://localhost:4200
- name: Lighthouse
run: |
cd src/angular || exit 1
npx lhci collect
- name: Publish test
if: ${{ github.event.workflow_run.head_branch == 'master' }}
env:
COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }}
run: |
eval `ssh-agent`
git clone --depth 1 ssh://[email protected]/bansan85/jessica-ci.git -b emscripten${{ matrix.config-angular }}
rm -Rf jessica-ci/*
cp build/test-result.xml jessica-ci
cp src/angular/cypress.xml jessica-ci
cp -R src/angular/.lighthouseci jessica-ci/lighthouseci
if [ "${{ matrix.config == 'Debug' }}" == "true" ]; \
then \
cp -R src/angular/projects/app-main/dist jessica-ci/app-main ; \
fi
apt list --installed > jessica-ci/apt-installed.txt
ssh-add ~/.ssh/id_rsa
gpg --version
gpg --quiet --batch --yes --decrypt --passphrase="${{ secrets.ENCRYPT_PASSWORD }}" --output .github/encrypted/github-ci-private.key .github/encrypted/github-ci-private.key.gpg
gpg --import .github/encrypted/github-ci-private.key
cd jessica-ci || exit 1
git config --global user.name "Github CI"
git config --global user.email "[email protected]"
git add .
if [ -n "$(git diff-index --name-only HEAD --)" ]; \
then \
git commit -S${{ secrets.GPG_KEY_ID }} -m "${COMMIT_MESSAGE//\"/\"\"}" -m "Update from bansan85/jessica@$GITHUB_SHA"; \
git push || { echo "Failure git push" && exit 1; } \
fi
cd .. || exit 1
- name: Deploy website
if: ${{ github.event.workflow_run.head_branch == 'master' }}
env:
SSHPASS: ${{ secrets.SFTP_PASSWORD }}
run: |
ssh-keyscan -t rsa ${{ secrets.SFTP_URL }} >> ~/.ssh/known_hosts
cd src/angular/projects/app-main/dist || exit 1
sshpass -e sftp ${{ secrets.SFTP_USER }}@${{ secrets.SFTP_URL }}:${{ secrets.SFTP_ROOT_FOLDER }}/jessica${{ matrix.config-angular }}/ <<< $'put -r .'