git.delta.rocks / unique-network / refs/commits / e42f99deb83f

difftreelog

Merge pull request #811 from UniqueNetwork/feature/generate-types-package

Yaroslav Bolyukin2022-12-26parents: #71fe9c7 #8c9db45.patch.diff
in: master
Feature/generate types package

2 files changed

modified.github/workflows/polkadot-types.ymldiffbeforeafterboth
before · .github/workflows/polkadot-types.yml
1# Integration test in --dev mode2# https://cryptousetech.atlassian.net/wiki/spaces/CI/pages/2586411104/Integration+tests3name: Polkadot types45# Triger: only call from main workflow(re-usable workflows)6on:7  workflow_call:8  # Allows you to run this workflow manually from the Actions tab9  workflow_dispatch:1011# on:12#   pull_request:13#     branches: [ 'develop' ]14#     types: [ opened, reopened, synchronize, ready_for_review, converted_to_draft ]151617# A workflow run is made up of one or more jobs that can run sequentially or in parallel18jobs:19  20  polkadot_generate_types:21    # The type of runner that the job will run on22    runs-on: [self-hosted-ci,medium]23    timeout-minutes: 13802425    name: ${{ matrix.network }}2627    continue-on-error: true         #Do not stop testing of matrix runs failed.  As it decided during PR review - it required 50/50& Let's check it with false.2829    strategy:30      matrix:31        include:32          - network: sapphire33            usage: "--sapphire"34          - network: "opal"35            usage: ""36          - network: "quartz"37            usage: ""38          - network: "unique"39            usage: ""4041    steps:4243      - name: Clean Workspace44        uses: AutoModality/action-clean@v1.1.04546      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it47      - uses: actions/checkout@v348        with:49          ref: ${{ github.head_ref }}  #Checking out head commit5051      - name: Read .env file52        uses: xom9ikk/dotenv@v25354      - name: Generate ENV related extend file for docker-compose55        uses: cuchi/jinja2-action@v1.2.056        with:57          template: .docker/docker-compose.tmp-dev.j258          output_file: .docker/docker-compose.${{ matrix.network }}.yml59          variables: |60            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}61            NETWORK=${{ matrix.network }}62   63      - name: Show build configuration64        run: cat .docker/docker-compose.${{ matrix.network }}.yml6566      - name: Build the stack67        run: docker-compose -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans6869      - uses: actions/setup-node@v370        with:71          node-version: 167273      - name: Install jq74        run: sudo apt install jq -y7576      - name: Run generate_types_package script77        working-directory: tests78        run: |79          yarn install80          /bin/bash ./scripts/wait_for_first_block.sh81          git config --global user.name "Unique"82          git config --global user.email github-actions@usetech.com          83          /bin/bash ./scripts/generate_types_package.sh --release ${{ matrix.usage }} --push84        env:85          RPC_URL: http://127.0.0.1:9933/8687      - name: Stop running containers88        if: always()                   # run this step always89        run: docker-compose -f ".docker/docker-compose.${{ matrix.network }}.yml" down9091      - name: Remove builder cache92        if: always()                   # run this step always93        run: |94          docker builder prune -f -a95          docker system prune -f96          docker image prune -f -a
after · .github/workflows/polkadot-types.yml
1# Integration test in --dev mode2# https://cryptousetech.atlassian.net/wiki/spaces/CI/pages/2586411104/Integration+tests3name: Polkadot types45# Triger: only call from main workflow(re-usable workflows)6on:7  workflow_call:8  # Allows you to run this workflow manually from the Actions tab9  workflow_dispatch:1011# on:12#   pull_request:13#     branches: [ 'develop' ]14#     types: [ opened, reopened, synchronize, ready_for_review, converted_to_draft ]151617# A workflow run is made up of one or more jobs that can run sequentially or in parallel18jobs:19  20  polkadot_generate_types:21    # The type of runner that the job will run on22    runs-on: [self-hosted-ci,medium]23    timeout-minutes: 13802425    name: ${{ matrix.network }}2627    continue-on-error: true         #Do not stop testing of matrix runs failed.  As it decided during PR review - it required 50/50& Let's check it with false.2829    strategy:30      matrix:31        include:32          - network: "sapphire"33            usage: ""34          - network: "opal"35            usage: ""36          - network: "quartz"37            usage: ""38          - network: "unique"39            usage: ""4041    steps:4243      - name: Clean Workspace44        uses: AutoModality/action-clean@v1.1.04546      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it47      - uses: actions/checkout@v348        with:49          ref: ${{ github.head_ref }}  #Checking out head commit5051      - name: Read .env file52        uses: xom9ikk/dotenv@v25354      - name: Generate ENV related extend file for docker-compose55        uses: cuchi/jinja2-action@v1.2.056        with:57          template: .docker/docker-compose.tmp-dev.j258          output_file: .docker/docker-compose.${{ matrix.network }}.yml59          variables: |60            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}61            NETWORK=${{ matrix.network }}62   63      - name: Show build configuration64        run: cat .docker/docker-compose.${{ matrix.network }}.yml6566      - name: Build the stack67        run: docker-compose -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans6869      - uses: actions/setup-node@v370        with:71          node-version: 167273      # - name: Install jq74      #   run: sudo apt install jq -y7576      - name: Run generate_types_package script77        working-directory: tests78        run: |79          yarn install80          /bin/bash ./scripts/wait_for_first_block.sh81          git config --global user.name "Unique"82          git config --global user.email github-actions@usetech.com          83          /bin/bash ./scripts/generate_types_package.sh --release ${{ matrix.usage }} --push84        env:85          RPC_URL: http://127.0.0.1:9933/8687      - name: Stop running containers88        if: always()                   # run this step always89        run: docker-compose -f ".docker/docker-compose.${{ matrix.network }}.yml" down9091      - name: Remove builder cache92        if: always()                   # run this step always93        run: |94          docker builder prune -f -a95          docker system prune -f96          docker image prune -f -a
modifiedtests/scripts/generate_types_package.shdiffbeforeafterboth
--- a/tests/scripts/generate_types_package.sh
+++ b/tests/scripts/generate_types_package.sh
@@ -9,12 +9,11 @@
 . $DIR/functions.sh
 
 usage() {
-	echo "Usage: [RPC_URL=http://localhost:9933] $0 <--rc|--release|--sapphire> [--force] [--push] [--rpc-url=http://localhost:9933]" 1>&2
+	echo "Usage: [RPC_URL=http://localhost:9933] $0 <--rc|--release> [--force] [--push] [--rpc-url=http://localhost:9933]" 1>&2
 	exit 1
 }
 
 rc=
-sapphire=
 release=
 force=
 push=
@@ -23,15 +22,11 @@
 case $i in
 	--rc)
 		rc=1
-		if test "$release" -o "$sapphire"; then usage; fi
-		;;
-	--sapphire)
-		sapphire=1
-		if test "$rc" -o "$release"; then usage; fi
+		if test "$release"; then usage; fi
 		;;
 	--release)
 		release=1
-		if test "$rc" -o "$sapphire"; then usage; fi
+		if test "$rc"; then usage; fi
 		;;
 	--force)
 		force=1
@@ -48,7 +43,7 @@
 esac
 done
 
-if test \( ! \( "$rc" -o "$release" -o "$sapphire" \) \) -o \( "${RPC_URL=}" = "" \); then
+if test \( ! \( "$rc" -o "$release" \) \) -o \( "${RPC_URL=}" = "" \); then
 	usage
 elif test "$rc"; then
 	echo "Rc build"
@@ -70,6 +65,11 @@
 		repo_branch=opal-testnet
 		repo_tag=$repo_branch
 		;;
+	sapphire)
+		package_name=@unique-nft/sapphire-mainnet-types
+		repo_branch=sapphire-mainnet
+		repo_tag=$repo_branch
+		;;
 	quartz)
 		package_name=@unique-nft/quartz-mainnet-types
 		repo_branch=quartz-mainnet
@@ -93,15 +93,6 @@
 	fi
 	package_name=@unique-nft/rc-types
 	repo_branch=rc
-	repo_tag=$repo_branch
-fi
-if test "$sapphire" = 1; then
-	if "$spec_name" != opal; then
-		echo "sapphire types can only be based on opal spec"
-		exit 1
-	fi
-	package_name=@unique-nft/sapphire-mainnet-types
-	repo_branch=sapphire-mainnet
 	repo_tag=$repo_branch
 fi