From a32ced7b1303cb933d4be507c499b0aaa84e8775 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 5 Jun 2020 21:46:41 +0200 Subject: [PATCH 1/8] Netlify: Add netlify.toml config --- netlify.toml | 14 ++++++++++++++ runtime.txt | 1 + 2 files changed, 15 insertions(+) create mode 100644 netlify.toml create mode 100644 runtime.txt diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000000..816b2ef1d0 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,14 @@ +# Settings in the [build] context are global and are applied to all contexts +# unless otherwise overridden by more specific contexts. +[build] + # Directory to change to before starting a build. + # This is where we will look for package.json/.nvmrc/etc. + base = "" + + # Default build command. + command = "make versionedhtml" + + # Directory (relative to root of your repo) that contains the deploy-ready + # HTML files and assets generated by the build. If a base directory has + # been specified, include it in the publish directory path. + publish = "build/html" diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000000..548d71365f --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +3.7 \ No newline at end of file From bde9ee5cacd6641febc2a488fa2a3b9d7f0695e5 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 5 Jun 2020 22:39:11 +0200 Subject: [PATCH 2/8] Netlify: Build all manual versions --- _redirects | 31 +++++++++++++++++++++++++++++++ build_manual.sh | 35 +++++++++++++++++++++++++++++++++++ netlify.toml | 2 +- 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 _redirects create mode 100755 build_manual.sh diff --git a/_redirects b/_redirects new file mode 100644 index 0000000000..1b48f753e0 --- /dev/null +++ b/_redirects @@ -0,0 +1,31 @@ +/ /latest/ 302 +/latest/* /2.2/:splat 301 +/:version/* /:version/ca/:splat 301 Language=ca +/:version/* /:version/cs/:splat 301 Language=cs +/:version/* /:version/de-DE/:splat 301 Language=de-DE +/:version/* /:version/de/:splat 301 Language=de +/:version/* /:version/en-GB/:splat 301 Language=en-GB +/:version/* /:version/es-ES/:splat 301 Language=es-ES +/:version/* /:version/es-MX/:splat 301 Language=es-MX +/:version/* /:version/es/:splat 301 Language=es +/:version/* /:version/fi/:splat 301 Language=fi +/:version/* /:version/fr/:splat 301 Language=fr +/:version/* /:version/gl/:splat 301 Language=gl +/:version/* /:version/id/:splat 301 Language=id +/:version/* /:version/it/:splat 301 Language=it +/:version/* /:version/ja-JP/:splat 301 Language=ja-JP +/:version/* /:version/kn/:splat 301 Language=kn +/:version/* /:version/nl/:splat 301 Language=nl +/:version/* /:version/pl/:splat 301 Language=pl +/:version/* /:version/pt-BR/:splat 301 Language=pt-BR +/:version/* /:version/pt/:splat 301 Language=pt +/:version/* /:version/ro/:splat 301 Language=ro +/:version/* /:version/ru-RU/:splat 301 Language=ru-RU +/:version/* /:version/ru/:splat 301 Language=ru +/:version/* /:version/sl/:splat 301 Language=sl +/:version/* /:version/sq/:splat 301 Language=sq +/:version/* /:version/sr/:splat 301 Language=sr +/:version/* /:version/tr/:splat 301 Language=tr +/:version/* /:version/zh-CN/:splat 301 Language=zh-CN +/:version/* /:version/zh-TW/:splat 301 Language=zh-TW +/:version/* /:version/en/:splat 301 diff --git a/build_manual.sh b/build_manual.sh new file mode 100755 index 0000000000..893ae661bd --- /dev/null +++ b/build_manual.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# Add remote to build other branches, too +if git remote -v | grep -q origin +then + git remote remove origin +fi +git remote add origin --fetch https://github.com/mixxxdj/manual.git +git fetch origin + +# Parse languages and ensure that "en" is built last +cd source || exit 1 +LANGUAGES="$(python -c 'import conf; print(" ".join(sorted((lang for lang in conf.supported_languages.keys() if lang != "en"), reverse=True)))')" +cd .. || exit 1 +LANGUAGES="$LANGUAGES en" +NUM_LANGUAGES="$(printf '%s' "$LANGUAGES" | wc -w)" + +# Write _redirects file +mkdir -p build/html +printf '/ /latest/ 302\n' > build/html/_redirects +printf '/latest/* /2.2/:splat 301\n' >> build/html/_redirects + +i=1 +for lang in $LANGUAGES +do + printf -- '----- Building language "%s"... [%d/%d] -----\n' "$lang" "$i" "$NUM_LANGUAGES" + + if [ "$lang" = "en" ] + then + printf '/:version/* /:version/en/:splat 301\n' >> build/html/_redirects + else + printf '/:version/* /:version/%s/:splat 301 Language=%s\n' "$lang" "$lang" >> build/html/_redirects + fi + make versionedhtml SPHINXOPTS="-q -j $(nproc) -Dlanguage=$lang" + i=$((i + 1)) +done diff --git a/netlify.toml b/netlify.toml index 816b2ef1d0..f800150048 100644 --- a/netlify.toml +++ b/netlify.toml @@ -6,7 +6,7 @@ base = "" # Default build command. - command = "make versionedhtml" + command = "sh build_manual.sh" # Directory (relative to root of your repo) that contains the deploy-ready # HTML files and assets generated by the build. If a base directory has From 28b08039959853a8a79e6f5d9e125dcbbdfb5a50 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 6 Jun 2020 02:53:58 +0200 Subject: [PATCH 3/8] Travis CI: Add .travis.yml config --- .travis.yml | 27 +++++++++++++++++++++++++++ build_manual.sh | 8 -------- netlify.toml | 4 ++-- 3 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..f94c0ae68f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +language: python +python: +- 3.7 +os: linux +dist: xenial +cache: + pip: true + +install: +- npm install -g netlify-cli +- export PATH="$(npm prefix -g)/bin:$PATH" +- pip install -r requirements.txt + +script: +- mkdir html +- git remote rename origin fork +- git remote add origin https://github.com/mixxxdj/manual.git +- git fetch origin +- git branch -r +- sh build_manual.sh + +deploy: + provider: script + skip_cleanup: true + script: netlify deploy --prod --dir build/html + on: + branch: netlify diff --git a/build_manual.sh b/build_manual.sh index 893ae661bd..9a74209e76 100755 --- a/build_manual.sh +++ b/build_manual.sh @@ -1,12 +1,4 @@ #!/bin/sh -# Add remote to build other branches, too -if git remote -v | grep -q origin -then - git remote remove origin -fi -git remote add origin --fetch https://github.com/mixxxdj/manual.git -git fetch origin - # Parse languages and ensure that "en" is built last cd source || exit 1 LANGUAGES="$(python -c 'import conf; print(" ".join(sorted((lang for lang in conf.supported_languages.keys() if lang != "en"), reverse=True)))')" diff --git a/netlify.toml b/netlify.toml index f800150048..f18d4a9cfe 100644 --- a/netlify.toml +++ b/netlify.toml @@ -6,9 +6,9 @@ base = "" # Default build command. - command = "sh build_manual.sh" + command = "" # Directory (relative to root of your repo) that contains the deploy-ready # HTML files and assets generated by the build. If a base directory has # been specified, include it in the publish directory path. - publish = "build/html" + publish = "" From c1634b3befc7571bba1fd5b94c29cfd269bf626b Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 6 Jun 2020 05:50:28 +0200 Subject: [PATCH 4/8] Travis CI: Build Manual PDFs --- .travis.yml | 1 + build_manual.sh | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index f94c0ae68f..1fd21760ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ cache: pip: true install: +- sudo apt-get update && sudo apt-get install -y texlive-full latexmk - npm install -g netlify-cli - export PATH="$(npm prefix -g)/bin:$PATH" - pip install -r requirements.txt diff --git a/build_manual.sh b/build_manual.sh index 9a74209e76..6838c67929 100755 --- a/build_manual.sh +++ b/build_manual.sh @@ -23,5 +23,12 @@ do printf '/:version/* /:version/%s/:splat 301 Language=%s\n' "$lang" "$lang" >> build/html/_redirects fi make versionedhtml SPHINXOPTS="-q -j $(nproc) -Dlanguage=$lang" + make versionedlatexpdf SPHINXOPTS="-q -j $(nproc) -Dlanguage=$lang" i=$((i + 1)) done + +cd build/latex || exit 1 +for file in */*/Mixxx-Manual.pdf +do + cp "$file" "../html/$file" +done From 7c54d78196f80a3497aa22888afc42af6fcbb4f4 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 6 Jun 2020 16:24:16 +0200 Subject: [PATCH 5/8] Travis CI: Reduce log spam --- .travis.yml | 2 +- build_manual.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1fd21760ff..edcac306bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ cache: pip: true install: -- sudo apt-get update && sudo apt-get install -y texlive-full latexmk +- sudo apt-get update && sudo apt-get install -y texlive texlive-xetex texlive-latex-extra latexmk xindy - npm install -g netlify-cli - export PATH="$(npm prefix -g)/bin:$PATH" - pip install -r requirements.txt diff --git a/build_manual.sh b/build_manual.sh index 6838c67929..5eb267e314 100755 --- a/build_manual.sh +++ b/build_manual.sh @@ -22,8 +22,8 @@ do else printf '/:version/* /:version/%s/:splat 301 Language=%s\n' "$lang" "$lang" >> build/html/_redirects fi - make versionedhtml SPHINXOPTS="-q -j $(nproc) -Dlanguage=$lang" - make versionedlatexpdf SPHINXOPTS="-q -j $(nproc) -Dlanguage=$lang" + make versionedhtml SPHINXOPTS="-Q -j $(nproc) -Dlanguage=$lang" + make versionedlatexpdf SPHINXOPTS="-Q -j $(nproc) -Dlanguage=$lang" >/dev/null i=$((i + 1)) done From 436194d3795b5c866ef31cc7394843aa39c0fafc Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 3 Jul 2020 11:42:12 +0200 Subject: [PATCH 6/8] Netlify: Allow simple HTML builds for non-production contexts --- netlify.toml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/netlify.toml b/netlify.toml index f18d4a9cfe..a3f010f9ef 100644 --- a/netlify.toml +++ b/netlify.toml @@ -6,9 +6,15 @@ base = "" # Default build command. - command = "" + command = "sphinx-build -b html source build" # Directory (relative to root of your repo) that contains the deploy-ready # HTML files and assets generated by the build. If a base directory has # been specified, include it in the publish directory path. - publish = "" + publish = "build" + +[context.production] + # Production content is pushed to master + # Exit code 0 means that this build will be ignored + # https://docs.netlify.com/configure-builds/file-based-configuration/#ignore-builds + ignore = "true" From 8588809b7b63622b6614c2305daaef4133b3a8f5 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 3 Jul 2020 13:09:19 +0200 Subject: [PATCH 7/8] Travis CI: Do not run Travis Build on PRs --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index edcac306bc..900f466251 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ dist: xenial cache: pip: true +if: type != pull_request AND branch =~ /^(manual-)/ + install: - sudo apt-get update && sudo apt-get install -y texlive texlive-xetex texlive-latex-extra latexmk xindy - npm install -g netlify-cli @@ -24,5 +26,3 @@ deploy: provider: script skip_cleanup: true script: netlify deploy --prod --dir build/html - on: - branch: netlify From 790c5c12007d12c9ada25f3e7d3f154b8ca3f6a7 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 3 Jul 2020 13:29:22 +0200 Subject: [PATCH 8/8] Travis CI: Always build using latest sphinx config --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 900f466251..b0b240d8c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,9 @@ script: - git remote add origin https://github.com/mixxxdj/manual.git - git fetch origin - git branch -r +- export LATEST_BRANCH="$(git branch -r | grep -Po 'origin/manual-\d+\.\d+\.x' | sort | tail -n 1)" +- echo "Building from branch ${LATEST_BRANCH}" +- git checkout "${LATEST_BRANCH}" - sh build_manual.sh deploy: