From 01fc05f04f3b043fe863f29dad953a2ca1f80fcd Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 28 Jun 2021 19:07:23 +0200 Subject: ci: configure GitHub Actions This configures GitHub Actions for building the viewer and compiler components and produce archive bundles for Linux and Windows. Those are uploaded as build artifacts instead of automatically being attached to releases like before with Travis CI. This allows manually checking the archives when doing new releases. --- .github/workflows/build.yml | 124 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 .github/workflows/build.yml (limited to '.github/workflows/build.yml') 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 @@ +name: Build +on: pull_request + +jobs: + build-viewer: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: Lint and build Node.js Vue project + working-directory: viewer + run: | + npm install + npm run lint + npm run build + - uses: actions/upload-artifact@v2 + with: + name: viewer-dist + path: viewer/dist + + # TODO: do not hard-code the CI install path in the output binary + # See https://github.com/ldgallery/ldgallery/issues/286 + build-compiler: + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, windows-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: haskell/actions/setup@v1 + with: + ghc-version: 8.10.4 + enable-stack: true + - name: Build Haskell Stack project + working-directory: compiler + run: | + stack setup --no-terminal + stack build --no-terminal + stack install --local-bin-path dist + - uses: actions/upload-artifact@v2 + with: + name: compiler-dist-${{ matrix.os }} + path: compiler/dist + + # TODO: generate a distro-agnostic Linux package. + # See https://github.com/ldgallery/ldgallery/issues/285 + archive-linux: + needs: [ build-viewer, build-compiler ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Bundle ldgallery viewer + uses: actions/download-artifact@v2 + with: + name: viewer-dist + path: dist/viewer + - name: Bundle ldgallery compiler + uses: actions/download-artifact@v2 + with: + name: compiler-dist-ubuntu-latest + path: dist + - name: Install build dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -y pandoc + - name: Build manuals + run: | + pandoc --standalone --to man ldgallery-quickstart.7.md --output dist/ldgallery-quickstart.7 + pandoc --standalone --to man compiler/ldgallery.1.md --output dist/ldgallery.1 + pandoc --standalone --to man viewer/ldgallery-viewer.7.md --output dist/ldgallery-viewer.7 + cp changelog.md dist/ + cp license.md dist/ + - uses: actions/upload-artifact@v2 + with: + name: archive-linux-amd64 + path: dist + + archive-windows: + needs: [ build-viewer, build-compiler ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Bundle ldgallery viewer + uses: actions/download-artifact@v2 + with: + name: viewer-dist + path: dist/viewer + - name: Bundle ldgallery compiler + uses: actions/download-artifact@v2 + with: + name: compiler-dist-windows-latest + path: dist + - name: Install build dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -y pandoc wget p7zip-full + - name: Copy scripts + run: | + mkdir dist/scripts + cp scripts/win_* dist/scripts/ + - name: Build manuals + run: | + pandoc --standalone --to html ldgallery-quickstart.7.md --output dist/ldgallery-quickstart.7.html + pandoc --standalone --to html compiler/ldgallery.1.md --output dist/ldgallery.1.html + pandoc --standalone --to html viewer/ldgallery-viewer.7.md --output dist/ldgallery-viewer.7.html + pandoc --standalone --to html changelog.md --output dist/changelog.html + pandoc --standalone --to html license.md --output dist/license.html + # TODO: automatically get the latest imagemagick version, since old archives disappear from the website + # See https://github.com/ldgallery/ldgallery/issues/281 + - name: Bundle ImageMagick + run: | + wget -O magick.zip \ + https://download.imagemagick.org/ImageMagick/download/binaries/ImageMagick-7.1.0-2-portable-Q16-x64.zip + 7z e magick.zip -odist/ magick.exe + 7z e magick.zip -so LICENSE.txt > dist/magick.license.txt + 7z e magick.zip -so NOTICE.txt > dist/magick.notice.txt + 7z e magick.zip -so README.txt > dist/magick.readme.txt + - uses: actions/upload-artifact@v2 + with: + name: archive-win64 + path: dist -- cgit v1.2.3 From c7c731d404592f04ba72c148d6f94a7717fe84f8 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 28 Jun 2021 20:20:16 +0200 Subject: ci: configure cache for haskell stack --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '.github/workflows/build.yml') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aef142b..d877ffc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,13 +30,19 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: ~/.stack + key: compiler-${{ runner.os }}-${{ hashFiles('compiler/stack.yaml') }} - uses: haskell/actions/setup@v1 with: ghc-version: 8.10.4 enable-stack: true - name: Build Haskell Stack project working-directory: compiler + shell: bash run: | + STACK_ROOT=~/.stack # make it the same on all platforms stack setup --no-terminal stack build --no-terminal stack install --local-bin-path dist -- cgit v1.2.3 From b70e61507d63e442d75eee8b978498fa6f6b0dd8 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 28 Jun 2021 20:43:24 +0200 Subject: ci: automatically use latest imagemagick minor version in bundle The archives of deprecated minor versions tend to disappear from the website. This patch makes the CI locate and fetch the latest minor version automatically for inclusion in the bundle archive. GitHub: closes #281 --- .github/workflows/build.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to '.github/workflows/build.yml') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d877ffc..48b0819 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,7 +102,7 @@ jobs: - name: Install build dependencies run: | sudo apt-get update -qq - sudo apt-get install -y pandoc wget p7zip-full + sudo apt-get install -y pandoc wget curl html-xml-utils p7zip-full - name: Copy scripts run: | mkdir dist/scripts @@ -114,16 +114,20 @@ jobs: pandoc --standalone --to html viewer/ldgallery-viewer.7.md --output dist/ldgallery-viewer.7.html pandoc --standalone --to html changelog.md --output dist/changelog.html pandoc --standalone --to html license.md --output dist/license.html - # TODO: automatically get the latest imagemagick version, since old archives disappear from the website - # See https://github.com/ldgallery/ldgallery/issues/281 - name: Bundle ImageMagick run: | - wget -O magick.zip \ - https://download.imagemagick.org/ImageMagick/download/binaries/ImageMagick-7.1.0-2-portable-Q16-x64.zip - 7z e magick.zip -odist/ magick.exe - 7z e magick.zip -so LICENSE.txt > dist/magick.license.txt - 7z e magick.zip -so NOTICE.txt > dist/magick.notice.txt - 7z e magick.zip -so README.txt > dist/magick.readme.txt + MAGICK_ARCHIVES="https://download.imagemagick.org/ImageMagick/download/binaries/" + MAGICK_LATEST=$( \ + curl --silent "$MAGICK_ARCHIVES" \ + | hxclean \ + | hxselect 'a::attr(href)' -c -s '\n' \ + | grep -m1 '^ImageMagick-7.*portable-Q16-x64.zip$' ) + mkdir -p ~/downloads + wget --timestamping --directory-prefix ~/downloads "$MAGICK_ARCHIVES/$MAGICK_LATEST" + 7z e ~/downloads/"$MAGICK_LATEST" -odist/ magick.exe + 7z e ~/downloads/"$MAGICK_LATEST" -so LICENSE.txt > dist/magick.license.txt + 7z e ~/downloads/"$MAGICK_LATEST" -so NOTICE.txt > dist/magick.notice.txt + 7z e ~/downloads/"$MAGICK_LATEST" -so README.txt > dist/magick.readme.txt - uses: actions/upload-artifact@v2 with: name: archive-win64 -- cgit v1.2.3 From 262889d771480b8df677bd0ce4b73d92a786f93c Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 28 Jun 2021 21:05:39 +0200 Subject: ci: configure cache for bundle resources --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) (limited to '.github/workflows/build.yml') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48b0819..0b14231 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,6 +89,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: ~/downloads + key: archive-windows-vendored - name: Bundle ldgallery viewer uses: actions/download-artifact@v2 with: -- cgit v1.2.3 From 4892a176f86051174effc55dde275387a549c824 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 28 Jun 2021 23:08:23 +0200 Subject: ci: enable HDRI for bundled imagemagick --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows/build.yml') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b14231..55cd0a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -125,7 +125,7 @@ jobs: curl --silent "$MAGICK_ARCHIVES" \ | hxclean \ | hxselect 'a::attr(href)' -c -s '\n' \ - | grep -m1 '^ImageMagick-7.*portable-Q16-x64.zip$' ) + | grep -m1 '^ImageMagick-7.*portable-Q16-HDRI-x64.zip$' ) mkdir -p ~/downloads wget --timestamping --directory-prefix ~/downloads "$MAGICK_ARCHIVES/$MAGICK_LATEST" 7z e ~/downloads/"$MAGICK_LATEST" -odist/ magick.exe -- cgit v1.2.3 From f0d2b69bcdd43754142c5d39e5539c0c21f724f0 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 29 Jun 2021 00:19:15 +0200 Subject: ci: pin operating systems versions To improve reproducibility. --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to '.github/workflows/build.yml') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55cd0a8..caabbc6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ on: pull_request jobs: build-viewer: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, windows-latest ] + os: [ ubuntu-20.04, windows-2019 ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -55,7 +55,7 @@ jobs: # See https://github.com/ldgallery/ldgallery/issues/285 archive-linux: needs: [ build-viewer, build-compiler ] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Bundle ldgallery viewer @@ -66,7 +66,7 @@ jobs: - name: Bundle ldgallery compiler uses: actions/download-artifact@v2 with: - name: compiler-dist-ubuntu-latest + name: compiler-dist-ubuntu-20.04 path: dist - name: Install build dependencies run: | @@ -86,7 +86,7 @@ jobs: archive-windows: needs: [ build-viewer, build-compiler ] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -101,7 +101,7 @@ jobs: - name: Bundle ldgallery compiler uses: actions/download-artifact@v2 with: - name: compiler-dist-windows-latest + name: compiler-dist-windows-2019 path: dist - name: Install build dependencies run: | -- cgit v1.2.3 From 4964ee35dfb4b9b58f5791b20df13e34fa89e3ed Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 29 Jun 2021 00:22:13 +0200 Subject: ci: pin node version to match vue recommendations --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.github/workflows/build.yml') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index caabbc6..532c1f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,8 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: 12.x + # Latest version officially tested for Vue + node-version: 12.16.1 - name: Lint and build Node.js Vue project working-directory: viewer run: | -- cgit v1.2.3