.gitlab-ci.yml 2.37 KB
Newer Older
1
stages:
Nigel Kukard's avatar
Nigel Kukard committed
2
  - quality
Nigel Kukard's avatar
Nigel Kukard committed
3
  - tests
Nigel Kukard's avatar
Nigel Kukard committed
4
  - install
5

Nigel Kukard's avatar
Nigel Kukard committed
6 7


Nigel Kukard's avatar
Nigel Kukard committed
8
code-quality:
Nigel Kukard's avatar
Nigel Kukard committed
9
  stage: quality
10
  script:
Nigel Kukard's avatar
Nigel Kukard committed
11
    - export DEBIAN_FRONTEND=noninteractive
12 13
    - apt-get update
    - apt-get dist-upgrade -y
Nigel Kukard's avatar
Nigel Kukard committed
14 15 16
    - apt-get install -y perl-modules
    - apt-get install -y make
    - apt-get install -y libperl-critic-perl
17
    - perlcritic --gentle "$CI_PROJECT_DIR"
18

Nigel Kukard's avatar
Nigel Kukard committed
19 20


Nigel Kukard's avatar
Nigel Kukard committed
21
make-test:
Nigel Kukard's avatar
Nigel Kukard committed
22
  stage: tests
Nigel Kukard's avatar
Nigel Kukard committed
23
  script:
Nigel Kukard's avatar
Nigel Kukard committed
24
    - export DEBIAN_FRONTEND=noninteractive
Nigel Kukard's avatar
Nigel Kukard committed
25 26
    - apt-get update
    - apt-get dist-upgrade -y
Nigel Kukard's avatar
Nigel Kukard committed
27
    - apt-get install -y git make
28
    - apt-get install -y libdevel-cover-perl libpod-coverage-perl libtest-most-perl
Nigel Kukard's avatar
Nigel Kukard committed
29
    - apt-get install -y libnet-server-perl libconfig-inifiles-perl libdatetime-perl libcache-fastmmap-perl libtimedate-perl
Nigel Kukard's avatar
Nigel Kukard committed
30
      libcrypt-des-perl libcrypt-rc4-perl libdigest-sha-perl libdigest-md4-perl libmime-lite-perl
Nigel Kukard's avatar
Nigel Kukard committed
31
    - apt-get install -y mysql-server
Nigel Kukard's avatar
Nigel Kukard committed
32 33 34 35 36 37

    # Start services and create dirs we need
    - service mysql start
    - mkdir /var/run/smradius

    # Update our dependencies
Nigel Kukard's avatar
Nigel Kukard committed
38 39
    - cd "$CI_PROJECT_DIR"
    - ./update-git-modules
Nigel Kukard's avatar
Nigel Kukard committed
40
    - perl -MCPAN -e 'install Math::Expression' < /dev/null
Nigel Kukard's avatar
Nigel Kukard committed
41

42 43 44 45
    # Build Makefile and make
    - perl Makefile.PL
    - make

Nigel Kukard's avatar
Nigel Kukard committed
46
    # Convert DB into MySQL
Nigel Kukard's avatar
Nigel Kukard committed
47 48 49
    - blib/script/convert-tsql MySQL database/core.tsql > database/core.mysql
    - blib/script/convert-tsql MySQL database/users-accounting-summary.tsql > database/users-accounting-summary.mysql
    - blib/script/convert-tsql MySQL database/wisp.tsql > database/wisp.mysql
Nigel Kukard's avatar
Nigel Kukard committed
50 51 52 53 54 55 56 57 58 59 60

    # Load SQL into DB
    - echo "CREATE DATABASE smradiustest;" | mysql -u root
    - mysql -u root smradiustest < database/core.mysql
    - mysql -u root smradiustest < database/users-accounting-summary.mysql
    - mysql -u root smradiustest < database/wisp.mysql

    # Sort out config file
    - cp smradiusd.conf smradiusd.conf.test
    - perl -pi -e 's/database=smradius/database=smradiustest/' smradiusd.conf.test

Nigel Kukard's avatar
Nigel Kukard committed
61 62
    # Run tests, exclude all but smradius
    - DBTESTS=1 cover -test -ignore_re '.*' -select_re '^blib\/lib\/smradius\/' | tee devel-coverage.txt
Nigel Kukard's avatar
Nigel Kukard committed
63
    - grep "^Total" devel-coverage.txt | awk '{ print "(" $8 "%) covered" }'
Nigel Kukard's avatar
Nigel Kukard committed
64

Nigel Kukard's avatar
Nigel Kukard committed
65 66


Nigel Kukard's avatar
Nigel Kukard committed
67 68 69 70 71 72 73 74 75 76 77 78 79
make-install:
  stage: install
  script:
    - export DEBIAN_FRONTEND=noninteractive
    - apt-get update
    - apt-get dist-upgrade -y
    - apt-get install -y git make
    - apt-get install -y mysql-server
    - cd "$CI_PROJECT_DIR"
    - ./update-git-modules
    - perl Makefile.PL
    - make install