.gitlab-ci.yml 3.97 KB
Newer Older
1
stages:
2
  - build_and_run_automated_test_scenarios_with_preinstalled_image
Swergas's avatar
Swergas committed
3 4
  - build_and_test_with_preinstalled_image
  - build_and_test_with_debian_image
5

Swergas's avatar
Swergas committed
6 7
build_and_test_with_preinstalled_image:
  stage: build_and_test_with_preinstalled_image
8 9
  # Image glondu/beleniosbase:YYYYMMDD-N is built by Dockerfile_base_environment
  image: glondu/beleniosbase:20181206-2
10
  script:
11 12
    # Initialize environment
    - source ~/env.sh
13
    # Compile belenios
14
    - BELENIOS_DEBUG=1 make all
15 16 17 18 19 20 21 22
    # Create a bundled version of belenios (this produces a belenios.tar.gz file, which is needed by the web server)
    - make archive
    # Start belenios web server
    - ./demo/run-server.sh &
    # Access the localhost web page, print page output for debug purposes, and check validity of page output
    - first_access_index_page_output=$(wget --retry-connrefused --no-check-certificate -T 30 http://localhost:8001 -O-)
    - echo $first_access_index_page_output
    - if [ "$(echo \"$first_access_index_page_output\" | grep '>Belenios</a>' | wc -l)" != "1" ]; then echo "[First page access] First page access does not show a single '>Belenios</a>' text, but it should" && exit 1; else echo "[First page access] First page access shows a single '>Belenios</a>' text, as expected"; fi
23
    # Run a test of an election
24
    - BELENIOS_DEBUG=1 make check
Swergas's avatar
Swergas committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

build_and_test_with_debian_image:
  stage: build_and_test_with_debian_image
  # Image ocaml/opam2:debian-9-ocaml-4.06 currently has ocaml version 4.06.1 and opam version 2.0.0 (whereas image ocaml/opam2:debian-9 currently has ocaml version 4.07.0)
  image: ocaml/opam2:debian-9-ocaml-4.06
  script:
    # Install required packages
    - sudo apt-get update -qq && sudo apt-get install -y -qq build-essential libgmp-dev libpcre3-dev pkg-config m4 libssl-dev libsqlite3-dev wget ca-certificates unzip aspcud libncurses-dev uuid-runtime zlib1g-dev
    # Install the same Opam packages that opam-bootstrap.sh installs
    - eval `grep "opam install" ./opam-bootstrap.sh`
    # Compile belenios
    - BELENIOS_DEBUG=1 make all
    # Create a bundled version of belenios (this produces a belenios.tar.gz file, which is needed by the web server)
    - make archive
    # Start belenios web server
    - ./demo/run-server.sh &
    # Access the localhost web page, print page output for debug purposes, and check validity of page output
    - first_access_index_page_output=$(wget --retry-connrefused --no-check-certificate -T 30 http://localhost:8001 -O-)
    - echo $first_access_index_page_output
    - if [ "$(echo \"$first_access_index_page_output\" | grep '>Belenios</a>' | wc -l)" != "1" ]; then echo "[First page access] First page access does not show a single '>Belenios</a>' text, but it should" && exit 1; else echo "[First page access] First page access shows a single '>Belenios</a>' text, as expected"; fi
    # Run a test of an election
    # - BELENIOS_DEBUG=1 make check
47

48 49
build_and_run_automated_test_scenarios_with_preinstalled_image:
  stage: build_and_run_automated_test_scenarios_with_preinstalled_image
50 51
  # Image glondu/beleniosbase-tests:YYYYMMDD-N is built by Dockerfile_test_scenario_environment
  image: glondu/beleniosbase-tests:20181206-2
52
  script:
53 54
    # Initialize environment
    - source ~/env.sh
55 56 57 58 59 60 61 62 63 64 65 66
    # Compile belenios
    - BELENIOS_DEBUG=1 make all
    # Create a bundled version of belenios (this produces a belenios.tar.gz file, which is needed by the web server)
    - make archive
    # We don't need to start belenios web server, as it will be started by the automated test
    # - ./demo/run-server.sh &
    # Create a Python 3 virtual environment, where pip packages will be installed
    - python3 -m venv venv
    # Step into this new virtual environment
    - source venv/bin/activate
    # Install pip packages
    - pip install -r requirements.txt
67 68
    # Run the automated test scenario 4
    - python3 ./tests/test_scenario_4.py
69 70
    # Run the automated test scenario 2
    - python3 ./tests/test_scenario_2.py
71 72
    # Run the automated test scenario 1
    - python3 ./tests/test_scenario_1.py