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 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(+) 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(-) 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(+) 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(-) 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 65a3b5b0e8f599a03fac6d8d7d788d97c7f196a3 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 28 Jun 2021 23:08:49 +0200 Subject: ci: remove travis CI (replaced by GitHub Actions) --- .travis.yml | 125 ------------------------------------------------------------ 1 file changed, 125 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 23be533..0000000 --- a/.travis.yml +++ /dev/null @@ -1,125 +0,0 @@ -language: generic - -jobs: - include: - - name: release-linux - language: generic - dist: bionic - - deploy: - provider: releases - edge: true - token: - secure: zRJV96jl3zchT88YAtT6irCXgm96qVcIokVmCHrzcAXsRHgTHQURKcdpPzFdZQnNkxwfS1akA3fW5icr+U6WZIxIe56sHYEaBg7VXR1RiGW/qNOAhSvbJGva75iUllTiELa2FL2gEb8bNhVOy3+bQr5Z7RMeHFiC4FFmbMvaQhd5ss3yR5+bqKufEuJPDpFap93XHUoczXH+lXp1v90Cia1gskHsSl+YgfGWQAc89yOxETwFOSqr3CScZGV6oJpGM2rsflN5arFS/8JqDwuemttfrt74wDdKR4Mk94tcqXqMrledUsXR1NEjWAEWW6QMj05ztZ76TkT2hKpG+WVmUTaJjNKS+RJnf4WKzv1vo2EHZuAuPvwR21NGVYTxvV4o3Zvs4YODGXiUxQgeF5LFA3jbZw9ODyloStUV7zIPqzL7qJEIehnMtkjo2JPav5ORz6B7GwVrDC4LJHn95on3/3Voo3mPeyepoz1gFoh3iovTKAc+IXQXGOhT7cATP9DAWLO/Epct7hWPCEflm+oSS4rNiVbMW/61O3yIpxgkJ/oTsixLk6LOhWNdr2hfP95nAtD+It7LSsJABmWJ0FVO9RtQC7fLmEPaoGdZIdeRk/0yig9vA78Y+q46B6LBalmZO+0V60rdLdrnggJsyt3DZKM/4Z+QUwe494NodE7hU9U= - on: - tags: true - overwrite: true - cleanup: false - file: ldgallery-linux-amd64.tar.gz - - cache: - directories: - - viewer/node_modules - - "$HOME/.stack" - - before_install: - - nvm install 12.16.2 - - nvm use 12.16.2 - - mkdir -p ~/.local/bin - - export PATH=$HOME/.local/bin:$PATH - - travis_retry curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz - | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' - - sudo apt-get update -qq - - sudo apt-get install -y pandoc - - install: - - cd viewer - - npm install - - cd .. - - cd compiler - - stack setup --no-terminal - - cd .. - - script: - - mkdir dist - - cd viewer - - npm run lint - - npm run build -- --dest ../dist/viewer - - cd .. - - cd compiler - - stack build --no-terminal - - stack install --local-bin-path ../dist/ - - cd .. - - 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 license.md dist/ - - tar -cvzf ldgallery-linux-amd64.tar.gz dist - - #============================================================= - - - name: release-win64 - if: tag IS present OR branch IN (master, staging) - language: shell - os: windows - - deploy: - provider: releases - edge: true - token: - secure: zRJV96jl3zchT88YAtT6irCXgm96qVcIokVmCHrzcAXsRHgTHQURKcdpPzFdZQnNkxwfS1akA3fW5icr+U6WZIxIe56sHYEaBg7VXR1RiGW/qNOAhSvbJGva75iUllTiELa2FL2gEb8bNhVOy3+bQr5Z7RMeHFiC4FFmbMvaQhd5ss3yR5+bqKufEuJPDpFap93XHUoczXH+lXp1v90Cia1gskHsSl+YgfGWQAc89yOxETwFOSqr3CScZGV6oJpGM2rsflN5arFS/8JqDwuemttfrt74wDdKR4Mk94tcqXqMrledUsXR1NEjWAEWW6QMj05ztZ76TkT2hKpG+WVmUTaJjNKS+RJnf4WKzv1vo2EHZuAuPvwR21NGVYTxvV4o3Zvs4YODGXiUxQgeF5LFA3jbZw9ODyloStUV7zIPqzL7qJEIehnMtkjo2JPav5ORz6B7GwVrDC4LJHn95on3/3Voo3mPeyepoz1gFoh3iovTKAc+IXQXGOhT7cATP9DAWLO/Epct7hWPCEflm+oSS4rNiVbMW/61O3yIpxgkJ/oTsixLk6LOhWNdr2hfP95nAtD+It7LSsJABmWJ0FVO9RtQC7fLmEPaoGdZIdeRk/0yig9vA78Y+q46B6LBalmZO+0V60rdLdrnggJsyt3DZKM/4Z+QUwe494NodE7hU9U= - on: - tags: true - overwrite: true - cleanup: false - file: ldgallery-win64.zip - - cache: - directories: - - viewer/node_modules - - "$HOME/.stack" - - env: - - NVM_HOME="$ProgramData/nvm/" - - NVM_SYMLINK="$ProgramData/nvm/nodejs/" - - STACK_ROOT="$ProgramData/haskell/" - - before_install: - - export "PATH=$NVM_HOME:$NVM_SYMLINK:$STACK_ROOT:$PATH" - - echo $PATH - - choco install nvm - - nvm install 12.16.2 - - nvm use 12.16.2 - - choco install haskell-stack - - install: - - cd viewer - - npm install - - cd .. - - cd compiler - - stack setup --no-terminal - - cd .. - - script: - - mkdir dist - - cd viewer - - npm run lint - - npm run build -- --dest ../dist/viewer - - cd .. - - cd compiler - - stack build --no-terminal - - stack install --local-bin-path ../dist/ - - cd .. - - mkdir dist/scripts - - cp scripts/win_* dist/scripts/ - - cp ldgallery-quickstart.7.md dist/ldgallery-quickstart.7.md - - cp viewer/ldgallery-viewer.7.md dist/ldgallery-viewer.7.md - - cp compiler/ldgallery.1.md dist/ldgallery.1.md - - cp changelog.md license.md dist/ - - curl --fail --output magick.zip -L https://imagemagick.org/download/binaries/ImageMagick-7.0.10-30-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 - - 7z a -r -tzip ldgallery-win64.zip ./dist/* - -- 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(-) 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(-) 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