Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Automate Release #63

Merged
merged 2 commits into from
Apr 17, 2024
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
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: CI

on:
push:
branches: [ "**" ]
branches: ["**"]
pull_request:
branches: [ "**" ]
branches: ["**"]
schedule:
- cron: "0 6 * * 1-5"
workflow_dispatch:
Expand All @@ -18,11 +18,11 @@ env:
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: [ "${{ matrix.os }}" ]
runs-on: ["${{ matrix.os }}"]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macOS-latest ]
os: [ubuntu-latest, macOS-latest]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
name: Publish JVM snapshot package
if: github.ref == 'refs/heads/main'
needs: ci
uses: ./.github/workflows/publish_jvm.yml
uses: ./.github/workflows/publish-jvm.yml
permissions:
contents: read
packages: write
Expand All @@ -96,7 +96,7 @@ jobs:
name: Publish Android snapshot package
if: github.ref == 'refs/heads/main'
needs: ci
uses: ./.github/workflows/publish_android.yml
uses: ./.github/workflows/publish-android.yml
permissions:
contents: read
packages: write
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/enforce-linking-issues.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Pre-Release

on:
schedule:
- cron: "0 1 * * 1-5"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
release:
name: Build on ${{ matrix.os }}
runs-on: ["${{ matrix.os }}"]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26
add-to-path: false
link-to-sdk: true

- name: Install Rust toolchain
run: |
rustup show
rustup component add rustfmt clippy

- name: Cargo Format
working-directory: zenoh-jni
run: cargo fmt --all --check

- name: Clippy Check
working-directory: zenoh-jni
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Check for feature leaks
working-directory: zenoh-jni
run: cargo test --no-default-features

- name: Build Zenoh-JNI
working-directory: zenoh-jni
run: cargo build

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Gradle Test
run: gradle jvmTest --info
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Publish Android
name: Publish (Android)

on:
release:
types: [published]
workflow_call:
inputs:
snapshot:
required: true
type: boolean
description: 'If the publication is for a snapshot version.'
description: "If the publication is for a snapshot version."
default: false
branch:
description: Target branch
type: string
required: false
workflow_dispatch:

env:
Expand All @@ -24,6 +26,8 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}

- uses: actions/setup-java@v3
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
name: Publish Documentation
name: Publish (Dokka)

on:
release:
types: [published]
workflow_call:
inputs:
live-run:
description: Live-run
type: boolean
required: true
branch:
description: Target branch
type: string
required: false
workflow_dispatch:

env:
Expand All @@ -14,6 +22,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}

- uses: nttld/setup-ndk@v1
id: setup-ndk
Expand All @@ -26,6 +36,7 @@ jobs:
run: gradle dokkaHtml

- name: Deploy doc
if: ${{ inputs.live-run || false }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: Publish JVM
name: Publish (JVM)

on:
release:
types: [ published ]
workflow_call:
inputs:
snapshot:
required: true
type: boolean
description: 'If the publication is for a snapshot version.'
description: "If the publication is for a snapshot version."
default: false
branch:
description: Target branch
type: string
required: false
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
JNI_LIB_PATHS: jni-libs # Edit on the inner build.gradle.kts file as well.
JNI_LIB_PATHS: jni-libs # Edit on the inner build.gradle.kts file as well.

jobs:
builds:
Expand Down Expand Up @@ -59,14 +61,16 @@ jobs:
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}

- name: Install prerequisites
shell: bash
run: |
case ${{ matrix.job.target }} in
*-linux-gnu*) cargo install cargo-deb ;;
esac

case ${{ matrix.job.target }} in
aarch64-unknown-linux-gnu)
sudo apt-get -y update
Expand All @@ -90,7 +94,7 @@ jobs:
run: |
TARGET=${{ matrix.job.target }}
MAIN_PKG_NAME="${GITHUB_WORKSPACE}/${TARGET}.zip"

case ${TARGET} in
*linux*)
cd "zenoh-jni/target/${TARGET}/release/"
Expand Down Expand Up @@ -132,6 +136,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}

- name: Create resources destination
run: mkdir ${{env.JNI_LIB_PATHS}}
Expand Down
132 changes: 86 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,102 @@
#
# Copyright (c) 2022 ZettaScale Technology
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# ZettaScale Zenoh Team, <[email protected]>
#
name: Release

on:
release:
types: [published]
schedule:
- cron: "0 1 * * 1-5"
- cron: "0 0 * * 1-5"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
inputs:
live-run:
type: boolean
description: Live-run
required: false
version:
type: string
description: Release number
required: false
zenoh-version:
type: string
description: Release number of Zenoh
required: false

jobs:
release:
name: Build on ${{ matrix.os }}
runs-on: [ "${{ matrix.os }}" ]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macOS-latest ]

tag:
name: Branch, Bump & tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.create-release-branch.outputs.version }}
branch: ${{ steps.create-release-branch.outputs.branch }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
- id: create-release-branch
uses: eclipse-zenoh/ci/create-release-branch@main
with:
distribution: temurin
java-version: 11
repo: ${{ github.repository }}
live-run: ${{ inputs.live-run || false }}
version: ${{ inputs.version }}
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}

- uses: nttld/setup-ndk@v1
id: setup-ndk
- name: Checkout this repository
uses: actions/checkout@v4
with:
ndk-version: r26
add-to-path: false
link-to-sdk: true

- name: Install Rust toolchain
run: |
rustup show
rustup component add rustfmt clippy
ref: ${{ steps.create-release-branch.outputs.branch }}

- name: Cargo Format
working-directory: zenoh-jni
run: cargo fmt --all --check
- name: Bump and tag project
run: bash ci/scripts/bump-and-tag.bash
env:
VERSION: ${{ steps.create-release-branch.outputs.version }}
BUMP_DEPS_VERSION: ${{ inputs.zenoh-version }}
BUMP_DEPS_PATTERN: ${{ inputs.zenoh-version && 'zenoh.*' || '' }}
BUMP_DEPS_BRANCH: ${{ inputs.zenoh-version && format('release/{0}', inputs.zenoh-version) || '' }}
GIT_USER_NAME: eclipse-zenoh-bot
GIT_USER_EMAIL: [email protected]

- name: Clippy Check
working-directory: zenoh-jni
run: cargo clippy --all-targets --all-features -- -D warnings
publish-jvm:
name: Publish JVM package
needs: tag
uses: ./.github/workflows/publish-jvm.yml
with:
snapshot: ${{ !(inputs.live-run || false) }}
permissions:
contents: read
packages: write

- name: Check for feature leaks
working-directory: zenoh-jni
run: cargo test --no-default-features
publish-android:
name: Publish Android package
needs: tag
uses: ./.github/workflows/publish-android.yml
with:
snapshot: ${{ !(inputs.live-run || false) }}
permissions:
contents: read
packages: write

- name: Build Zenoh-JNI
working-directory: zenoh-jni
run: cargo build
publish-dokka:
name: Publish documentation
needs: tag
uses: ./.github/workflows/publish-dokka.yml
with:
live-run: ${{ inputs.live-run || false }}

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Gradle Test
run: gradle jvmTest --info
publish-github:
needs: tag
runs-on: macos-latest
steps:
- uses: eclipse-zenoh/ci/publish-crates-github@main
with:
repo: ${{ github.repository }}
live-run: ${{ inputs.live-run || false }}
version: ${{ needs.tag.outputs.version }}
branch: ${{ needs.tag.outputs.branch }}
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
Loading
Loading