Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.
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
73 changes: 0 additions & 73 deletions .github/workflows/publish_branch.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run tests

on:
pull_request:
paths-ignore:
- "**.md"

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
fluence-js:
uses: ./.github/workflows/tests.yml
with:
ref: ${{ github.ref }}

snapshot:
uses: ./.github/workflows/snapshot.yml

aqua-playground:
needs: snapshot
uses: fluencelabs/aqua-playground/.github/workflows/tests.yml@master
with:
fluence-js-version: ${{ needs.snapshot.outputs.fluence-js-version }}
52 changes: 0 additions & 52 deletions .github/workflows/run_tests.yml

This file was deleted.

109 changes: 109 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Publish snapshot

on:
workflow_call:
outputs:
fluence-js-version:
description: "FluenceJS snapshot version"
value: ${{ jobs.publish-snapshot.outputs.fluence-js-version }}

env:
FORCE_COLOR: true
CI: true

jobs:
publish-snapshot:
name: "Publish snapshot"
runs-on: ubuntu-latest

outputs:
fluence-js-version: "${{ steps.build.outputs.version }}"

permissions:
contents: read
id-token: write

steps:
- name: Checkout fluence-js
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2.2.2
with:
version: 7

- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v2
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"

- run: pnpm i
- run: pnpm -r build

- name: Import secrets
uses: hashicorp/vault-action@v2.4.2
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN

- name: Generate package version
id: version
run: |
SHA=$(git rev-parse --short HEAD)

echo "::set-output name=sha::$SHA"
echo "::set-output name=branch::${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}"

- name: Set package version
id: build
env:
BRANCH: ${{ steps.version.outputs.branch }}
SHA: ${{ steps.version.outputs.sha }}
RUN: ${{ github.run_number }}
ATTEMPT: ${{ github.run_attempt }}
run: |
node ci.js bump-version ${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }}
echo "::set-output name=version::$(node ci.js get-version)"

- name: Publish to self-hosted npm repo
run: pnpm --no-git-checks --registry https://npm.fluence.dev -r publish --tag e2e -filter '@fluencelabs/*'

comment:
name: "Update comment"
runs-on: ubuntu-latest

needs:
- publish-snapshot

env:
FLUENCE_JS_VERSION: ${{ needs.publish-snapshot.outputs.fluence-js-version }}

steps:
- name: Find comment
uses: peter-evans/find-comment@v1
id: comment
with:
issue-number: "${{ github.event.pull_request.number }}"
comment-author: github-actions[bot]
body-includes: "## FluenceJS version is"

- name: Update comment
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: "${{ steps.comment.outputs.comment-id }}"
issue-number: "${{ github.event.pull_request.number }}"
edit-mode: replace
body: |
## FluenceJS version is [${{ env.FLUENCE_JS_VERSION }}](https://npm.fluence.dev/-/web/detail/@fluencelabs/fluence/v/${{ env.FLUENCE_JS_VERSION }})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just so awesome!

To install it run:
```shell
npm login --registry https://npm.fluence.dev
npm i @fluencelabs/fluence@${{ env.FLUENCE_JS_VERSION }} --registry=https://npm.fluence.dev
```
87 changes: 87 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Run tests with worflow_call

on:
workflow_call:
inputs:
rust-peer-image:
description: "rust-peer image tag"
type: string
default: "fluencelabs/fluence:minimal"
ref:
type: string
default: "master"

env:
RUST_PEER_IMAGE: "${{ inputs.rust-peer-image }}"
FORCE_COLOR: true
CI: true

jobs:
fluence-js:
name: "Run tests"
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

strategy:
matrix:
node-version:
- 16.x
- 17.x

steps:
- name: Import secrets
uses: hashicorp/vault-action@v2.4.1
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: Login to DockerHub
uses: docker/login-action@v2
with:
registry: docker.fluence.dev
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

- name: Checkout
uses: actions/checkout@v3
with:
repository: fluencelabs/fluence-js
ref: ${{ inputs.ref }}

- name: Setup docker-compose
uses: KengoTODA/actions-setup-docker-compose@v1.0.9
with:
version: 'v2.10.0'

- name: Pull rust-peer image
run: docker pull $RUST_PEER_IMAGE

- name: Run rust-peer
uses: isbang/compose-action@v1.1.0
with:
compose-file: ".github/e2e/docker-compose.yml"
down-flags: "--volumes"

- name: Setup pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- run: pnpm i
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not having all three inside a single step?

- run: pnpm -r build
- run: pnpm -r test