From ce5f9791f6ad924e3cdde11947774daff78b55b5 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Thu, 3 May 2018 07:36:30 +0200 Subject: [PATCH] [ci] Download and install firefox before build --- .gitignore | 4 +++ .gitlab-ci.yml | 50 ++++++-------------------------------- conda/meta.yaml | 4 +-- scripts/after_build.sh | 24 ++++++++++++++++++ scripts/install_firefox.sh | 30 +++++++++++++++++++++++ 5 files changed, 67 insertions(+), 45 deletions(-) create mode 100755 scripts/after_build.sh create mode 100755 scripts/install_firefox.sh diff --git a/.gitignore b/.gitignore index 2e5bd3eb..3f2f2dff 100644 --- a/.gitignore +++ b/.gitignore @@ -104,6 +104,10 @@ opsnr.stt html/ record.txt _ci/ +Firefox.app/ +firefox/ +firefox-*.tar.bz2 +firefox-*.dmg miniconda.sh miniconda/ miniconda.cached/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3b909a7c..fb358df1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,6 @@ variables: # Definition of our build pipeline order stages: - build - - browser-test - deploy - pypi @@ -23,12 +22,12 @@ stages: - chmod 755 _ci/install.sh - ./_ci/install.sh _ci master #installs ci support scripts - ./_ci/before_build.sh - script: - - ./_ci/build.sh + - ./scripts/install_firefox.sh after_script: - ./_ci/after_build.sh cache: &build_caches paths: + - firefox-*.* - miniconda.sh - ${CONDA_ROOT}/pkgs/*.tar.bz2 - ${CONDA_ROOT}/pkgs/urls.txt @@ -39,6 +38,9 @@ stages: tags: - docker image: continuumio/conda-concourse-ci + script: + - export PATH=`pwd`/firefox:${PATH} + - ./_ci/build.sh artifacts: expire_in: 1 week paths: @@ -53,6 +55,9 @@ stages: <<: *build_job tags: - macosx + script: + - export PATH=`pwd`/Firefox.app/Contents/MacOS:${PATH} + - ./_ci/build.sh artifacts: expire_in: 1 week paths: @@ -63,24 +68,6 @@ stages: key: "macosx-cache" -# Docker host based testing (must be run inside dind or docker-enabled host) -.browser_test_linux_template: &linux_browser_test_job - stage: browser-test - image: docker.idiap.ch/beat/beat.env.editor:0.0.1r4 - before_script: - # safe keep artifacts as before_build.sh will erase those... - - mv ${CONDA_ROOT}/conda-bld . - - ./_ci/install.sh _ci master #updates ci support scripts - - ./_ci/before_build.sh - - mv conda-bld ${CONDA_ROOT} - - ./scripts/before_test.sh - script: - - export BEAT_BROWSER_TESTS=true - - BOB_TEST_ONLY=true ./_ci/build.sh - after_script: - - ./_ci/after_build.sh - - build_linux_27: <<: *linux_build_job variables: @@ -113,27 +100,6 @@ build_macosx_36: PYTHON_VERSION: "3.6" -# Docker host based testing -browser_linux_27: - <<: *linux_browser_test_job - variables: - PYTHON_VERSION: "2.7" - dependencies: - - build_linux_27 - tags: - - docker - - -browser_linux_36: - <<: *linux_browser_test_job - variables: - PYTHON_VERSION: "3.6" - dependencies: - - build_linux_36 - tags: - - docker - - # Deploy targets .deploy_template: &deploy_job stage: deploy diff --git a/conda/meta.yaml b/conda/meta.yaml index 502a2238..52ba7d30 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -15,7 +15,7 @@ build: - cd {{ project_dir }}/conda/js - npm install - npm run build - - cd {{ project_dir }} + - cd - {% if environ.get('BUILD_EGG') %} - python setup.py sdist --formats=zip {% endif %} @@ -56,12 +56,10 @@ test: commands: - beateditor --help - {% if environ.get('BEAT_BROWSER_TESTS', False) %} - cd {{ project_dir }}/conda/js - npm install - npm test - cd - - {% endif %} - nosetests --with-coverage --cover-package={{ name }} -sv {{ name }} - sphinx-build -aEW {{ project_dir }}/doc {{ project_dir }}/sphinx - sphinx-build -aEb doctest {{ project_dir }}/doc sphinx diff --git a/scripts/after_build.sh b/scripts/after_build.sh new file mode 100755 index 00000000..fd0b3d7e --- /dev/null +++ b/scripts/after_build.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +basedir=`pwd` +source ${basedir}/_ci/functions.sh + +# delete the bob packages from the cache otherwise the cache keeps increasing +# over and over. See https://gitlab.idiap.ch/bob/bob.admin/issues/65 +rm -rf ${CONDA_ROOT}/pkgs/batl*.tar.bz2 +rm -rf ${CONDA_ROOT}/pkgs/beat*.tar.bz2 +rm -rf ${CONDA_ROOT}/pkgs/bob*.tar.bz2 +rm -rf ${CONDA_ROOT}/pkgs/gridtk*.tar.bz2 + +# run git clean to clean everything that is not needed. This helps to keep the +# disk usage on CI machines to minimum. +git clean -ffdx \ + --exclude="firefox-*.{tar.bz2,dmg}" \ + --exclude="miniconda.sh" \ + --exclude="miniconda/pkgs/*.tar.bz2" \ + --exclude="miniconda/pkgs/urls.txt" \ + --exclude="miniconda/conda-bld/linux-64/*.tar.bz2" \ + --exclude="miniconda/conda-bld/osx-64/*.tar.bz2" \ + --exclude="_ci" \ + --exclude="dist/*.zip" \ + --exclude="sphinx" > /dev/null diff --git a/scripts/install_firefox.sh b/scripts/install_firefox.sh new file mode 100755 index 00000000..50dc0d34 --- /dev/null +++ b/scripts/install_firefox.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +basedir=`pwd` +source ${basedir}/_ci/functions.sh + +# Installs firefox and creates a link to ${CONDA_ROOT} +name="firefox" +version="59.0.3" + +if [[ `uname` == 'Linux' ]]; then + + fn="${name}-${version}.tar.bz2" + if [ ! -r "${fn}" ]; then + run_cmd curl "https://ftp.mozilla.org/pub/${name}/releases/${version}/linux-x86_64/en-US/${name}-${version}.tar.bz2" --output "${fn}" + fi + run_cmd tar -xvj -f "${fn}" + +else # macOS: `uname` == 'Darwin' + + fn="${name}-${version}.dmg" + if [ ! -r "${fn}" ]; then + run_cmd curl --silent "https://ftp.mozilla.org/pub/${name}/releases/${version}/mac/en-US/Firefox%20${version}.dmg" --output "${fn}" + fi + mount=`mktemp -d` + run_cmd hdiutil attach -noautoopen -mountpoint ${mount} "${fn}" + run_cmd cp -v -a ${mount}/Firefox.app ./ + run_cmd hdiutil detach ${mount} + run_cmd rm -rf ${mount} + +fi -- GitLab