-
-
Notifications
You must be signed in to change notification settings - Fork 92
133 lines (131 loc) · 3.88 KB
/
build.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
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- '*'
jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
node-version:
- 16
- 18
include:
- os: ubuntu-latest
node-version: '16'
primary: true
runs-on: ${{ matrix.os }}
outputs:
version: ${{ steps.package_info.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Current version
id: package_info
run: |
VERSION=$(node -e 'console.log(require("./package.json").version)')
echo "::set-output name=version::v$VERSION"
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# libgbm-dev is required by Puppeteer 3+
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgbm-dev ghostscript poppler-utils
if: ${{ runner.os == 'Linux' }}
- name: Install dependencies
run: |
npm ci
- name: Lint and test
run: |
npm run lint
npm t
- name: Setup Docker
# taken from https://github.com/docker/github-actions/blob/0f18e2abad9a4ac2963d2516246787375b5ec917/Dockerfile#L32
run: curl -fL https://download.docker.com/linux/static/stable/x86_64/docker-20.10.4.tgz | tar xzO docker/docker > docker && sudo mv -f docker /usr/bin/docker && sudo chmod +x /usr/bin/docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build container image
run: make packageLocalDocker
- name: Smoke test
run: make testDocker
- name: Build binary
run: |
npm run build
if: matrix.primary
- name: Upload Windows artifact
uses: actions/upload-artifact@v3
with:
name: win-binary
path: build/asciidoctor-web-pdf-win.zip
if: matrix.primary
- name: Upload macOS artifact
uses: actions/upload-artifact@v3
with:
name: mac-binary
path: build/asciidoctor-web-pdf-mac.zip
if: matrix.primary
- name: Upload Linux artifact
uses: actions/upload-artifact@v3
with:
name: linux-binary
path: build/asciidoctor-web-pdf-linux.zip
if: matrix.primary
test-linux:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: linux-binary
- name: Unzip
run: |
unzip asciidoctor-web-pdf-linux.zip -d out
- name: Smoke test
run: |
cd out/asciidoctor-web-pdf-linux-${{ needs.build.outputs.version }}
rm -rf basic.pdf
./asciidoctor-web-pdf ./examples/document/basic-example.adoc -o basic.pdf
ls basic.pdf
test -f basic.pdf -a -s basic.pdf
test-macos:
needs: build
runs-on: macos-latest
steps:
- uses: actions/download-artifact@v3
with:
name: mac-binary
- name: Unzip
run: |
unzip asciidoctor-web-pdf-mac.zip -d out
- name: Smoke test
run: |
cd out/asciidoctor-web-pdf-mac-${{ needs.build.outputs.version }}
rm -rf basic.pdf
./asciidoctor-web-pdf ./examples/document/basic-example.adoc -o basic.pdf
ls basic.pdf
test -f basic.pdf -a -s basic.pdf
test-win:
needs: build
runs-on: windows-latest
steps:
- uses: actions/download-artifact@v3
with:
name: win-binary
- name: Unzip
run: |
unzip asciidoctor-web-pdf-win.zip -d out
- name: Smoke test
run: |
cd out\asciidoctor-web-pdf-win-${{ needs.build.outputs.version }}
asciidoctor-web-pdf.exe examples\document\basic-example.adoc -o basic.pdf
ls basic.pdf
shell: cmd