diff options
Diffstat (limited to '.github/workflows/build.yml')
-rw-r--r-- | .github/workflows/build.yml | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..aef142b --- /dev/null +++ b/.github/workflows/build.yml | |||
@@ -0,0 +1,124 @@ | |||
1 | name: Build | ||
2 | on: pull_request | ||
3 | |||
4 | jobs: | ||
5 | build-viewer: | ||
6 | runs-on: ubuntu-latest | ||
7 | steps: | ||
8 | - uses: actions/checkout@v2 | ||
9 | - uses: actions/setup-node@v1 | ||
10 | with: | ||
11 | node-version: 12.x | ||
12 | - name: Lint and build Node.js Vue project | ||
13 | working-directory: viewer | ||
14 | run: | | ||
15 | npm install | ||
16 | npm run lint | ||
17 | npm run build | ||
18 | - uses: actions/upload-artifact@v2 | ||
19 | with: | ||
20 | name: viewer-dist | ||
21 | path: viewer/dist | ||
22 | |||
23 | # TODO: do not hard-code the CI install path in the output binary | ||
24 | # See https://github.com/ldgallery/ldgallery/issues/286 | ||
25 | build-compiler: | ||
26 | strategy: | ||
27 | fail-fast: false | ||
28 | matrix: | ||
29 | os: [ ubuntu-latest, windows-latest ] | ||
30 | runs-on: ${{ matrix.os }} | ||
31 | steps: | ||
32 | - uses: actions/checkout@v2 | ||
33 | - uses: haskell/actions/setup@v1 | ||
34 | with: | ||
35 | ghc-version: 8.10.4 | ||
36 | enable-stack: true | ||
37 | - name: Build Haskell Stack project | ||
38 | working-directory: compiler | ||
39 | run: | | ||
40 | stack setup --no-terminal | ||
41 | stack build --no-terminal | ||
42 | stack install --local-bin-path dist | ||
43 | - uses: actions/upload-artifact@v2 | ||
44 | with: | ||
45 | name: compiler-dist-${{ matrix.os }} | ||
46 | path: compiler/dist | ||
47 | |||
48 | # TODO: generate a distro-agnostic Linux package. | ||
49 | # See https://github.com/ldgallery/ldgallery/issues/285 | ||
50 | archive-linux: | ||
51 | needs: [ build-viewer, build-compiler ] | ||
52 | runs-on: ubuntu-latest | ||
53 | steps: | ||
54 | - uses: actions/checkout@v2 | ||
55 | - name: Bundle ldgallery viewer | ||
56 | uses: actions/download-artifact@v2 | ||
57 | with: | ||
58 | name: viewer-dist | ||
59 | path: dist/viewer | ||
60 | - name: Bundle ldgallery compiler | ||
61 | uses: actions/download-artifact@v2 | ||
62 | with: | ||
63 | name: compiler-dist-ubuntu-latest | ||
64 | path: dist | ||
65 | - name: Install build dependencies | ||
66 | run: | | ||
67 | sudo apt-get update -qq | ||
68 | sudo apt-get install -y pandoc | ||
69 | - name: Build manuals | ||
70 | run: | | ||
71 | pandoc --standalone --to man ldgallery-quickstart.7.md --output dist/ldgallery-quickstart.7 | ||
72 | pandoc --standalone --to man compiler/ldgallery.1.md --output dist/ldgallery.1 | ||
73 | pandoc --standalone --to man viewer/ldgallery-viewer.7.md --output dist/ldgallery-viewer.7 | ||
74 | cp changelog.md dist/ | ||
75 | cp license.md dist/ | ||
76 | - uses: actions/upload-artifact@v2 | ||
77 | with: | ||
78 | name: archive-linux-amd64 | ||
79 | path: dist | ||
80 | |||
81 | archive-windows: | ||
82 | needs: [ build-viewer, build-compiler ] | ||
83 | runs-on: ubuntu-latest | ||
84 | steps: | ||
85 | - uses: actions/checkout@v2 | ||
86 | - name: Bundle ldgallery viewer | ||
87 | uses: actions/download-artifact@v2 | ||
88 | with: | ||
89 | name: viewer-dist | ||
90 | path: dist/viewer | ||
91 | - name: Bundle ldgallery compiler | ||
92 | uses: actions/download-artifact@v2 | ||
93 | with: | ||
94 | name: compiler-dist-windows-latest | ||
95 | path: dist | ||
96 | - name: Install build dependencies | ||
97 | run: | | ||
98 | sudo apt-get update -qq | ||
99 | sudo apt-get install -y pandoc wget p7zip-full | ||
100 | - name: Copy scripts | ||
101 | run: | | ||
102 | mkdir dist/scripts | ||
103 | cp scripts/win_* dist/scripts/ | ||
104 | - name: Build manuals | ||
105 | run: | | ||
106 | pandoc --standalone --to html ldgallery-quickstart.7.md --output dist/ldgallery-quickstart.7.html | ||
107 | pandoc --standalone --to html compiler/ldgallery.1.md --output dist/ldgallery.1.html | ||
108 | pandoc --standalone --to html viewer/ldgallery-viewer.7.md --output dist/ldgallery-viewer.7.html | ||
109 | pandoc --standalone --to html changelog.md --output dist/changelog.html | ||
110 | pandoc --standalone --to html license.md --output dist/license.html | ||
111 | # TODO: automatically get the latest imagemagick version, since old archives disappear from the website | ||
112 | # See https://github.com/ldgallery/ldgallery/issues/281 | ||
113 | - name: Bundle ImageMagick | ||
114 | run: | | ||
115 | wget -O magick.zip \ | ||
116 | https://download.imagemagick.org/ImageMagick/download/binaries/ImageMagick-7.1.0-2-portable-Q16-x64.zip | ||
117 | 7z e magick.zip -odist/ magick.exe | ||
118 | 7z e magick.zip -so LICENSE.txt > dist/magick.license.txt | ||
119 | 7z e magick.zip -so NOTICE.txt > dist/magick.notice.txt | ||
120 | 7z e magick.zip -so README.txt > dist/magick.readme.txt | ||
121 | - uses: actions/upload-artifact@v2 | ||
122 | with: | ||
123 | name: archive-win64 | ||
124 | path: dist | ||