diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..d42ef6c --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,47 @@ +name: Build and Test + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build --no-daemon + + - name: Run tests + run: ./gradlew test --no-daemon + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + if: success() + with: + name: lochat-plugin + path: build/libs/*.jar + retention-days: 30 + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: always() + with: + name: test-results + path: build/reports/tests/ + retention-days: 7 diff --git a/.forgejo/workflows/quality.yml b/.forgejo/workflows/quality.yml new file mode 100644 index 0000000..faf688f --- /dev/null +++ b/.forgejo/workflows/quality.yml @@ -0,0 +1,39 @@ +name: Code Quality + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + +jobs: + quality: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Check code style + run: ./gradlew check --no-daemon + + - name: Run tests with coverage + run: ./gradlew test jacocoTestReport --no-daemon + + - name: Upload coverage reports + uses: actions/upload-artifact@v4 + if: always() + with: + name: coverage-reports + path: build/reports/jacoco/ + retention-days: 7 diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..9dbfe33 --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build release + run: ./gradlew build -x test --no-daemon + + - name: Get version from tag + id: get_version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: Create Release + uses: actions/forgejo-release@v2 + with: + direction: upload + release-dir: build/libs + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }}