-
Notifications
You must be signed in to change notification settings - Fork 94
154 lines (128 loc) · 3.7 KB
/
build-test.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: build-test
on:
push:
branches: [ '*' ]
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
pull_request:
branches: [ 'main' ]
jobs:
build:
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: 'gradle'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute Gradle build
run: ./gradlew build
- name: Build executable jar file
run: ./gradlew shadowJar
- name: Generate autocomplete script
run: |
cd build/libs
java -cp crowdin-cli-*.jar picocli.AutoComplete com.crowdin.cli.commands.picocli.RootCommand
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
build/libs/crowdin-cli-*.jar
build/libs/crowdin_completion
test:
needs: build
strategy:
matrix:
os: [ ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: 'gradle'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Run Tests
run: ./gradlew test
- name: Test Report
uses: dorny/test-reporter@v1
if: ${{ (success() || failure()) && github.ref == 'refs/heads/main' }}
with:
name: Test results ${{ matrix.os }}
path: build/test-results/test/*.xml
reporter: java-junit
- name: Generate code coverage report
if: matrix.os == 'ubuntu-latest'
run: ./gradlew build jacocoTestReport
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
docs-test:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: 'gradle'
- name: Install asciidoctor and pandoc
run: |
sudo apt install -y asciidoctor
wget https://github.com/jgm/pandoc/releases/download/3.1.2/pandoc-3.1.2-1-amd64.deb
sudo dpkg -i pandoc-3.1.2-1-amd64.deb
- name: Generate Docs
run: |
chmod +x prepare-docs.sh
./prepare-docs.sh
shell: bash
- name: Install dependencies
working-directory: website
run: npm ci
- name: Build Website
working-directory: website
run: npm run build
publish-test:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: 'gradle'
- name: Prepare distribution
run: |
./gradlew shadowJar
mkdir dist
mv build/libs/crowdin-cli-*.jar dist/crowdin-cli.jar
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install the latest version of the npm CLI
run: npm install -g npm@latest
- name: Build and install the package
run: |
sudo npm install --location=global [email protected]
npm install
jdeploy install
- name: Test crowdin command
run: crowdin -V