From cf274b1f9d49ce49e48b0c53221ecc04585f8311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Bruus=20Zeppelin?= Date: Thu, 14 Sep 2023 11:10:41 +0200 Subject: [PATCH] Fix CI --- .github/workflows/pipeline.yml | 72 ++++++++++++++++++---------------- packages/common/package.json | 8 ++-- packages/nodejs/package.json | 4 +- 3 files changed, 44 insertions(+), 40 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 8f036e665..41d8c18f7 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -18,7 +18,7 @@ env: RUST_FMT: nightly-2023-04-01-x86_64-unknown-linux-gnu jobs: - build: + deps: if: github.event.pull_request.draft == false runs-on: ubuntu-22.04 steps: @@ -50,6 +50,31 @@ jobs: restore-keys: | ${{ runner.os }}-yarn + - name: Get dependencies + run: yarn install --immutable + + - name: Build GRPC bindings + if: steps.cache-grpc.outputs.cache-hit != 'true' + run: | + mkdir -p packages/common/src/grpc-api + mkdir -p packages/nodejs/src/grpc-api + yarn workspace @concordium/common-sdk generate + yarn workspace @concordium/node-sdk generate + + build: + if: github.event.pull_request.draft == false + runs-on: ubuntu-22.04 + needs: deps + steps: + - uses: actions/checkout@v3 + with: + submodules: "recursive" + + - uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + cache: yarn + - name: Cache WebPack uses: actions/cache@v3 with: @@ -58,8 +83,11 @@ jobs: key: ${{ runner.os }}-webpack-${{ github.run_id }} restore-keys: ${{ runner.os }}-webpack - - name: Get dependencies - run: yarn install --immutable + - name: Restore dependencies + uses: actions/cache/restore@v3 + with: + path: node_modules + key: ${{ runner.os }}-yarn - name: Install rust run: rustup default ${{ env.RUST_VERSION }} @@ -75,13 +103,13 @@ jobs: with: version: 'latest' - - name: Build GRPC bindings - if: steps.cache-grpc.outputs.cache-hit != 'true' - run: | - mkdir -p packages/common/src/grpc-api - mkdir -p packages/nodejs/src/grpc-api - yarn workspace @concordium/common-sdk generate - yarn workspace @concordium/node-sdk generate + - name: Restore grpc + uses: actions/cache/restore@v3 + with: + path: | + ./packages/common/src/grpc-api + ./packages/nodejs/src/grpc-api + key: ${{ runner.os }}-grpc - name: Build run: yarn build:rust-bindings && yarn build:dev @@ -114,14 +142,6 @@ jobs: path: node_modules key: ${{ runner.os }}-yarn - - name: Restore grpc - uses: actions/cache/restore@v3 - with: - path: | - ./packages/common/src/grpc-api - ./packages/nodejs/src/grpc-api - key: ${{ runner.os }}-grpc - - name: Get build-debug uses: ./.github/actions/download-artifact with: @@ -250,14 +270,6 @@ jobs: path: node_modules key: ${{ runner.os }}-yarn - - name: Restore grpc - uses: actions/cache/restore@v3 - with: - path: | - ./packages/common/src/grpc-api - ./packages/nodejs/src/grpc-api - key: ${{ runner.os }}-grpc - - name: Lint markdown run: yarn markdown:lint @@ -278,14 +290,6 @@ jobs: path: node_modules key: ${{ runner.os }}-yarn - - name: Restore grpc - uses: actions/cache/restore@v3 - with: - path: | - ./packages/common/src/grpc-api - ./packages/nodejs/src/grpc-api - key: ${{ runner.os }}-grpc - - name: Lint markdown run: yarn markdown:linkcheck diff --git a/packages/common/package.json b/packages/common/package.json index ef17a1a8f..833e885f9 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -63,13 +63,13 @@ }, "scripts": { "generate-ts-v2-cjs": "yarn run grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/@protobuf-ts/plugin/bin/protoc-gen-ts --ts_opt 'optimize_code_size,output_legacy_commonjs,output_javascript' --ts_out=lib/cjs/grpc-api -I ../../deps/concordium-base/concordium-grpc-api ../../deps/concordium-base/concordium-grpc-api/v2/concordium/*.proto", - "generate-ts-v2": "yarn run grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/@protobuf-ts/plugin/bin/protoc-gen-ts --ts_opt 'optimize_code_size,output_javascript' --ts_out=lib/esm/grpc-api -I ../../deps/concordium-base/concordium-grpc-api ../../deps/concordium-base/concordium-grpc-api/v2/concordium/*.proto", - "generate": "([ -e \"../../deps/concordium-base/concordium-grpc-api\" ] && yarn generate-ts-v2 && yarn generate-ts-v2-cjs && cp -R lib/esm/grpc-api src) || echo 'Please checkout submodules before building'", + "generate-ts-v2": "yarn run grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/@protobuf-ts/plugin/bin/protoc-gen-ts --ts_opt 'optimize_code_size,output_javascript' --ts_out=src/grpc-api -I ../../deps/concordium-base/concordium-grpc-api ../../deps/concordium-base/concordium-grpc-api/v2/concordium/*.proto", + "generate": "([ -e \"../../deps/concordium-base/concordium-grpc-api\" ] && yarn generate-ts-v2) || echo 'Please checkout submodules before building'", "lint": "eslint . --cache --ext .ts,.tsx --max-warnings 0", "lint-fix": "yarn --silent lint --fix; exit 0", "test": "jest", - "build": "rm -rf src/grpc-api lib/esm/grpc-api lib/cjs/grpc-api; mkdir -p src/grpc-api lib/esm/grpc-api lib/cjs/grpc-api; yarn generate && yarn build-dev", - "build-dev": "yarn tsc-esm && yarn tsc-cjs", + "build": "rm -rf src/grpc-api lib/cjs/grpc-api; mkdir -p src/grpc-api lib/cjs/grpc-api; yarn generate && yarn build-dev", + "build-dev": "yarn tsc-esm && yarn tsc-cjs && cp -R src/grpc-api lib/esm && yarn generate-ts-v2-cjs", "tsc-esm": "tsc -p tsconfig.build.json", "tsc-cjs": "tsc -p tsconfig.build.json --outDir ./lib/cjs --module commonjs", "clean": "rimraf -- lib src/grpc-api" diff --git a/packages/nodejs/package.json b/packages/nodejs/package.json index 47e76cf8e..5cf3b49cf 100644 --- a/packages/nodejs/package.json +++ b/packages/nodejs/package.json @@ -57,8 +57,8 @@ "lint": "eslint . --cache --ext .ts,.tsx --max-warnings 0", "lint-fix": "yarn --silent lint --fix; exit 0", "test": "jest", - "build": "rm -rf src/grpc-api; mkdir -p src/grpc-api; yarn generate && yarn build-dev && cp -R src/grpc-api lib", - "build-dev": "yarn tsc-cjs", + "build": "rm -rf src/grpc-api; mkdir -p src/grpc-api; yarn generate && yarn build-dev", + "build-dev": "yarn tsc-cjs && cp -R src/grpc-api lib", "tsc-cjs": "tsc -p tsconfig.build.json", "clean": "rimraf -- lib src/grpc-api tsconfig.build.tsbuildinfo" },