aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/build.yml')
-rw-r--r--.github/workflows/build.yml141
1 files changed, 141 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..f5ca509
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,141 @@
1name: Build
2on: [ pull_request, push ]
3
4jobs:
5 build-viewer:
6 runs-on: ubuntu-20.04
7 steps:
8 - uses: actions/checkout@v2
9 - uses: actions/setup-node@v1
10 with:
11 # Latest version officially tested for Ld
12 node-version: 16.14.2
13 - name: Lint and build Node.js Vue project
14 working-directory: viewer
15 run: |
16 yarn
17 yarn run lint
18 yarn run build
19 - uses: actions/upload-artifact@v2
20 with:
21 name: viewer-dist
22 path: viewer/dist
23
24 # TODO: do not hard-code the CI install path in the output binary
25 # See https://github.com/ldgallery/ldgallery/issues/286
26 build-compiler:
27 strategy:
28 fail-fast: false
29 matrix:
30 os: [ ubuntu-20.04, windows-2019 ]
31 runs-on: ${{ matrix.os }}
32 steps:
33 - uses: actions/checkout@v2
34 - uses: actions/cache@v2
35 with:
36 path: ~/.stack
37 key: compiler-${{ runner.os }}-${{ hashFiles('compiler/stack.yaml') }}
38 - uses: haskell/actions/setup@v1
39 with:
40 ghc-version: 8.10.4
41 enable-stack: true
42 - name: Build Haskell Stack project
43 working-directory: compiler
44 shell: bash
45 run: |
46 STACK_ROOT=~/.stack # make it the same on all platforms
47 stack setup --no-terminal
48 stack build --no-terminal \
49 --flag ldgallery-compiler:portable \
50 --copy-bins \
51 --local-bin-path dist
52 - uses: actions/upload-artifact@v2
53 with:
54 name: compiler-dist-${{ matrix.os }}
55 path: compiler/dist
56
57 # TODO: generate a distro-agnostic Linux package.
58 # See https://github.com/ldgallery/ldgallery/issues/285
59 archive-linux:
60 needs: [ build-viewer, build-compiler ]
61 runs-on: ubuntu-20.04
62 steps:
63 - uses: actions/checkout@v2
64 - name: Bundle ldgallery viewer
65 uses: actions/download-artifact@v2
66 with:
67 name: viewer-dist
68 path: dist/viewer
69 - name: Bundle ldgallery compiler
70 uses: actions/download-artifact@v2
71 with:
72 name: compiler-dist-ubuntu-20.04
73 path: dist
74 - name: Install build dependencies
75 run: |
76 sudo apt-get update -qq
77 sudo apt-get install -y pandoc
78 - name: Build manuals
79 run: |
80 pandoc --standalone --to man ldgallery-quickstart.7.md --output dist/ldgallery-quickstart.7
81 pandoc --standalone --to man compiler/ldgallery.1.md --output dist/ldgallery.1
82 pandoc --standalone --to man viewer/ldgallery-viewer.7.md --output dist/ldgallery-viewer.7
83 cp changelog.md dist/
84 cp license.md dist/
85 - uses: actions/upload-artifact@v2
86 with:
87 name: archive-linux-amd64
88 path: dist
89
90 archive-windows:
91 needs: [ build-viewer, build-compiler ]
92 runs-on: ubuntu-20.04
93 steps:
94 - uses: actions/checkout@v2
95 - uses: actions/cache@v2
96 with:
97 path: ~/downloads
98 key: archive-windows-vendored
99 - name: Bundle ldgallery viewer
100 uses: actions/download-artifact@v2
101 with:
102 name: viewer-dist
103 path: dist/viewer
104 - name: Bundle ldgallery compiler
105 uses: actions/download-artifact@v2
106 with:
107 name: compiler-dist-windows-2019
108 path: dist
109 - name: Install build dependencies
110 run: |
111 sudo apt-get update -qq
112 sudo apt-get install -y pandoc wget curl html-xml-utils p7zip-full
113 - name: Copy scripts
114 run: |
115 mkdir dist/scripts
116 cp scripts/win_* dist/scripts/
117 - name: Build manuals
118 run: |
119 pandoc --standalone --to html ldgallery-quickstart.7.md --output dist/ldgallery-quickstart.7.html
120 pandoc --standalone --to html compiler/ldgallery.1.md --output dist/ldgallery.1.html
121 pandoc --standalone --to html viewer/ldgallery-viewer.7.md --output dist/ldgallery-viewer.7.html
122 pandoc --standalone --to html changelog.md --output dist/changelog.html
123 pandoc --standalone --to html license.md --output dist/license.html
124 - name: Bundle ImageMagick
125 run: |
126 MAGICK_ARCHIVES="https://imagemagick.org/archive/binaries/"
127 MAGICK_LATEST=$( \
128 curl --silent "$MAGICK_ARCHIVES" \
129 | hxclean \
130 | hxselect 'a::attr(href)' -c -s '\n' \
131 | grep -m1 '^ImageMagick-7.*portable-Q16-HDRI-x64.zip$' )
132 mkdir -p ~/downloads
133 wget --timestamping --directory-prefix ~/downloads "$MAGICK_ARCHIVES/$MAGICK_LATEST"
134 7z e ~/downloads/"$MAGICK_LATEST" -odist/ magick.exe
135 7z e ~/downloads/"$MAGICK_LATEST" -so LICENSE.txt > dist/magick.license.txt
136 7z e ~/downloads/"$MAGICK_LATEST" -so NOTICE.txt > dist/magick.notice.txt
137 7z e ~/downloads/"$MAGICK_LATEST" -so README.txt > dist/magick.readme.txt
138 - uses: actions/upload-artifact@v2
139 with:
140 name: archive-win64
141 path: dist