-
-
Notifications
You must be signed in to change notification settings - Fork 3
137 lines (106 loc) · 4.57 KB
/
ci.yml
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
# Copyright (C) 2019-2023 Julian Valentin, LTeX Development Community
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
name: "CI"
on:
push:
branches:
- "*"
tags:
- "*"
pull_request:
branches:
- "develop"
workflow_dispatch:
jobs:
build:
name: "CI - Build Job"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os:
- "ubuntu-latest"
- "macos-latest"
- "windows-latest"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- name: "Set up Java"
uses: "actions/setup-java@v4"
with:
java-version: "21"
distribution: "temurin"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.13"
- name: "Create Completion Lists"
run: "python -u tools/createCompletionLists.py"
- name: "Build LTeX LS"
run: "mvn -B -e verify"
validate:
name: "CI - Validate Job"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.13"
- name: "Install Python Dependencies"
run: "python -u -m pip install --upgrade pip && pip install xmlschema"
- name: "Validate .assembly.xml"
run: "python -u -c 'import xmlschema; xmlschema.XMLSchema(\"schemas/assembly-2.1.0.xsd\").validate(\".assembly.xml\")'"
- name: "Validate changelog.xml"
run: "python -u -c 'import xmlschema; xmlschema.XMLSchema(\"schemas/changes-1.0.0.xsd\").validate(\"changelog.xml\")'"
- name: "Validate pom.xml"
run: "python -u -c 'import xmlschema; xmlschema.XMLSchema(\"schemas/maven-4.0.0.xsd\").validate(\"pom.xml\")'"
- name: "Check Source Consistency"
run: "python -u tools/checkSourceConsistency.py"
deploy:
name: "CI - Deploy Job"
needs:
- "build"
- "validate"
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- name: "Set up Java"
uses: "actions/setup-java@v4"
with:
java-version: "21"
distribution: "temurin"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.13"
- name: "Install Python Dependencies"
run: "python -u -m pip install --upgrade pip && pip install semver"
- name: "Set LTEX_LS_VERSION"
run: "echo \"LTEX_LS_VERSION=$(python -u -c \"import re; print(re.search(r'<version>(.*?)</version>', open('pom.xml', 'r').read()).group(1), end='')\")\" >> $GITHUB_ENV"
- name: "Check LTEX_LS_VERSION"
run: "if [[ -z \"$LTEX_LS_VERSION\" ]]; then echo 'Error: LTEX_LS_VERSION not set!'; (exit 1); fi; echo \"LTEX_LS_VERSION set to '$LTEX_LS_VERSION'\""
- name: "Set LTEX_LS_IS_PRERELEASE"
run: "if [[ -z \"$LTEX_LS_VERSION\" ]]; then echo 'Error: LTEX_LS_VERSION not set!'; (exit 1); fi; echo \"LTEX_LS_IS_PRERELEASE=$(python -u -c \"import semver; print('true' if semver.VersionInfo.parse('$LTEX_LS_VERSION').prerelease is not None else 'false', end='')\")\" >> $GITHUB_ENV"
- name: "Check LTEX_LS_IS_PRERELEASE"
run: "if [[ -z \"$LTEX_LS_IS_PRERELEASE\" ]]; then echo 'Error: LTEX_LS_IS_PRERELEASE not set!'; (exit 1); fi; echo \"LTEX_LS_IS_PRERELEASE set to '$LTEX_LS_IS_PRERELEASE'\""
- name: "Set LTEX_LS_CHANGELOG"
run: "if [ \"$LTEX_LS_IS_PRERELEASE\" = \"false\" ]; then echo \"LTEX_LS_CHANGELOG<<EOF\" >> $GITHUB_ENV; python -u tools/convertChangelog.py --xml-file changelog.xml --version latest >> $GITHUB_ENV; echo \"EOF\" >> $GITHUB_ENV; else echo \"LTEX_LS_CHANGELOG=This is a pre-release. Use at your own risk.\" >> $GITHUB_ENV; fi"
- name: "Create Completion Lists"
run: "python -u tools/createCompletionLists.py"
- name: "Build LTeX LS"
run: "mvn -B -e package"
- name: "Create Binary Archives"
run: "python -u tools/createBinaryArchives.py"
- name: "Create GitHub Release"
uses: "softprops/[email protected]"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: "${{ env.LTEX_LS_IS_PRERELEASE }}"
body: "${{ env.LTEX_LS_CHANGELOG }}"
files: "target/ltex-ls-plus-${{ env.LTEX_LS_VERSION }}*.@(tar.gz|zip)"