Skip to content

Update kotlin monorepo to v2.1.0 #98

Update kotlin monorepo to v2.1.0

Update kotlin monorepo to v2.1.0 #98

Workflow file for this run

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