diff options
author | zeroinformatique | 2021-06-29 01:27:46 +0200 |
---|---|---|
committer | GitHub | 2021-06-29 01:27:46 +0200 |
commit | 622af23bb3ce8d6dc8dc1d658cb7f01bc905ef2c (patch) | |
tree | 09098afd8ba30d35267460eb4ec63520c2c07678 /.github/workflows | |
parent | 153615a69e463ebb859cded5cfe8fb27acd6e722 (diff) | |
parent | 4964ee35dfb4b9b58f5791b20df13e34fa89e3ed (diff) | |
download | ldgallery-622af23bb3ce8d6dc8dc1d658cb7f01bc905ef2c.tar.gz |
Merge pull request #293 from ldgallery/pacien-20210628-ci-gha-init
ci: configure GitHub Actions
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build.yml | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..532c1f7 --- /dev/null +++ b/.github/workflows/build.yml | |||
@@ -0,0 +1,139 @@ | |||
1 | name: Build | ||
2 | on: pull_request | ||
3 | |||
4 | jobs: | ||
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 Vue | ||
12 | node-version: 12.16.1 | ||
13 | - name: Lint and build Node.js Vue project | ||
14 | working-directory: viewer | ||
15 | run: | | ||
16 | npm install | ||
17 | npm run lint | ||
18 | npm 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 | stack install --local-bin-path dist | ||
50 | - uses: actions/upload-artifact@v2 | ||
51 | with: | ||
52 | name: compiler-dist-${{ matrix.os }} | ||
53 | path: compiler/dist | ||
54 | |||
55 | # TODO: generate a distro-agnostic Linux package. | ||
56 | # See https://github.com/ldgallery/ldgallery/issues/285 | ||
57 | archive-linux: | ||
58 | needs: [ build-viewer, build-compiler ] | ||
59 | runs-on: ubuntu-20.04 | ||
60 | steps: | ||
61 | - uses: actions/checkout@v2 | ||
62 | - name: Bundle ldgallery viewer | ||
63 | uses: actions/download-artifact@v2 | ||
64 | with: | ||
65 | name: viewer-dist | ||
66 | path: dist/viewer | ||
67 | - name: Bundle ldgallery compiler | ||
68 | uses: actions/download-artifact@v2 | ||
69 | with: | ||
70 | name: compiler-dist-ubuntu-20.04 | ||
71 | path: dist | ||
72 | - name: Install build dependencies | ||
73 | run: | | ||
74 | sudo apt-get update -qq | ||
75 | sudo apt-get install -y pandoc | ||
76 | - name: Build manuals | ||
77 | run: | | ||
78 | pandoc --standalone --to man ldgallery-quickstart.7.md --output dist/ldgallery-quickstart.7 | ||
79 | pandoc --standalone --to man compiler/ldgallery.1.md --output dist/ldgallery.1 | ||
80 | pandoc --standalone --to man viewer/ldgallery-viewer.7.md --output dist/ldgallery-viewer.7 | ||
81 | cp changelog.md dist/ | ||
82 | cp license.md dist/ | ||
83 | - uses: actions/upload-artifact@v2 | ||
84 | with: | ||
85 | name: archive-linux-amd64 | ||
86 | path: dist | ||
87 | |||
88 | archive-windows: | ||
89 | needs: [ build-viewer, build-compiler ] | ||
90 | runs-on: ubuntu-20.04 | ||
91 | steps: | ||
92 | - uses: actions/checkout@v2 | ||
93 | - uses: actions/cache@v2 | ||
94 | with: | ||
95 | path: ~/downloads | ||
96 | key: archive-windows-vendored | ||
97 | - name: Bundle ldgallery viewer | ||
98 | uses: actions/download-artifact@v2 | ||
99 | with: | ||
100 | name: viewer-dist | ||
101 | path: dist/viewer | ||
102 | - name: Bundle ldgallery compiler | ||
103 | uses: actions/download-artifact@v2 | ||
104 | with: | ||
105 | name: compiler-dist-windows-2019 | ||
106 | path: dist | ||
107 | - name: Install build dependencies | ||
108 | run: | | ||
109 | sudo apt-get update -qq | ||
110 | sudo apt-get install -y pandoc wget curl html-xml-utils p7zip-full | ||
111 | - name: Copy scripts | ||
112 | run: | | ||
113 | mkdir dist/scripts | ||
114 | cp scripts/win_* dist/scripts/ | ||
115 | - name: Build manuals | ||
116 | run: | | ||
117 | pandoc --standalone --to html ldgallery-quickstart.7.md --output dist/ldgallery-quickstart.7.html | ||
118 | pandoc --standalone --to html compiler/ldgallery.1.md --output dist/ldgallery.1.html | ||
119 | pandoc --standalone --to html viewer/ldgallery-viewer.7.md --output dist/ldgallery-viewer.7.html | ||
120 | pandoc --standalone --to html changelog.md --output dist/changelog.html | ||
121 | pandoc --standalone --to html license.md --output dist/license.html | ||
122 | - name: Bundle ImageMagick | ||
123 | run: | | ||
124 | MAGICK_ARCHIVES="https://download.imagemagick.org/ImageMagick/download/binaries/" | ||
125 | MAGICK_LATEST=$( \ | ||
126 | curl --silent "$MAGICK_ARCHIVES" \ | ||
127 | | hxclean \ | ||
128 | | hxselect 'a::attr(href)' -c -s '\n' \ | ||
129 | | grep -m1 '^ImageMagick-7.*portable-Q16-HDRI-x64.zip$' ) | ||
130 | mkdir -p ~/downloads | ||
131 | wget --timestamping --directory-prefix ~/downloads "$MAGICK_ARCHIVES/$MAGICK_LATEST" | ||
132 | 7z e ~/downloads/"$MAGICK_LATEST" -odist/ magick.exe | ||
133 | 7z e ~/downloads/"$MAGICK_LATEST" -so LICENSE.txt > dist/magick.license.txt | ||
134 | 7z e ~/downloads/"$MAGICK_LATEST" -so NOTICE.txt > dist/magick.notice.txt | ||
135 | 7z e ~/downloads/"$MAGICK_LATEST" -so README.txt > dist/magick.readme.txt | ||
136 | - uses: actions/upload-artifact@v2 | ||
137 | with: | ||
138 | name: archive-win64 | ||
139 | path: dist | ||