Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/scripts/check-documentation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Fail CI when generated documentation artifacts are empty or contain bytecode."""
from pathlib import Path
from zipfile import ZipFile

for classifier, suffix in (("javadoc", ".html"), ("sources", ".java")):
archives = sorted(Path("build/libs").glob(f"*-{classifier}.jar"))
if len(archives) != 1:
raise SystemExit(f"Expected one {classifier} JAR, found {len(archives)}")
with ZipFile(archives[0]) as archive:
names = [entry.filename for entry in archive.infolist() if not entry.is_dir()]
content = sum(name.endswith(suffix) for name in names)
bytecode = sum(name.endswith(".class") for name in names)
if content == 0 or bytecode != 0:
raise SystemExit(
f"{archives[0]}: expected {suffix} entries > 0 and .class entries = 0; "
f"found {content} and {bytecode}"
)
print(f"{archives[0]}: {suffix}={content}, .class={bytecode}")
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
verify:
name: Java 11 tests and documentation
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6
with:
distribution: temurin
java-version: '11'
- name: Test and build documentation with the pinned Wrapper
run: bash ./gradlew --no-daemon --console=plain clean test javadocJar sourcesJar
- name: Verify documentation archive contents
run: python3 .github/scripts/check-documentation.py
- name: Preserve test reports and documentation
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: java-11-verification
retention-days: 14
path: |
build/test-results/test/
build/reports/tests/test/
build/libs/*-javadoc.jar
build/libs/*-sources.jar
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.com/lambig/Patterns.svg?branch=main)](https://travis-ci.com/lambig/Patterns)
[![CI](https://github.com/lambig/Patterns/actions/workflows/ci.yml/badge.svg)](https://github.com/lambig/Patterns/actions/workflows/ci.yml)
# Patterns
easy implementation of pattern-matcher works as a function
Note: this README is written through the help of ChatGPT.
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ tasks.withType(JavaCompile).configureEach {
}

tasks.register('javadocJar', Jar) {
dependsOn classes
dependsOn javadoc
archiveClassifier.set('javadoc')
from sourceSets.main.output
from javadoc.destinationDir
}

tasks.register('sourcesJar', Jar) {
Expand Down Expand Up @@ -101,4 +101,4 @@ publishing {
signing {
sign publishing.publications.mavenJava
}
}
}
Loading