-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (138 loc) · 4.62 KB
/
pipeline.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
name: CI/CD Pipeline
on:
pull_request:
branches:
- develop
- main
push:
branches:
- develop
- main
workflow_dispatch:
permissions:
contents: write
jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: set-matrix
run: |
# Fetch specific commits to ensure they are available for the diff operation
git fetch --depth=1 origin ${{ github.event.before }}:${{ github.event.before }}
git fetch --depth=1 origin ${{ github.event.after }}:${{ github.event.after }}
# Determine which directories have changed
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
MATRIX="{\"include\": ["
if echo "$CHANGED_FILES" | grep -q 'appleMain/'; then
MATRIX+="{\"os\":\"macos-latest\", \"files\":\"appleMain/\"},"
fi
if echo "$CHANGED_FILES" | grep -q 'nativeMain/'; then
MATRIX+="{\"os\":\"windows-latest\", \"files\":\"nativeMain/\"},"
fi
MATRIX+="{\"os\":\"ubuntu-latest\", \"files\":\"always\"}"
MATRIX+="]}"
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
build-and-test:
needs: prepare-matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install Linux-specific Dependencies
if: matrix.os == 'ubuntu-latest'
continue-on-error: true
run: sudo apt-get update && sudo apt-get install -y wget unzip
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
cmdline-tools-version: 11076708
log-accepted-android-sdk-licenses: false
packages: "platform-tools platforms;android-34 build-tools;34.0.0"
- name: Setup Xcode
if: matrix.os == 'macos-latest'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '13.1.0'
- name: Clear npm and Yarn cache
run: |
npm cache clean --force
yarn cache clean
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
/usr/local/android-sdk/build-tools
/usr/local/android-sdk/platforms
/usr/local/android-sdk/licenses
~/.konan/cache
key: ${{ runner.os }}-dependencies-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}-20240320
restore-keys: |
${{ runner.os }}-dependencies-
- name: Grant Execute Permission for Scripts
run: chmod +x ./gradlew
- name: Run Detekt for Code Quality Checks
run: ./gradlew detektAll
- name: Build Project
run: ./gradlew build
- name: Test Project
run: ./gradlew test
- name: Generate Documentation
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/main'
run: ./gradlew dokkaHtml
- name: Upload Documentation as Artifact
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/docs
publish-documentation:
needs: build-and-test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install mkdocs
pip install mkdocs-material
pip install pymdown-extensions
pip install mkdocs-minify-plugin
pip install mkdocs-git-revision-date-localized-plugin
- name: Download Documentation Artifact
uses: actions/download-artifact@v4
with:
name: documentation
path: docs/docs
- name: Build Website
run: |
pip install mkdocs-material mkdocs-macros-plugin
mkdocs build
- name: Deploy Documentation
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
BRANCH: gh-pages
FOLDER: site
SINGLE_COMMIT: true