-
Notifications
You must be signed in to change notification settings - Fork 3
150 lines (143 loc) · 4.28 KB
/
ci-cd.yml
File metadata and controls
150 lines (143 loc) · 4.28 KB
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
name: CI/CD
on:
push:
branches:
- main
- v*
tags:
- v*
pull_request:
workflow_dispatch:
inputs:
publish:
description: "Publish extension to VSCode Marketplace"
type: boolean
required: true
default: false
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
env:
TEST_TIMEOUT: 5m
BRANCH: ${{ startsWith(github.head_ref, '') && github.head_ref || github.ref_name }}
jobs:
test:
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
platform: win32
arch: x64
npm_config_arch: x64
- os: windows-latest
platform: win32
arch: arm64
npm_config_arch: arm
- os: ubuntu-latest
platform: linux
arch: x64
npm_config_arch: x64
- os: ubuntu-latest
platform: linux
arch: arm64
npm_config_arch: arm64
- os: ubuntu-latest
platform: linux
arch: armhf
npm_config_arch: arm
- os: ubuntu-latest
platform: alpine
arch: x64
npm_config_arch: x64
- os: ubuntu-latest
platform: alpine
arch: arm64
npm_config_arch: arm64
- os: macos-latest
platform: darwin
arch: x64
npm_config_arch: x64
- os: macos-latest
platform: darwin
arch: arm64
npm_config_arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 20
- name: Install extension dependencies
run: yarn run install:all
- name: Build webview
run: yarn run build:webview
- name: Run tests
uses: coactions/setup-xvfb@v1
with:
run: yarn test
env:
TEST_TIMEOUT: 2m
- shell: pwsh
run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV
- run: npx --yes @vscode/vsce package --yarn --githubBranch ${{ env.BRANCH }} --target ${{ env.target }}
- uses: actions/upload-artifact@v5
with:
name: code-blocks-${{ env.BRANCH }}-${{ env.target }}
path: "*.vsix"
examples:
name: Build examples
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 20
- name: Install asset generation dependencies
run: |
sudo mkdir -p /usr/local/bin
sudo ln -sf /bin/true /usr/local/bin/mandb # no-op to skip man-db triggers
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive \
apt install -y --no-install-recommends \
ffmpeg libnss3 xvfb \
-o Dpkg::Options::="--path-exclude=/usr/share/man/*" \
-o Dpkg::Options::="--path-exclude=/usr/share/doc/*"
- name: Install extension dependencies
run: yarn run install:all
- name: Build webview
run: yarn run build:webview
- name: Build extension
run: yarn run compile
- name: Setting global vscode settings
run: cp -r ./out/examples/examples-editor/.vscode ~/.vscode
- name: Generate assets
run: |
chmod +x ./generate-assets.sh
chmod +x ./generate-example-asset.sh
./generate-assets.sh ./out/examples .
- name: Upload assets
uses: actions/upload-artifact@v5
with:
name: ${{ env.BRANCH }}-assets
path: |
*.gif
publish:
runs-on: ubuntu-latest
needs: test
if: success() && startsWith(github.ref, 'refs/tags/v') && github.event_name == 'workflow_dispatch' && inputs.publish == true
steps:
- uses: actions/download-artifact@v5
- run: npx --yes @vscode/vsce publish --packagePath $(find . -iname *.vsix)
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: "*.vsix"