aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: 2778de79ec8dbeaea98727475bf8804dc6312063 (plain)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
name: CI

# All builds use lhelper only for releases,
# otherwise for normal builds dependencies are dynamically linked.

on:
  push:
    branches:
    - '*'
#   tags:
#   - 'v[0-9]*'
  pull_request:
    branches:
    - '*'

jobs:
  archive_source_code:
    name: Source Code Tarball
    runs-on: ubuntu-18.04
    # Only on tags/releases
    if: startsWith(github.ref, 'refs/tags/')
    steps:
    - uses: actions/checkout@v2
    - name: Python Setup
      uses: actions/setup-python@v2
      with:
        python-version: 3.6
    - name: Install Dependencies
      run: |
        sudo apt-get install -qq ninja-build
        pip3 install meson
    - name: Package
      shell: bash
      run: bash scripts/package.sh --version ${GITHUB_REF##*/} --debug --source
    - uses: actions/upload-artifact@v2
      with:
        name: Source Code Tarball
        path: "lite-xl-*-src.tar.gz"

  build_linux:
    name: Linux
    runs-on: ubuntu-18.04
    strategy:
      matrix:
        config:
        - { name: "GCC", cc: gcc, cxx: g++ }
        - { name: "clang", cc: clang, cxx: clang++ }
    env:
      CC: ${{ matrix.config.cc }}
      CXX: ${{ matrix.config.cxx }}
    steps:
    - name: Set Environment Variables
      if: ${{ matrix.config.cc == 'gcc' }}
      run: |
        echo "$HOME/.local/bin" >> "$GITHUB_PATH"
        echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
        echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-linux-$(uname -m)" >> "$GITHUB_ENV"
    - uses: actions/checkout@v2
    - name: Python Setup
      uses: actions/setup-python@v2
      with:
        python-version: 3.6
    - name: Update Packages
      run: sudo apt-get update
    - name: Install Dependencies
      if: ${{ !startsWith(github.ref, 'refs/tags/') }}
      run: bash scripts/install-dependencies.sh --debug
    - name: Install Release Dependencies
      if: ${{ startsWith(github.ref, 'refs/tags/') }}
      run: |
        bash scripts/install-dependencies.sh --debug --lhelper
        bash scripts/lhelper.sh --debug
    - name: Build
      run: |
        bash --version
        bash scripts/build.sh --debug --forcefallback
    - name: Package
      if: ${{ matrix.config.cc == 'gcc' }}
      run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary
    - name: AppImage
      if: ${{ matrix.config.cc == 'gcc' && startsWith(github.ref, 'refs/tags/') }}
      run: bash scripts/appimage.sh --nobuild --version ${INSTALL_REF}
    - name: Upload Artifacts
      uses: actions/upload-artifact@v2
      if: ${{ matrix.config.cc == 'gcc' }}
      with:
        name: Linux Artifacts
        path: |
          ${{ env.INSTALL_NAME }}.tar.gz
          LiteXL-${{ env.INSTALL_REF }}-x86_64.AppImage

  build_macos:
    name: macOS (x86_64)
    runs-on: macos-10.15
    env:
      CC: clang
      CXX: clang++
    steps:
    - name: System Information
      run: |
        system_profiler SPSoftwareDataType
        bash --version
        gcc -v
        xcodebuild -version
    - name: Set Environment Variables
      run: |
        echo "$HOME/.local/bin" >> "$GITHUB_PATH"
        echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
        echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-$(uname -m)" >> "$GITHUB_ENV"
    - uses: actions/checkout@v2
    - name: Python Setup
      uses: actions/setup-python@v2
      with:
        python-version: 3.9
    - name: Install Dependencies
      if: ${{ !startsWith(github.ref, 'refs/tags/') }}
      run: bash scripts/install-dependencies.sh --debug
    - name: Install Release Dependencies
      if: ${{ startsWith(github.ref, 'refs/tags/') }}
      run: |
        bash scripts/install-dependencies.sh --debug --lhelper
        bash scripts/lhelper.sh --debug
    - name: Build
      run: |
        bash --version
        bash scripts/build.sh --bundle --debug --forcefallback
    - name: Error Logs
      if: failure()
      run: |
        mkdir ${INSTALL_NAME}
        cp /usr/var/lhenv/lite-xl/logs/* ${INSTALL_NAME}
        tar czvf ${INSTALL_NAME}.tar.gz ${INSTALL_NAME}
#   - name: Package
#     if: ${{ !startsWith(github.ref, 'refs/tags/') }}
#     run:  bash scripts/package.sh --version ${INSTALL_REF} --debug --addons
    - name: Create DMG Image
      run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --dmg
    - name: Upload DMG Image
      uses: actions/upload-artifact@v2
      with:
        name: macOS DMG Image
        path: ${{ env.INSTALL_NAME }}.dmg
    - name: Upload Error Logs
      uses: actions/upload-artifact@v2
      if: failure()
      with:
        name: Error Logs
        path: ${{ env.INSTALL_NAME }}.tar.gz

  build_windows_msys2:
    name: Windows
    runs-on: windows-2019
    strategy:
      matrix:
        msystem: [MINGW32, MINGW64]
    defaults:
      run:
        shell: msys2 {0}
    steps:
    - uses: actions/checkout@v2
    - uses: msys2/setup-msys2@v2
      with:
        #msystem: MINGW64
        msystem: ${{ matrix.msystem }}
        update: true
        install: >-
          base-devel
          git
          zip
    - name: Set Environment Variables
      run: |
        echo "$HOME/.local/bin" >> "$GITHUB_PATH"
        echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-windows-$(uname -m)" >> "$GITHUB_ENV"
        echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
    - name: Install Dependencies
      if: ${{ !startsWith(github.ref, 'refs/tags/') }}
      run: bash scripts/install-dependencies.sh --debug
    - name: Install Release Dependencies
      if: ${{ startsWith(github.ref, 'refs/tags/') }}
      run: bash scripts/install-dependencies.sh --debug --lhelper
    - name: Build
      run: |
        bash --version
        bash scripts/build.sh --debug --forcefallback
    - name: Error Logs
      if: failure()
      run: |
        mkdir ${INSTALL_NAME}
        cp /usr/var/lhenv/lite-xl/logs/* ${INSTALL_NAME}
        tar czvf ${INSTALL_NAME}.tar.gz ${INSTALL_NAME}
    - name: Package
      run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary
    - name: Build Installer
      if: ${{ startsWith(github.ref, 'refs/tags/') }}
      run: bash scripts/innosetup/innosetup.sh --debug
    - name: Upload Artifacts
      uses: actions/upload-artifact@v2
      with:
        name: Windows Artifacts
        path: |
          LiteXL*.exe
          ${{ env.INSTALL_NAME }}.zip
    - name: Upload Error Logs
      uses: actions/upload-artifact@v2
      if: failure()
      with:
        name: Error Logs
        path: ${{ env.INSTALL_NAME }}.tar.gz

  deploy:
    name: Deployment
    runs-on: ubuntu-18.04
#   if: startsWith(github.ref, 'refs/tags/')
    if: false
    needs:
    - archive_source_code
    - build_linux
    - build_macos
    - build_windows_msys2
    steps:
    - name: Set Environment Variables
      run: echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
    - uses: actions/download-artifact@v2
      with:
        name: Linux Artifacts
    - uses: actions/download-artifact@v2
      with:
        name: macOS DMG Image
    - uses: actions/download-artifact@v2
      with:
        name: Source Code Tarball
    - uses: actions/download-artifact@v2
      with:
        name: Windows Artifacts
    - name: Display File Information
      shell: bash
      run: ls -lR
    # Note: not using `actions/create-release@v1`
    #       because it cannot update an existing release
    #       see https://github.com/actions/create-release/issues/29
    - uses: softprops/action-gh-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ env.INSTALL_REF }}
        name: Release ${{ env.INSTALL_REF }}
        draft: false
        prerelease: false
        files: |
          lite-xl-${{ env.INSTALL_REF }}-*
          LiteXL*.AppImage
          LiteXL*.exe