Skip to content
Open
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
19 changes: 13 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,29 @@ on:
push:
branches: [ master, main ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java-version: [ 8, 9, 10, 11, 17, 18 ]
java-version: [ 8, 11, 17 ]

steps:
- uses: actions/checkout@v2.3.1
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2.3.1
uses: actions/setup-java@v4
with:
java-version: "${{ matrix.java-version }}"
distribution: "adopt-openj9"
distribution: "temurin"
- name: Build & Test
run: ./gradlew jacocoTestReport test
- name: Code coverage
run: bash <(curl -s https://codecov.io/bash)
if: ${{ matrix.java-version == 17 }}
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
73 changes: 22 additions & 51 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare tag
Expand All @@ -26,78 +26,49 @@ jobs:
id: release_output
if: ${{ steps.prepare_tag.outcome == 'success' }}
run: |
echo "::set-output name=tag::${{ env.TAG }}"
echo "tag=${{ env.TAG }}" >> $GITHUB_OUTPUT
outputs:
tag: ${{ steps.release_output.outputs.tag }}

create-github-release:
publish:
runs-on: ubuntu-latest
needs: check-release-tag
if: ${{ needs.check-release-tag.outputs.tag }}
steps:
- uses: actions/checkout@v2
- name: Prepare tag
run: |
export TAG=v$(awk '/^version = / { gsub("\"", ""); print $3 }' build.gradle)
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Setup git
run: |
git config user.email "pusher-ci@pusher.com"
git config user.name "Pusher CI"
- name: Prepare description
run: |
csplit -s CHANGELOG.md "/##/" {1}
cat xx01 > CHANGELOG.tmp
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
tag_name: ${{ env.TAG }}
release_name: ${{ env.TAG }}
body_path: CHANGELOG.tmp
draft: false
prerelease: false

publish:
runs-on: ubuntu-latest
needs: create-github-release
steps:
- uses: actions/checkout@v2
java-version: "17"
distribution: "temurin"
- name: Create gradle.properties
shell: bash
run: |
mkdir -p _gradle_user_home
echo "GRADLE_USER_HOME=_gradle_user_home" >> $GITHUB_ENV
cat <<FILE > _gradle_user_home/gradle.properties
github.username=${{ secrets.PUSHER_CI_GITHUB_PRIVATE_TOKEN }}
github.password=""
maven.username=${{ secrets.MAVEN_USERNAME }}
maven.password=${{ secrets.MAVEN_PASSWORD }}
sonatypeUsername=${{ secrets.MAVEN_USERNAME }}
sonatypePassword=${{ secrets.MAVEN_PASSWORD }}
signing.keyId=${{ secrets.SIGNING_KEY_ID }}
signing.password=${{ secrets.SIGNING_PASSWORD }}
signing.secretKeyRingFile=_gradle_user_home/pusher-maven-gpg-signing-key.gpg
FILE
echo "${{ secrets.PUSHER_MAVEN_GPG_SIGNING_KEY }}" | base64 --decode > _gradle_user_home/pusher-maven-gpg-signing-key.gpg
- name: Publish
run: |
./gradlew publish
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository

finish-release:
create-github-release:
runs-on: ubuntu-latest
needs: publish
env:
NEXUS_USERNAME: ${{ secrets.MAVEN_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
needs: [ check-release-tag, publish ]
steps:
- uses: actions/checkout@v2
- id: get_staging_repository_id
name: Get staging repository id
- uses: actions/checkout@v4
- name: Prepare description
run: |
echo "staging_repository_id=$(python3 scripts/get_staging_repository_id.py)" >> $GITHUB_OUTPUT
- name: Release
uses: nexus-actions/release-nexus-staging-repo@main
with:
username: ${{ secrets.MAVEN_USERNAME }}
password: ${{ secrets.MAVEN_PASSWORD }}
staging_repository_id: ${{ steps.get_staging_repository_id.outputs.staging_repository_id }}
csplit -s CHANGELOG.md "/##/" {1}
cat xx01 > CHANGELOG.tmp
- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ needs.check-release-tag.outputs.tag }}
run: |
gh release create "$TAG" --title "$TAG" --notes-file CHANGELOG.tmp --target "$GITHUB_SHA"
4 changes: 2 additions & 2 deletions .github/workflows/release_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
name: Prepare release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Get current version
shell: bash
run: |
CURRENT_VERSION=$(awk '/^version = / { gsub("\"", ""); print $3 }' build.gradle)
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: pusher/public_actions
path: .github/actions
Expand Down
46 changes: 9 additions & 37 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
import org.apache.tools.ant.filters.ReplaceTokens

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.ajoberstar:gradle-git:1.1.0'
}
}

plugins {
id "eclipse"
id "jacoco"
id "java-library"
id "maven-publish"
id "org.ajoberstar.github-pages" version "1.7.2"
id "signing"
}

def getProperty = { property ->
if (!project.hasProperty(property)) {
throw new GradleException("${property} property must be set")
}
return project.property(property)
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
}

group = "com.pusher"
Expand Down Expand Up @@ -111,18 +95,6 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
}
assemble.dependsOn javadocJar

githubPages {
repoUri = 'https://github.com/pusher/pusher-websocket-java.git'
pages {
from javadoc.outputs.files
}
commitMessage = "JavaDoc gh-pages for ${version}"
credentials {
username = { getProperty("github.username") }
password = { getProperty("github.password") }
}
}

artifacts {
archives jar, fatJar, sourcesJar, javadocJar
}
Expand Down Expand Up @@ -174,15 +146,15 @@ publishing {
}
}
}
}

nexusPublishing {
repositories {
maven {
def releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotRepositoryUrl : releaseRepositoryUrl
credentials {
username = findProperty("maven.username") ?: ""
password = findProperty("maven.password") ?: ""
}
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
username = findProperty("sonatypeUsername") ?: ""
password = findProperty("sonatypePassword") ?: ""
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ public void testPongTimeoutResultsInClosingConnection() {
connection.connect();
connection.onMessage(CONN_ESTABLISHED_EVENT);

verify(mockUnderlyingConnection, timeout((int) (ACTIVITY_TIMEOUT + PONG_TIMEOUT))).close();
// The close is scheduled at ACTIVITY_TIMEOUT + PONG_TIMEOUT, so allow extra time for slow CI runners
verify(mockUnderlyingConnection, timeout((int) (ACTIVITY_TIMEOUT + PONG_TIMEOUT) * 2)).close();
}

@Test
Expand Down
Loading