diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 55d2318..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,129 +0,0 @@ -version: 2.1 - -orbs: - win: circleci/windows@1.0.0 - -workflows: - test: - jobs: - - build-linux - - test-linux: - name: Java 8 - Linux - OpenJDK - docker-image: cimg/openjdk:8.0 - requires: - - build-linux - - test-linux: - name: Java 11 - Linux - OpenJDK - docker-image: cimg/openjdk:11.0 - requires: - - build-linux - - test-linux: - name: Java 17 - Linux - OpenJDK - docker-image: cimg/openjdk:17.0 - with-coverage: true - requires: - - build-linux - - build-test-windows: - name: Java 11 - Windows - OpenJDK - openjdk-version: 11.0.2.01 - - build-test-windows: - name: Java 17 - Windows - OpenJDK - openjdk-version: 17.0.1 - -jobs: - build-linux: - docker: - - image: cimg/openjdk:8.0 - steps: - - checkout - - run: java -version - - run: ./gradlew dependencies - - run: ./gradlew jar - - run: ./gradlew checkstyleMain - - persist_to_workspace: - root: build - paths: - - classes - - test-linux: - parameters: - docker-image: - type: string - with-coverage: - type: boolean - default: false - check-javadoc: - type: boolean - default: false - docker: - - image: <> - steps: - - checkout - - attach_workspace: - at: build - - run: java -version - - run: make test - - when: - condition: <> - steps: - - run: - name: Generate test coverage report - command: | - ./gradlew jacocoTestReport - mkdir -p coverage/ - cp -r build/reports/jacoco/test/* ./coverage - - run: - name: Enforce test coverage - command: ./gradlew jacocoTestCoverageVerification - - run: - name: Save test results - command: | - mkdir -p ~/junit/; - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \; - when: always - - store_test_results: - path: ~/junit - - store_artifacts: - path: ~/junit - - - run: make build-contract-tests - - run: - command: make start-contract-test-service - background: true - - run: make run-contract-tests - - - when: - condition: <> - steps: - - store_artifacts: - path: coverage - - build-test-windows: - parameters: - openjdk-version: - type: string - executor: - name: win/vs2019 - shell: powershell.exe - steps: - - checkout - - run: - name: uninstall previous openjdk - command: choco uninstall openjdk - - run: - name: install OpenJDK - command: choco install openjdk --version <> - - run: java -version - - run: - name: build and test - command: | - .\gradlew.bat --no-daemon test # must use --no-daemon because CircleCI in Windows will hang if there's a daemon running - - run: - name: save test results - command: | - mkdir .\junit - cp build/test-results/test/*.xml junit - - store_test_results: - path: .\junit - - store_artifacts: - path: .\junit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..beaf543 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,92 @@ +name: Quality control checks + +on: + push: + branches: [ main, 'feat/**' ] + paths-ignore: + - '**.md' # Do not need to run CI for markdown changes. + pull_request: + branches: [ main, 'feat/**' ] + paths-ignore: + - '**.md' + +jobs: + linux: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + java-version: ["8", "11", "17"] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: ${{ matrix.java-version }} + + - run: ./gradlew dependencies + - run: ./gradlew jar + - run: ./gradlew checkstyleMain + + - run: make test + + - name: Generate test coverage report + run: | + ./gradlew jacocoTestReport + mkdir -p coverage/ + cp -r build/reports/jacoco/test/* ./coverage + - name: Enforce test coverage + run: ./gradlew jacocoTestCoverageVerification + + - name: Save test results + run: | + mkdir -p ~/junit/; + find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \; + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.java-version }} junit results + path: ~/junit + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.java-version }} code coverage + path: ./coverage + + - name: run contract tests + run: make contract-tests + + windows: + runs-on: windows-latest + + defaults: + run: + shell: powershell + + strategy: + fail-fast: false + matrix: + java-version: ["11.0.2.01", "17.0.1"] + + steps: + - uses: actions/checkout@v4 + + - name: install OpenJDK + run: choco install openjdk --version ${{ matrix.java-version }} + + - run: java -version + + - name: build and test + run: .\gradlew.bat --no-daemon test + + - name: save test results + run: | + mkdir .\junit + cp build/test-results/test/*.xml junit + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.java-version }} junit results + path: .\junit diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0bd3057..4ad482d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,7 +51,7 @@ This version of the library is used by the LaunchDarkly server-side Java SDK, wh It is important to keep unit test coverage as close to 100% as possible in this project. -You can view the latest code coverage report in CircleCI, as `coverage/html/index.html` in the artifacts for the "Java 11 - Linux - OpenJDK" job. You can also run the report locally with `./gradlew jacocoTestCoverage` and view `./build/reports/jacoco/test`. +You can view the latest code coverage report through GitHub actions. You can also run the report locally with `./gradlew jacocoTestCoverage` and view `./build/reports/jacoco/test`. Sometimes a gap in coverage is unavoidable, usually because the compiler requires us to provide a code path for some condition that in practice can't happen and can't be tested, or because of a known issue with the code coverage tool. Please handle all such cases as follows: diff --git a/README.md b/README.md index 4523b23..7846633 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # okhttp-eventsource -[![Circle CI](https://circleci.com/gh/launchdarkly/okhttp-eventsource.svg?style=shield)](https://circleci.com/gh/launchdarkly/okhttp-eventsource) +[![Actions Status](https://github.com/launchdarkly/okhttp-eventsource/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/launchdarkly/okhttp-eventsource/actions/workflows/ci.yml) [![Javadocs](http://javadoc.io/badge/com.launchdarkly/okhttp-eventsource.svg)](http://javadoc.io/doc/com.launchdarkly/okhttp-eventsource) ## Overview