summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yaml
blob: 16e4b505b278c01dba90ccce8c6c7f4804e646b3 (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
name: CI

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
  workflow_dispatch:

jobs:
  build_plugin:
    runs-on: ubuntu-24.04
    permissions:
      contents: read
      pull-requests: write
      issues: write
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Setup Development Environment
        uses: jdx/mise-action@v4

      - name: Setup Gradle
        uses: gradle/actions/setup-gradle@v6

      - name: Check ktlint
        run: ./gradlew ktlintCheck --no-daemon

      - name: Run tests
        run: ./gradlew test jacocoTestReport --no-daemon

      - name: Upload coverage to Codecov
        if: always()
        uses: codecov/codecov-action@v6
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: |
            engine/build/reports/jacoco/test/jacocoTestReport.xml,
            platform-paper/build/reports/jacoco/test/jacocoTestReport.xml,
            platform-velocity/build/reports/jacoco/test/jacocoTestReport.xml
          fail_ci_if_error: false

      - name: Build with shadowJar
        run: ./gradlew :platform-paper:shadowJar :platform-velocity:shadowJar -PisNightly=true --parallel --no-daemon

      - name: Upload build artifacts
        uses: actions/upload-artifact@v7
        if: success()
        with:
          name: LunaticChat-${{ github.sha }}
          path: |
            platform-paper/build/libs/LunaticChat-*.jar
            platform-velocity/build/libs/LunaticChat-*-velocity.jar
          retention-days: 7

  build_dokka:
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Setup Development Environment
        uses: jdx/mise-action@v4

      - name: Setup Gradle
        uses: gradle/actions/setup-gradle@v6

      - name: Generate Dokka
        run: ./gradlew :dokka:dokkaGenerate --no-daemon

      - name: Upload Pages artifact
        if: github.event_name == 'push' && github.ref == 'refs/heads/main'
        uses: actions/upload-pages-artifact@v4
        with:
          path: dokka/build/dokka/html

  deploy_dokka:
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    needs: build_dokka
    runs-on: ubuntu-24.04
    permissions:
      pages: write
      id-token: write
    concurrency:
      group: "pages"
      cancel-in-progress: false
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v5

  build_docs:
    runs-on: ubuntu-24.04
    defaults:
      run:
        working-directory: "./website"
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Setup Development Environment
        uses: jdx/mise-action@v4
        with:
          working_directory: .

      - name: Install dependencies
        run: bun install

      - name: Check formats
        run: bun run format:check

      - name: Check lints
        run: bun run lint

      - name: Run tests
        run: bun run test

      - name: Build documentation
        run: bun run build

      - name: Deploy to Cloudflare Workers
        if: github.event_name == 'push' && github.ref == 'refs/heads/main'
        uses: cloudflare/wrangler-action@v3
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          workingDirectory: website