WSL/SLF GitLab Repository

.gitlab-ci.yml 4.6 KB
Newer Older
buergiss's avatar
buergiss committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
default:
  image: gcc # official gcc image, based on debian, see https://hub.docker.com/_/gcc/
  tags: ['docker']
  before_script:
  - apt-get update && apt-get -y install cmake qttools5-dev-tools qttools5-dev

stages:
  - build
  - test
  - release build
  - release

build:
  stage: build
  script:
    - cmake -S . -B . -D DEST:STRING=safe -D USE_LTO_OPTIMIZATIONS:BOOL=OFF -D CPACK_BUNDLE_ALL:BOOL=ON -D CMAKE_BUILD_TYPE:STRING=coverage
    - make -j 2
  artifacts:
    expire_in: 1h
    paths:
      - bin/inishell

test:
  stage: test
  script:
    # Simulate display
    - apt-get install -y xvfb
    - Xvfb :1 -screen 0 1024x768x16 &> xvfb.log  &
    - export DISPLAY=:1.0
    # Run tests
    - cd tests
    - ./run_tests.sh

Debian release build:
  stage: release build
  rules:
    - if: $CI_COMMIT_TAG # Run this job when a tag is created manually
  dependencies: []
  script:
    - export INISHELL_VERSION=${CI_COMMIT_TAG#*-}
    - export VERSION_MAJOR=`echo $INISHELL_VERSION | cut -d. -f1`
    - export VERSION_MINOR=`echo $INISHELL_VERSION | cut -d. -f2`
    - export VERSION_PATCH=`echo $INISHELL_VERSION | cut -d. -f3`
    - echo VERSION_MAJOR=$VERSION_MAJOR - VERSION_MINOR=$VERSION_MINOR - VERSION_PATCH=$VERSION_PATCH
    - cmake -S . -B . -D DEST:STRING=safe -D USE_LTO_OPTIMIZATIONS:BOOL=ON -D CPACK_BUNDLE_ALL:BOOL=ON -D CMAKE_BUILD_TYPE:STRING=release -D CPACK_GENERATOR:STRING="DEB;TGZ"
    - make -j 2
    - cpack
  artifacts:
    expire_in: 1h
    paths:
      - Inishell-${CI_COMMIT_TAG#*-}-x86_64.tar.gz
      - Inishell-${CI_COMMIT_TAG#*-}-x86_64.deb

Fedora release build:
  stage: release build
  image: fedora
  rules:
    - if: $CI_COMMIT_TAG # Run this job when a tag is created manually
  dependencies: []
  before_script:
    - yum -y install make gcc g++ cmake rpm-build qt5-qttools-devel
  script:
    - echo "%__os_install_post %{nil}" > ~/.rpmmacros # Turn off binary stripping for rpm
    - export INISHELL_VERSION=${CI_COMMIT_TAG#*-}
    - export VERSION_MAJOR=`echo $INISHELL_VERSION | cut -d. -f1`
    - export VERSION_MINOR=`echo $INISHELL_VERSION | cut -d. -f2`
    - export VERSION_PATCH=`echo $INISHELL_VERSION | cut -d. -f3`
    - echo VERSION_MAJOR=$VERSION_MAJOR - VERSION_MINOR=$VERSION_MINOR - VERSION_PATCH=$VERSION_PATCH
    - cmake -S . -B . -D DEST:STRING=safe -D USE_LTO_OPTIMIZATIONS:BOOL=ON -D CPACK_BUNDLE_ALL:BOOL=ON -D CMAKE_BUILD_TYPE:STRING=release -D CPACK_GENERATOR:STRING="RPM"
    - make -j 2
    - cpack
  artifacts:
    expire_in: 1h
    paths:
      - Inishell-${CI_COMMIT_TAG#*-}-x86_64.rpm

release:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  before_script: # overrides global before_script
    - apk add --no-cache curl
  rules:
    - if: $CI_COMMIT_TAG # Run this job when a tag is created manually
  dependencies:
    - Debian release build
    - Fedora release build
  script:
    - export INISHELL_VERSION=${CI_COMMIT_TAG#*-}
    - echo "Uploading Inishell-${INISHELL_VERSION} packages to
      ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/inishell/${INISHELL_VERSION}/Inishell-${INISHELL_VERSION}-*"
    - 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file Inishell-${INISHELL_VERSION}-x86_64.tar.gz
      "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/inishell/${INISHELL_VERSION}/Inishell-${INISHELL_VERSION}-x86_64.tar.gz"'
    - 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file Inishell-${INISHELL_VERSION}-x86_64.rpm
      "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/inishell/${INISHELL_VERSION}/Inishell-${INISHELL_VERSION}-x86_64.rpm"'
    - 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file Inishell-${INISHELL_VERSION}-x86_64.deb
      "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/inishell/${INISHELL_VERSION}/Inishell-${INISHELL_VERSION}-x86_64.deb"'
  release:
    name: 'Release $CI_COMMIT_TAG'
    description: 'Created using GitLab CI/CD'
    tag_name: '$CI_COMMIT_TAG'
    ref: '$CI_COMMIT_TAG'
    assets:
      links:
        - name: 'Linux Debian binary tarball'
          url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/inishell/${CI_COMMIT_TAG#*-}/Inishell-${CI_COMMIT_TAG#*-}-x86_64.tar.gz'
          link_type: 'other'
        - name: 'Linux Fedora RPM binary package'
          url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/inishell/${CI_COMMIT_TAG#*-}/Inishell-${CI_COMMIT_TAG#*-}-x86_64.rpm'
          link_type: 'other'
        - name: 'Linux Debian DEB binary package'
          url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/inishell/${CI_COMMIT_TAG#*-}/Inishell-${CI_COMMIT_TAG#*-}-x86_64.deb'
          link_type: 'other'