mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2024-12-04 18:00:18 +00:00
chore: Add release-please (#240)
* Add release-please * Fix * Fix ci.js * Rename fluence-js * Run pnpm i * Fix * Update workflows * Fix
This commit is contained in:
parent
0d05e517d8
commit
63a3579ee6
3
.github/actionlint.yaml
vendored
Normal file
3
.github/actionlint.yaml
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
self-hosted-runner:
|
||||||
|
labels:
|
||||||
|
- builder
|
18
.github/release-please/config.json
vendored
Normal file
18
.github/release-please/config.json
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"release-type": "node",
|
||||||
|
"bump-minor-pre-major": true,
|
||||||
|
"bump-patch-for-minor-pre-major": true,
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"type": "node-workspace"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"packages": {
|
||||||
|
"packages/client/api": {},
|
||||||
|
"packages/js-client.node": {},
|
||||||
|
"packages/js-client.web.standalone": {},
|
||||||
|
"packages/tools": {},
|
||||||
|
"packages/core/interfaces": {},
|
||||||
|
"packages/core/js-peer": {}
|
||||||
|
}
|
||||||
|
}
|
8
.github/release-please/manifest.json
vendored
Normal file
8
.github/release-please/manifest.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"packages/client/api": "0.10.0",
|
||||||
|
"packages/js-client.node": "0.5.0",
|
||||||
|
"packages/js-client.web.standalone": "0.12.0",
|
||||||
|
"packages/tools": "0.1.0",
|
||||||
|
"packages/core/interfaces": "0.6.0",
|
||||||
|
"packages/core/js-peer": "0.7.0"
|
||||||
|
}
|
5
.github/workflows/changelog_config.json
vendored
5
.github/workflows/changelog_config.json
vendored
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"template": "${{CHANGELOG}}\n\n${{UNCATEGORIZED}}",
|
|
||||||
"pr_template": "- #${{NUMBER}} ${{TITLE}}",
|
|
||||||
"empty_template": "- no changes"
|
|
||||||
}
|
|
10
.github/workflows/e2e.yml.disabled
vendored
10
.github/workflows/e2e.yml.disabled
vendored
@ -4,9 +4,19 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- "**.md"
|
- "**.md"
|
||||||
|
- ".github/**"
|
||||||
|
- "!.github/workflows/e2e.yml"
|
||||||
|
- "!.github/workflows/tests.yml"
|
||||||
|
- "!.github/workflows/snapshot.yml"
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- "master"
|
||||||
|
paths-ignore:
|
||||||
|
- "**.md"
|
||||||
|
- ".github/**"
|
||||||
|
- "!.github/workflows/e2e.yml"
|
||||||
|
- "!.github/workflows/tests.yml"
|
||||||
|
- "!.github/workflows/snapshot.yml"
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "${{ github.workflow }}-${{ github.ref }}"
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
|
35
.github/workflows/lint.yml
vendored
Normal file
35
.github/workflows/lint.yml
vendored
Normal 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
|
168
.github/workflows/release.yml
vendored
Normal file
168
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
name: "release-please"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "master"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
|
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
FORCE_COLOR: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-please:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
release-created: ${{ steps.release.outputs.releases_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: ubuntu-latest
|
||||||
|
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 pnpm
|
||||||
|
uses: pnpm/action-setup@v2.2.4
|
||||||
|
with:
|
||||||
|
version: 7
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: "18"
|
||||||
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
cache: "pnpm"
|
||||||
|
|
||||||
|
- run: pnpm i --no-frozen-lockfile
|
||||||
|
|
||||||
|
- name: Commit version bump
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
|
with:
|
||||||
|
commit_message: "chore: Regenerate pnpm lock file"
|
||||||
|
branch: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
|
||||||
|
commit_user_name: fluencebot
|
||||||
|
commit_user_email: devops@fluence.one
|
||||||
|
commit_author: fluencebot <devops@fluence.one>
|
||||||
|
|
||||||
|
fluence-js:
|
||||||
|
if: needs.release-please.outputs.release-created
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- release-please
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
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/npmjs/fluencebot token | NODE_AUTH_TOKEN
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v2.2.4
|
||||||
|
with:
|
||||||
|
version: 7
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: "18"
|
||||||
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
cache: "pnpm"
|
||||||
|
|
||||||
|
- run: pnpm i
|
||||||
|
- run: pnpm -r build
|
||||||
|
|
||||||
|
- name: Publish to npm registry
|
||||||
|
run: pnpm --no-git-checks -r publish -filter '@fluencelabs/*' --access public --tags unstable
|
||||||
|
|
||||||
|
slack:
|
||||||
|
if: always()
|
||||||
|
name: "Notify"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs:
|
||||||
|
- release-please
|
||||||
|
- fluence-js
|
||||||
|
|
||||||
|
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}>"
|
@ -1,27 +1,29 @@
|
|||||||
name: Run tests with worflow_call
|
name: "ci"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
pull_request:
|
||||||
inputs:
|
paths-ignore:
|
||||||
rust-peer-image:
|
- "**.md"
|
||||||
description: "rust-peer image tag"
|
- ".github/**"
|
||||||
type: string
|
- "!.github/workflows/e2e.yml"
|
||||||
default: "fluencelabs/fluence:minimal"
|
- "!.github/workflows/tests.yml"
|
||||||
avm-version:
|
- "!.github/workflows/snapshot.yml"
|
||||||
description: "@fluencelabs/avm version"
|
push:
|
||||||
type: string
|
branches:
|
||||||
default: "null"
|
- "master"
|
||||||
marine-js-version:
|
paths-ignore:
|
||||||
description: "@fluencelabs/marine-js version"
|
- "**.md"
|
||||||
type: string
|
- ".github/**"
|
||||||
default: "null"
|
- "!.github/workflows/e2e.yml"
|
||||||
ref:
|
- "!.github/workflows/tests.yml"
|
||||||
description: "git ref to checkout to"
|
- "!.github/workflows/snapshot.yml"
|
||||||
type: string
|
|
||||||
default: "master"
|
concurrency:
|
||||||
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RUST_PEER_IMAGE: "${{ inputs.rust-peer-image }}"
|
RUST_PEER_IMAGE: "fluencelabs/fluence:minimal"
|
||||||
FORCE_COLOR: true
|
FORCE_COLOR: true
|
||||||
CI: true
|
CI: true
|
||||||
|
|
||||||
@ -39,6 +41,7 @@ jobs:
|
|||||||
node-version:
|
node-version:
|
||||||
- 16.x
|
- 16.x
|
||||||
- 17.x
|
- 17.x
|
||||||
|
- 18.x
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Import secrets
|
- name: Import secrets
|
||||||
@ -63,9 +66,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
repository: fluencelabs/fluence-js
|
|
||||||
ref: ${{ inputs.ref }}
|
|
||||||
|
|
||||||
- name: Pull rust-peer image
|
- name: Pull rust-peer image
|
||||||
run: docker pull $RUST_PEER_IMAGE
|
run: docker pull $RUST_PEER_IMAGE
|
||||||
@ -90,23 +90,5 @@ jobs:
|
|||||||
|
|
||||||
- run: pnpm i
|
- run: pnpm i
|
||||||
|
|
||||||
- name: Set avm version
|
|
||||||
if: inputs.avm-version != 'null'
|
|
||||||
uses: fluencelabs/github-actions/npm-set-dependency@main
|
|
||||||
with:
|
|
||||||
package: "@fluencelabs/avm"
|
|
||||||
version: ${{ inputs.avm-version }}
|
|
||||||
working-directory: packages/fluence-js
|
|
||||||
package-manager: pnpm
|
|
||||||
|
|
||||||
- name: Set marine-js version
|
|
||||||
if: inputs.marine-js-version != 'null'
|
|
||||||
uses: fluencelabs/github-actions/npm-set-dependency@main
|
|
||||||
with:
|
|
||||||
package: "@fluencelabs/marine-js"
|
|
||||||
version: ${{ inputs.marine-js-version }}
|
|
||||||
working-directory: packages/fluence-js
|
|
||||||
package-manager: pnpm
|
|
||||||
|
|
||||||
- run: pnpm -r build
|
- run: pnpm -r build
|
||||||
- run: pnpm -r test
|
- run: pnpm -r test
|
107
.github/workflows/tests.yml
vendored
107
.github/workflows/tests.yml
vendored
@ -1,8 +1,4 @@
|
|||||||
name: Run tests
|
name: Run tests with worflow_call
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: .
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
@ -22,7 +18,7 @@ on:
|
|||||||
ref:
|
ref:
|
||||||
description: "git ref to checkout to"
|
description: "git ref to checkout to"
|
||||||
type: string
|
type: string
|
||||||
default: "v0.28.0"
|
default: "master"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
RUST_PEER_IMAGE: "${{ inputs.rust-peer-image }}"
|
RUST_PEER_IMAGE: "${{ inputs.rust-peer-image }}"
|
||||||
@ -34,32 +30,83 @@ jobs:
|
|||||||
name: "Run tests"
|
name: "Run tests"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
permissions:
|
||||||
matrix:
|
contents: read
|
||||||
node-version: [16.x, 17.x, 18.x]
|
id-token: write
|
||||||
|
|
||||||
steps:
|
strategy:
|
||||||
- uses: actions/checkout@v2
|
matrix:
|
||||||
|
node-version:
|
||||||
|
- 16.x
|
||||||
|
- 17.x
|
||||||
|
|
||||||
- name: Setup Node.js ${{ matrix.node-version }}
|
steps:
|
||||||
uses: actions/setup-node@v1
|
- name: Import secrets
|
||||||
with:
|
uses: hashicorp/vault-action@v2.4.3
|
||||||
node-version: ${{ matrix.node-version }}
|
with:
|
||||||
|
url: https://vault.fluence.dev
|
||||||
|
path: jwt/github
|
||||||
|
role: ci
|
||||||
|
method: jwt
|
||||||
|
jwtGithubAudience: "https://github.com/fluencelabs"
|
||||||
|
jwtTtl: 300
|
||||||
|
secrets: |
|
||||||
|
kv/docker-registry/basicauth/ci username | DOCKER_USERNAME ;
|
||||||
|
kv/docker-registry/basicauth/ci password | DOCKER_PASSWORD
|
||||||
|
|
||||||
- name: Setup pnpm
|
- name: Login to DockerHub
|
||||||
uses: pnpm/action-setup@v2.2.4
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
version: 7
|
registry: docker.fluence.dev
|
||||||
|
username: ${{ env.DOCKER_USERNAME }}
|
||||||
|
password: ${{ env.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Run container with Fluence node
|
- name: Checkout
|
||||||
run: |
|
uses: actions/checkout@v3
|
||||||
docker pull fluencelabs/fluence
|
with:
|
||||||
docker run -d --rm -e RUST_LOG="info" -p 1210:1210 -p 4310:4310 fluencelabs/fluence -t 1210 -w 4310 -k gKdiCSUr1TFGFEgu2t8Ch1XEUsrN5A2UfBLjSZvfci9SPR3NvZpACfcpPGC3eY4zma1pk7UvYv5zb1VjvPHwCjj --local --aqua-pool-size 2
|
repository: fluencelabs/fluence-js
|
||||||
|
ref: ${{ inputs.ref }}
|
||||||
|
|
||||||
- run: pnpm i
|
- name: Pull rust-peer image
|
||||||
- run: pnpm -r build
|
run: docker pull $RUST_PEER_IMAGE
|
||||||
env:
|
|
||||||
CI: true
|
- name: Run rust-peer
|
||||||
- run: pnpm -r test
|
uses: isbang/compose-action@v1.4.1
|
||||||
env:
|
with:
|
||||||
CI: true
|
compose-file: ".github/e2e/docker-compose.yml"
|
||||||
|
down-flags: "--volumes"
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v2.2.4
|
||||||
|
with:
|
||||||
|
version: 7
|
||||||
|
|
||||||
|
- name: Setup node ${{ matrix.node-version }} with self-hosted registry
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
registry-url: "https://npm.fluence.dev"
|
||||||
|
cache: "pnpm"
|
||||||
|
|
||||||
|
- run: pnpm i
|
||||||
|
|
||||||
|
- name: Set avm version
|
||||||
|
if: inputs.avm-version != 'null'
|
||||||
|
uses: fluencelabs/github-actions/npm-set-dependency@main
|
||||||
|
with:
|
||||||
|
package: "@fluencelabs/avm"
|
||||||
|
version: ${{ inputs.avm-version }}
|
||||||
|
working-directory: packages/fluence-js
|
||||||
|
package-manager: pnpm
|
||||||
|
|
||||||
|
- name: Set marine-js version
|
||||||
|
if: inputs.marine-js-version != 'null'
|
||||||
|
uses: fluencelabs/github-actions/npm-set-dependency@main
|
||||||
|
with:
|
||||||
|
package: "@fluencelabs/marine-js"
|
||||||
|
version: ${{ inputs.marine-js-version }}
|
||||||
|
working-directory: packages/fluence-js
|
||||||
|
package-manager: pnpm
|
||||||
|
|
||||||
|
- run: pnpm -r build
|
||||||
|
- run: pnpm -r test
|
||||||
|
9
ci.js
9
ci.js
@ -74,12 +74,7 @@ function processDep(obj, name, fn) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!/^workspace\:/.test(obj[name])) {
|
fn(obj, obj[name]);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const version = obj[name].replace("workspace:", "");
|
|
||||||
fn(obj, version);
|
|
||||||
}
|
}
|
||||||
async function getVersionsMap(allPackageJsons) {
|
async function getVersionsMap(allPackageJsons) {
|
||||||
return new Map(await Promise.all(allPackageJsons.map(getVersion)));
|
return new Map(await Promise.all(allPackageJsons.map(getVersion)));
|
||||||
@ -125,7 +120,7 @@ async function bumpVersions(file, versionsMap) {
|
|||||||
|
|
||||||
// bump dependencies
|
// bump dependencies
|
||||||
for (const [name, version] of versionsMap) {
|
for (const [name, version] of versionsMap) {
|
||||||
const update = (x) => (x[name] = `workspace:${version}-${postfix}`);
|
const update = (x) => (x[name] = `${version}-${postfix}`);
|
||||||
processDep(json.dependencies, name, update);
|
processDep(json.dependencies, name, update);
|
||||||
processDep(json.devDependencies, name, update);
|
processDep(json.devDependencies, name, update);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
|
|
||||||
packages:
|
packages:
|
||||||
- 'packages/**/*'
|
- 'packages/**/*'
|
||||||
|
Loading…
Reference in New Issue
Block a user