chore(ci): Add release-please (#100)

* Add release-please

* Fix

* Fix

* No to wasmer

* use older rust-toolchain with compatible error messages

---------

Co-authored-by: Valery Antopol <valery.antopol@gmail.com>
This commit is contained in:
Anatolios Laskaris 2023-02-07 18:58:04 +02:00 committed by GitHub
parent 9e75f94c6a
commit 17e420f657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 268 additions and 68 deletions

3
.github/actionlint.yaml vendored Normal file
View File

@ -0,0 +1,3 @@
self-hosted-runner:
labels:
- builder

17
.github/release-please/config.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
"bootstrap-sha": "9e75f94c6a3ec37b6dd945435c1d16ecfb4714a4",
"release-type": "simple",
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"packages": {
".": {
"component": "marine-rs-sdk",
"extra-files": [
"crates/main/src/lib.rs",
"crates/marine-macro-impl/src/lib.rs",
"marine-macro/src/lib.rs",
"src/lib.rs"
]
}
}
}

3
.github/release-please/manifest.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
".": "0.7.1"
}

26
.github/renovate.json vendored
View File

@ -4,9 +4,25 @@
"config:base",
":semanticCommitTypeAll(chore)"
],
"enabledManagers": ["cargo", "npm", "github-actions"],
"enabledManagers": ["cargo", "github-actions"],
"schedule": "every weekend",
"packageRules": [
{
"matchManagers": ["cargo"],
"matchPackagePatterns": [
"fluence-.*",
"avm-server",
"air-intepreter-wasm",
"marine-.*"
],
"semanticCommitType": "fix",
"semanticCommitScope": "deps",
"schedule": "at any time"
},
{
"matchPackagePatterns": ["^@wasmer", "^wasmer", "^wasm-bindgen"],
"enabled": false
},
{
"matchDepTypes": ["devDependencies"],
"prPriority": -1
@ -16,14 +32,8 @@
"prConcurrentLimit": 1
},
{
"matchManagers": [ "github-actions" ],
"automerge": true,
"automergeType": "branch",
"matchManagers": ["github-actions"],
"prPriority": 1
},
{
"matchPackagePatterns": ["^@wasmer", "^wasmer", "^wasm-bindgen"],
"enabled": false
}
]
}

View File

@ -1,10 +1,18 @@
name: "marine-rs-sdk"
name: "ci"
on:
pull_request:
paths-ignore:
- "**.md"
- ".github/**"
- "!.github/workflows/ci.yml"
push:
branches:
- "master"
paths-ignore:
- "**.md"
- ".github/**"
- "!.github/workflows/ci.yml"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"

35
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: lint
on:
pull_request:
types:
- opened
- edited
- synchronize
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
pr:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
reviewdog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Lint actions
uses: reviewdog/action-actionlint@v1
env:
SHELLCHECK_OPTS: "-e SC2086 -e SC2207 -e SC2128"
with:
reporter: github-pr-check
fail_on_error: true

View File

@ -1,49 +0,0 @@
name: "publish-release"
on:
workflow_dispatch:
jobs:
npm-publish:
name: "Publish release"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install jq
run: sudo apt-get update && sudo apt-get --yes --force-yes install jq
- name: Install cargo-workspaces
run: cargo install cargo-workspaces
- name: Login to crates.io
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
- name: Save marine-rs-sdk's crate version to env
run: |
set -x
PKG_NAME=marine-rs-sdk
VERSION=$(cargo ws list -l | grep "$PKG_NAME\s" | head -n1 | awk '{ print $2 }')
echo "VERSION=$VERSION" | tee -a $GITHUB_ENV
echo "PKG_NAME=$PKG_NAME" | tee -a $GITHUB_ENV
- name: Publish to crates.io
run: cargo ws publish --no-git-commit --from-git --skip-published --yes
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: Marine Rust SDK ${{ env.VERSION }}
body: |
- [${{ env.VERSION }} @ crates.io](https://crates.io/crates/${{ env.PKG_NAME }}/${{ env.VERSION }})
draft: false
prerelease: false

173
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,173 @@
name: "release-please"
on:
push:
branches:
- "master"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release-created: ${{ steps.release.outputs.release_created }}
pr: ${{ steps.release.outputs.pr }}
steps:
- name: Run release-please
id: release
uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
command: manifest
config-file: .github/release-please/config.json
manifest-file: .github/release-please/manifest.json
- name: Show output from release-please
if: steps.release.outputs.releases_created
env:
RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }}
run: echo "${RELEASE_PLEASE_OUTPUT}" | jq
bump-version:
if: needs.release-please.outputs.pr != null
runs-on: builder
needs:
- release-please
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Get version
id: version
run: |
version="$(jq -r '.[]' .github/release-please/manifest.json)"
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Install cargo-workspaces
uses: baptiste0928/cargo-install@v1.3.0
with:
crate: cargo-workspaces
- name: Set version
run: |
cargo ws version \
--force '*' \
--no-git-commit \
--all \
--exact \
--yes \
custom ${{ steps.version.outputs.version }}
- name: Commit version bump
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore: Bump version to ${{ steps.version.outputs.version }}"
branch: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
commit_user_name: fluencebot
commit_user_email: devops@fluence.one
commit_author: fluencebot <devops@fluence.one>
crates:
if: needs.release-please.outputs.release-created
runs-on: builder
needs:
- release-please
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/crates.io/fluencebot token | CARGO_REGISTRY_TOKEN
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-workspaces
uses: baptiste0928/cargo-install@v1.3.0
with:
crate: cargo-workspaces
- name: Publish to crates.io
run: |
cargo ws publish \
--no-git-commit \
--allow-dirty \
--from-git \
--skip-published \
--yes
slack:
if: always()
name: "Notify"
runs-on: ubuntu-latest
needs:
- release-please
- crates
permissions:
contents: read
id-token: write
steps:
- uses: lwhiteley/dependent-jobs-result-check@v1
id: status
with:
statuses: failure
dependencies: ${{ toJSON(needs) }}
- name: Log output
run: |
echo "statuses:" "${{ steps.status.outputs.statuses }}"
echo "jobs:" "${{ steps.status.outputs.jobs }}"
echo "found any?:" "${{ steps.status.outputs.found }}"
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/slack/release-please webhook | SLACK_WEBHOOK_URL
- uses: ravsamhq/notify-slack-action@v2
if: steps.status.outputs.found == 'true'
with:
status: "failure"
notification_title: "*{workflow}* has {status_message}"
message_format: "${{ steps.status.outputs.jobs }} {status_message} in <{repo_url}|{repo}>"
footer: "<{run_url}>"

View File

@ -1,6 +1,6 @@
[package]
name = "marine-rs-sdk"
version = "0.7.1" # remember to update html_root_url
version = "0.7.1"
description = "Fluence backend SDK for developing backend applications for the Fluence network"
documentation = "https://docs.rs/fluence"
repository = "https://github.com/fluencelabs/marine-rs-sdk"

View File

@ -1,6 +1,6 @@
[package]
name = "marine-rs-sdk-main"
version = "0.7.1" # remember to update html_root_url
version = "0.7.1"
edition = "2018"
description = "Contains logger, allocators and several other modules for marine-rs-sdk"
documentation = "https://docs.rs/marine-rs-sdk-main"

View File

@ -19,7 +19,7 @@
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::needless_doctest_main)]
#![doc(html_root_url = "https://docs.rs/marine-rs-sdk-main/0.7.1")]
#![doc(html_root_url = "https://docs.rs/marine-rs-sdk-main/0.7.1")] // x-release-please-version
#![deny(
dead_code,
nonstandard_style,

View File

@ -1,6 +1,6 @@
[package]
name = "marine-macro-impl"
version = "0.7.1" # remember to update html_root_url
version = "0.7.1"
edition = "2018"
description = "Implementation of the `#[marine]` macro"
documentation = "https://docs.rs/fluence/marine-macro-impl"

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#![doc(html_root_url = "https://docs.rs/marine-macro-impl/0.7.1")]
#![doc(html_root_url = "https://docs.rs/marine-macro-impl/0.7.1")] // x-release-please-version
#![deny(
dead_code,
nonstandard_style,

View File

@ -1,6 +1,6 @@
[package]
name = "marine-macro"
version = "0.7.1" # remember to update html_root_url
version = "0.7.1"
edition = "2018"
description = "Definition of the `#[marine]` macro"
documentation = "https://docs.rs/fluence/marine-macro"

View File

@ -50,7 +50,7 @@
//!
//! ```
#![doc(html_root_url = "https://docs.rs/marine-macro/0.7.1")]
#![doc(html_root_url = "https://docs.rs/marine-macro/0.7.1")] // x-release-please-version
#![deny(
dead_code,
nonstandard_style,

View File

@ -1,6 +1,6 @@
[package]
name = "marine-timestamp-macro"
version = "0.7.1" # remember to update html_root_url
version = "0.7.1"
edition = "2018"
description = "Definition of the `#[build_timestamp]` macro"
documentation = "https://docs.rs/fluence/marine-timestamp-macro"

View File

@ -1,3 +1,3 @@
[toolchain]
channel = "stable"
channel = "stable-2022-09-22"
targets = [ "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "wasm32-wasi" ]

View File

@ -55,7 +55,7 @@
//! pub fn curl_get(url: String) -> String;
//! }
//! ```
#![doc(html_root_url = "https://docs.rs/sdk/0.7.1")]
#![doc(html_root_url = "https://docs.rs/sdk/0.7.1")] // x-release-please-version
#![deny(
dead_code,
nonstandard_style,