Skip to content

Commit

Permalink
feat: add additional caching (#1062)
Browse files Browse the repository at this point in the history
* move cli

* optimize

* tmp

* simplify and fix

* fix actions, before build

* return

* fix

* add dir

* fix?

* fix

* fix

* Apply automatic changes

* fix

* fix

* fix

* fix

* Apply automatic changes

* fix

* move

* fix

* fix

* fix

* cache tests

* move

* remove

* fix

* fix

* fix

* fix

* fix

* sort and turn test groups back on

* remove node binaries, add github cache action

* fix

---------

Co-authored-by: shamsartem <[email protected]>
  • Loading branch information
shamsartem and shamsartem authored Oct 18, 2024
1 parent bfd8e44 commit 59416e4
Show file tree
Hide file tree
Showing 251 changed files with 2,558 additions and 2,351 deletions.
2 changes: 1 addition & 1 deletion .github/actions/replace-version/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Replace version
description: |
Replace version in cli/src/versions.json
Replace version in packages/cli/package/src/versions.json
inputs:
versions:
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/replace-version/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2816,7 +2816,9 @@ try {

const versionsFilePath = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(
process.env.GITHUB_WORKSPACE,
"packages",
"cli",
"package",
"src",
"versions.json",
);
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/replace-version/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ try {

const versionsFilePath = join(
process.env.GITHUB_WORKSPACE,
"packages",
"cli",
"package",
"src",
"versions.json",
);
Expand Down
13 changes: 5 additions & 8 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
{
"extends": [
"github>fluencelabs/renovate",
"github>fluencelabs/renovate:npm"
],
"extends": ["github>fluencelabs/renovate", "github>fluencelabs/renovate:npm"],
"enabledManagers": ["npm", "regex"],
"regexManagers": [
{
"fileMatch": ["^cli/src/versions\\.json$"],
"fileMatch": ["^packages/cli/package/src/versions\\.json$"],
"matchStrings": [
"\"nox\": \"(?<lookupName>[^:]+):(?<currentValue>.*)\",\n"
],
"datasourceTemplate": "docker",
"depNameTemplate": "nox"
},
{
"fileMatch": ["^cli/src/versions\\.json$"],
"fileMatch": ["^packages/cli/package/src/versions\\.json$"],
"matchStrings": [
"\"chain-rpc\": \"(?<lookupName>[^:]+):(?<currentValue>.*)\",\n",
"\"chain-deploy-script\": \"(?<lookupName>[^:]+):(?<currentValue>.*)\",\n",
Expand All @@ -24,15 +21,15 @@
"depNameTemplate": "chain"
},
{
"fileMatch": ["^cli/src/versions\\.json$"],
"fileMatch": ["^packages/cli/package/src/versions\\.json$"],
"matchStrings": [
"\"(?<depName>@fluencelabs/[^\"]+)\": \"(?<currentValue>[^\"\n]+)\""
],
"matchStringsStrategy": "any",
"datasourceTemplate": "npm"
},
{
"fileMatch": ["^cli/src/versions\\.json$"],
"fileMatch": ["^packages/cli/package/src/versions\\.json$"],
"matchStrings": [
"\"(?<depName>[marine|mrepl|marine\\-rs\\-sdk|marine\\-rs\\-sdk\\-test]+)\": \"(?<currentValue>[^\"\n]+)\""
],
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ jobs:

- run: yarn install

- run: yarn install
working-directory: cli

- name: Setup golang
uses: actions/setup-go@v5

Expand All @@ -56,10 +53,6 @@ jobs:
- name: Run on each commit
run: yarn on-each-commit

- name: Run on each commit CLI
run: yarn on-each-commit
working-directory: cli

- name: Format
run: yarn format

Expand Down
42 changes: 22 additions & 20 deletions .github/workflows/pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ on:
description: "aqua snapshots"
type: string
default: "null"
node-version:
description: "Node version"
type: string
default: "18.20.3"

env:
CI: true
Expand Down Expand Up @@ -97,23 +101,20 @@ jobs:
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v4
with:
node-version: "18.20.3"
node-version: ${{ inputs.node-version }}
registry-url: "https://npm.fluence.dev"
cache: "yarn"

- run: yarn install

- run: yarn install
working-directory: cli

- name: Set js-client version
if: inputs.js-client-snapshots != 'null'
uses: fluencelabs/github-actions/npm-set-dependency@main
with:
package: "@fluencelabs/js-client"
version: ${{ fromJson(inputs.js-client-snapshots)['js-client'] }}
package-manager: yarn
working-directory: cli
working-directory: packages/cli/package

- name: Set aqua-api version
if: inputs.aqua-snapshots != 'null'
Expand All @@ -122,7 +123,7 @@ jobs:
package: "@fluencelabs/aqua-api"
version: "${{ fromJson(inputs.aqua-snapshots)['aqua-api'] }}"
package-manager: yarn
working-directory: cli
working-directory: packages/cli/package

- name: Update versions.json
uses: ./.github/actions/replace-version
Expand Down Expand Up @@ -153,35 +154,36 @@ jobs:
restore-keys: |
${{ runner.os }}-turbo-
- name: Build
run: yarn build

- name: Build CLI
run: yarn build
working-directory: cli
- name: Cache node binaries
id: cache-node-binaries
uses: actions/cache@v3
env:
cache-name: cache-node-binaries
with:
path: packages/cli/package/tmp/cache/node-v${{ inputs.node-version }}-${{ inputs.platform }}
key: ${{ env.cache-name }}-${{ inputs.node-version }}-${{ inputs.platform }}

- name: Pack fluence-cli
run: yarn pack-${{ inputs.platform }}
working-directory: cli

- name: Upload fluence-cli
if: inputs.upload-to-s3 == true
working-directory: cli
working-directory: packages/cli/package
run: yarn upload-${{ inputs.platform }}

- name: Promote fluence-cli
if: inputs.channel != 'null' && inputs.platform != 'win32-x64'
working-directory: cli
working-directory: packages/cli/package
run: yarn oclif promote -t ${{ inputs.platform }} --version "$(jq .[] -r ../.github/release-please/manifest.json)" --sha "$(git rev-parse --short HEAD)" --channel ${{ inputs.channel }} --no-xz --indexes

- name: Promote fluence-cli windows
if: inputs.channel != 'null' && inputs.platform == 'win32-x64'
working-directory: cli
working-directory: packages/cli/package
run: yarn oclif promote -t ${{ inputs.platform }} --version "$(jq .[] -r ../.github/release-please/manifest.json)" --sha "$(git rev-parse --short HEAD)" --channel ${{ inputs.channel }} --no-xz --win --indexes

- name: Rename archive
if: inputs.platform != 'win32-x64'
run: mv cli/dist/fluence-*${{ inputs.platform }}*.tar.gz fluence-cli-${{ inputs.platform }}.tar.gz
run: mv packages/cli/package/dist/fluence-*${{ inputs.platform }}*.tar.gz fluence-cli-${{ inputs.platform }}.tar.gz

- name: Upload archive to CI
if: inputs.platform != 'win32-x64'
Expand All @@ -199,7 +201,7 @@ jobs:

- name: Rename windows installer
if: inputs.platform == 'win32-x64'
run: mv cli/dist/win32/fluence-*.exe fluence-cli-${{ inputs.platform }}.exe
run: mv packages/cli/package/dist/win32/fluence-*.exe fluence-cli-${{ inputs.platform }}.exe

- name: Upload windows installer to CI
if: inputs.platform == 'win32-x64'
Expand All @@ -217,10 +219,10 @@ jobs:

- name: Promote fluence-cli to unstable
if: inputs.tag != 'null' && inputs.platform != 'win32-x64'
working-directory: cli
working-directory: packages/cli/package
run: yarn oclif promote -t ${{ inputs.platform }} --version "$(jq .[] -r ../.github/release-please/manifest.json)" --sha "$(git rev-parse --short HEAD)" --channel unstable --no-xz --indexes

- name: Promote fluence-cli windows to unstable
if: inputs.tag != 'null' && inputs.platform == 'win32-x64'
working-directory: cli
working-directory: packages/cli/package
run: yarn oclif promote -t ${{ inputs.platform }} --version "$(jq .[] -r ../.github/release-please/manifest.json)" --sha "$(git rev-parse --short HEAD)" --channel unstable --win --no-xz --indexes
16 changes: 8 additions & 8 deletions .github/workflows/promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:
description: "Promote version to channel"
type: choice
options:
- main # latest build from main branch
- stage # version compatible with current stage env
- testnet # version compatible with current testnet env
- stable # latest stable version (same as mainnet)
- mainnet # version compatible with current mainnet env
- main # latest build from main branch
- stage # version compatible with current stage env
- testnet # version compatible with current testnet env
- stable # latest stable version (same as mainnet)
- mainnet # version compatible with current mainnet env
- unstable # version used by all CI jobs; TODO: publish automatically on every release
required: true

Expand Down Expand Up @@ -57,12 +57,12 @@ jobs:
cache: "yarn"

- run: yarn install
working-directory: cli
working-directory: packages/cli/package

- name: Promote fluence-cli
working-directory: cli
working-directory: packages/cli/package
run: yarn oclif promote -t linux-x64,darwin-x64,darwin-arm64 --version "$(jq .[] -r ../.github/release-please/manifest.json)" --sha "$(git rev-parse --short HEAD)" --channel ${{ inputs.channel }} --no-xz --indexes

- name: Promote fluence-cli windows
working-directory: cli
working-directory: packages/cli/package
run: yarn oclif promote -t win32-x64 --version "$(jq .[] -r ../.github/release-please/manifest.json)" --sha "$(git rev-parse --short HEAD)" --channel ${{ inputs.channel }} --no-xz --win --indexes
37 changes: 24 additions & 13 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ on:
description: "@fluencelabs/installation-spell version"
type: string
default: "null"
node-version:
description: "Node version"
type: string
default: "18.20.3"

env:
CI: true
Expand Down Expand Up @@ -99,17 +103,14 @@ jobs:
- run: yarn install

- run: yarn install
working-directory: cli

- name: Set js-client version
if: inputs.js-client-snapshots != 'null'
uses: fluencelabs/github-actions/npm-set-dependency@main
with:
package: "@fluencelabs/js-client"
version: ${{ fromJson(inputs.js-client-snapshots)['js-client'] }}
package-manager: yarn
working-directory: cli
working-directory: packages/cli/package

- name: Set aqua-api version
if: inputs.aqua-snapshots != 'null'
Expand All @@ -118,7 +119,7 @@ jobs:
package: "@fluencelabs/aqua-api"
version: "${{ fromJson(inputs.aqua-snapshots)['aqua-api'] }}"
package-manager: yarn
working-directory: cli
working-directory: packages/cli/package

- name: Set installation-spell version
if: inputs.installation-spell-version != 'null'
Expand All @@ -128,7 +129,7 @@ jobs:
version: "${{ inputs.installation-spell-version }}"
package-manager: yarn
flags: "--dev"
working-directory: cli
working-directory: packages/cli/package

- name: Update versions.json
uses: ./.github/actions/replace-version
Expand Down Expand Up @@ -158,16 +159,26 @@ jobs:
restore-keys: |
${{ runner.os }}-turbo-
- name: Build
run: yarn build

- name: Build CLI
run: yarn build
working-directory: cli
- name: Cache node binaries linux-x64
id: cache-node-binaries-linux-x64
uses: actions/cache@v3
env:
cache-name: cache-node-binaries
with:
path: packages/cli/package/tmp/cache/node-v${{ inputs.node-version }}-linux-x64
key: ${{ env.cache-name }}-${{ inputs.node-version }}-linux-x64

- name: Cache node binaries darwin-arm64
id: cache-node-binaries-darwin-arm64
uses: actions/cache@v3
env:
cache-name: cache-node-binaries
with:
path: packages/cli/package/tmp/cache/node-v${{ inputs.node-version }}-darwin-arm64
key: ${{ env.cache-name }}-${{ inputs.node-version }}-darwin-arm64

- name: Pack Fluence CLI for Linux and macOS
run: yarn pack-ci
working-directory: cli

- name: Upload linux-x64 to CI checks
uses: actions/upload-artifact@v4
Expand Down
Loading

0 comments on commit 59416e4

Please sign in to comment.