From dd7f4b69be26811aa2d57258fd51d78d19035783 Mon Sep 17 00:00:00 2001 From: Anatolios Laskaris Date: Sat, 4 Mar 2023 10:13:37 +0200 Subject: [PATCH] chore: Update e2e (#273) * Update e2e * Fixes --- .../workflows/{e2e.yml.disabled => e2e.yml} | 40 +------ .github/workflows/run-tests.yml | 94 ---------------- .github/workflows/snapshot.yml | 104 +++++++++++++++--- .github/workflows/tests.yml | 86 ++++++++++++++- ci.js => ci.cjs | 2 +- package.json | 44 ++++---- 6 files changed, 200 insertions(+), 170 deletions(-) rename .github/workflows/{e2e.yml.disabled => e2e.yml} (60%) delete mode 100644 .github/workflows/run-tests.yml rename ci.js => ci.cjs (98%) diff --git a/.github/workflows/e2e.yml.disabled b/.github/workflows/e2e.yml similarity index 60% rename from .github/workflows/e2e.yml.disabled rename to .github/workflows/e2e.yml index 3c29d740..c5cd53d1 100644 --- a/.github/workflows/e2e.yml.disabled +++ b/.github/workflows/e2e.yml @@ -24,58 +24,28 @@ concurrency: jobs: tests: - name: "fluence-js" + name: "js-client" uses: ./.github/workflows/tests.yml with: ref: ${{ github.ref }} - fluence-js: + js-client: uses: ./.github/workflows/snapshot.yml with: ref: ${{ github.ref }} - aqua: - needs: - - fluence-js - - uses: fluencelabs/aqua/.github/workflows/snapshot.yml@main - with: - fluence-js-version: "${{ needs.fluence-js.outputs.fluence-js-version }}" - aqua-playground: needs: - - fluence-js - - aqua + - js-client - uses: fluencelabs/aqua-playground/.github/workflows/tests.yml@master + uses: fluencelabs/aqua-playground/.github/workflows/tests.yml@FLU-274 with: - fluence-js-version: "${{ needs.fluence-js.outputs.fluence-js-version }}" - aqua-version: "${{ needs.aqua.outputs.aqua-version }}" - - registry: - needs: - - aqua - - uses: fluencelabs/registry/.github/workflows/tests.yml@main - with: - aqua-version: "${{ needs.aqua.outputs.aqua-version }}" - - fluence-cli: - needs: - - fluence-js - - aqua - - uses: fluencelabs/fluence-cli/.github/workflows/tests.yml@main - with: - aqua-version: "${{ needs.aqua.outputs.aqua-version }}" - fluence-js-version: "${{ needs.fluence-js.outputs.fluence-js-version }}" + js-client-snapshots: "${{ needs.js-client.outputs.js-client-snapshots }}" status: runs-on: ubuntu-latest if: always() needs: - - fluence-cli - - registry - aqua-playground steps: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml deleted file mode 100644 index 3d9d590e..00000000 --- a/.github/workflows/run-tests.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: "ci" - -on: - pull_request: - paths-ignore: - - "**.md" - - ".github/**" - - "!.github/workflows/e2e.yml" - - "!.github/workflows/tests.yml" - - "!.github/workflows/snapshot.yml" - push: - branches: - - "master" - paths-ignore: - - "**.md" - - ".github/**" - - "!.github/workflows/e2e.yml" - - "!.github/workflows/tests.yml" - - "!.github/workflows/snapshot.yml" - -concurrency: - group: "${{ github.workflow }}-${{ github.ref }}" - cancel-in-progress: true - -env: - RUST_PEER_IMAGE: "fluencelabs/fluence:minimal" - 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 - - 18.x - - steps: - - 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 - 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 - - - name: Pull rust-peer image - run: docker pull $RUST_PEER_IMAGE - - - name: Run rust-peer - uses: isbang/compose-action@v1.4.1 - with: - 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 - - - run: pnpm -r build - - run: pnpm -r test diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 79acb62e..f916b428 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -14,11 +14,11 @@ on: ref: description: "git ref to checkout to" type: string - default: "v0.28.0" + default: "master" outputs: - fluence-js-version: - description: "@fluencelabs/fluence version" - value: ${{ jobs.publish-snapshot.outputs.fluence-js-version }} + js-client-snapshots: + description: "js-client snapshots" + value: ${{ jobs.publish-snapshot.outputs.snapshots }} env: FORCE_COLOR: true @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest outputs: - fluence-js-version: "${{ steps.snapshot.outputs.version }}" + snapshots: "${{ steps.snapshot.outputs.snapshots }}" permissions: contents: read @@ -56,22 +56,100 @@ jobs: - run: pnpm i - - name: Set avm version + - name: Set avm version in core/interfaces 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 + working-directory: packages/core/interfaces package-manager: pnpm + flags: "--save --dev" - - name: Set marine-js version + - name: Set marine-js version in core/interfaces 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 + working-directory: packages/core/interfaces + package-manager: pnpm + flags: "--save --dev" + + - name: Set avm version in core/js-peer + if: inputs.avm-version != 'null' + uses: fluencelabs/github-actions/npm-set-dependency@main + with: + package: "@fluencelabs/avm" + version: ${{ inputs.avm-version }} + working-directory: packages/core/js-peer + package-manager: pnpm + + - name: Set marine-js version in core/js-peer + 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/core/js-peer + package-manager: pnpm + + - name: Set avm version in client/api + if: inputs.avm-version != 'null' + uses: fluencelabs/github-actions/npm-set-dependency@main + with: + package: "@fluencelabs/avm" + version: ${{ inputs.avm-version }} + working-directory: packages/client/api + package-manager: pnpm + flags: "--save --dev" + + - name: Set marine-js version in client/api + 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/client/api + package-manager: pnpm + flags: "--save --dev" + + - name: Set avm version in client/js-client.web + if: inputs.avm-version != 'null' + uses: fluencelabs/github-actions/npm-set-dependency@main + with: + package: "@fluencelabs/avm" + version: ${{ inputs.avm-version }} + working-directory: packages/client/js-client.web.standalone + package-manager: pnpm + flags: "--save --dev" + + - name: Set marine-js version in client/js-client.web + 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/client/js-client.web.standalone + package-manager: pnpm + flags: "--save --dev" + + - name: Set avm version in client/js-client.node + if: inputs.avm-version != 'null' + uses: fluencelabs/github-actions/npm-set-dependency@main + with: + package: "@fluencelabs/avm" + version: ${{ inputs.avm-version }} + working-directory: packages/client/js-client.node + package-manager: pnpm + + - name: Set marine-js version in client/js-client.node + 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/client/js-client.node package-manager: pnpm - name: Import secrets @@ -92,15 +170,13 @@ jobs: uses: fluencelabs/github-actions/generate-snapshot-id@main - name: Set package version - run: node ci.js bump-version ${{ steps.version.outputs.id }} + run: node ci.cjs bump-version ${{ steps.version.outputs.id }} - run: pnpm -r build - name: Publish snapshots id: snapshot - uses: fluencelabs/github-actions/npm-publish-snapshot@main + uses: fluencelabs/github-actions/pnpm-publish-snapshot@main with: - working-directory: packages/fluence-js id: ${{ steps.version.outputs.id }} - package-manager: pnpm - flags: "-r --registry https://npm.fluence.dev --no-git-checks --tag snapsot -filter '@fluencelabs/*'" + flags: "-r --registry https://npm.fluence.dev --no-git-checks --tag snapshot -filter '@fluencelabs/*'" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a1078069..aa04716a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -90,22 +90,100 @@ jobs: - run: pnpm i - - name: Set avm version + - name: Set avm version in core/interfaces 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 + working-directory: packages/core/interfaces package-manager: pnpm + flags: "--save --dev" - - name: Set marine-js version + - name: Set marine-js version in core/interfaces 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 + working-directory: packages/core/interfaces + package-manager: pnpm + flags: "--save --dev" + + - name: Set avm version in core/js-peer + if: inputs.avm-version != 'null' + uses: fluencelabs/github-actions/npm-set-dependency@main + with: + package: "@fluencelabs/avm" + version: ${{ inputs.avm-version }} + working-directory: packages/core/js-peer + package-manager: pnpm + + - name: Set marine-js version in core/js-peer + 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/core/js-peer + package-manager: pnpm + + - name: Set avm version in client/api + if: inputs.avm-version != 'null' + uses: fluencelabs/github-actions/npm-set-dependency@main + with: + package: "@fluencelabs/avm" + version: ${{ inputs.avm-version }} + working-directory: packages/client/api + package-manager: pnpm + flags: "--save --dev" + + - name: Set marine-js version in client/api + 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/client/api + package-manager: pnpm + flags: "--save --dev" + + - name: Set avm version in client/js-client.web + if: inputs.avm-version != 'null' + uses: fluencelabs/github-actions/npm-set-dependency@main + with: + package: "@fluencelabs/avm" + version: ${{ inputs.avm-version }} + working-directory: packages/client/js-client.web.standalone + package-manager: pnpm + flags: "--save --dev" + + - name: Set marine-js version in client/js-client.web + 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/client/js-client.web.standalone + package-manager: pnpm + flags: "--save --dev" + + - name: Set avm version in client/js-client.node + if: inputs.avm-version != 'null' + uses: fluencelabs/github-actions/npm-set-dependency@main + with: + package: "@fluencelabs/avm" + version: ${{ inputs.avm-version }} + working-directory: packages/client/js-client.node + package-manager: pnpm + + - name: Set marine-js version in client/js-client.node + 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/client/js-client.node package-manager: pnpm - run: pnpm -r build diff --git a/ci.js b/ci.cjs similarity index 98% rename from ci.js rename to ci.cjs index bf4bc821..6fa69e2c 100644 --- a/ci.js +++ b/ci.cjs @@ -43,7 +43,7 @@ async function getPackageJsonsRecursive(currentPath) { (await fs.readdir(currentPath, { withFileTypes: true })) .filter( (file) => - file.name !== "node_modules" && + file.name !== "node_modules" && file.name !== "@tests" && (file.isDirectory() || file.name === "package.json") ) .map((file) => diff --git a/package.json b/package.json index 6f03aa8b..155b680e 100644 --- a/package.json +++ b/package.json @@ -1,24 +1,24 @@ { - "name": "common-dev-deps", - "version": "0.1.0", - "main": "./dist/index.js", - "typings": "./dist/index.d.ts", - "type": "module", - "engines": { - "node": ">=10", - "pnpm": ">=3" - }, - "scripts": { - "simulate-cdn": "http-server -p 8765 ./packages/client/js-client.web.standalone/dist" - }, - "author": "Fluence Labs", - "license": "Apache-2.0", - "devDependencies": { - "http-server": "14.1.1", - "@types/node": "18.13.0", - "ts-node": "10.9.1", - "typescript": "4.7", - "@fluencelabs/aqua-lib": "0.6.0", - "@fluencelabs/aqua": "0.9.1-374" - } + "name": "common-dev-deps", + "version": "0.1.0", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "type": "module", + "engines": { + "node": ">=10", + "pnpm": ">=3" + }, + "scripts": { + "simulate-cdn": "http-server -p 8765 ./packages/client/js-client.web.standalone/dist" + }, + "author": "Fluence Labs", + "license": "Apache-2.0", + "devDependencies": { + "http-server": "14.1.1", + "@types/node": "18.13.0", + "ts-node": "10.9.1", + "typescript": "4.7", + "@fluencelabs/aqua-lib": "0.6.0", + "@fluencelabs/aqua": "0.9.1-374" + } }