diff --git a/.github/workflows/branch-develop.yml b/.github/workflows/branch-develop.yml index a01ef72bcc..60cba73dfe 100644 --- a/.github/workflows/branch-develop.yml +++ b/.github/workflows/branch-develop.yml @@ -154,9 +154,19 @@ jobs: version: ${{ needs.init.outputs.GLOBAL_VERSION }} cluster_name: mangata-dev-alpha + generate-types: + name: Generate types + needs: [init, build-and-test] + uses: ./.github/workflows/reusable-generate-types.yml + secrets: inherit + with: + branch: ${{ needs.init.outputs.GIT_BRANCH }} + parachainDocker: ${{ github.event.inputs.parachainDocker }} + globalVersion: ${{ needs.init.outputs.GLOBAL_VERSION }} + run-e2e-test: name: Run e2e tests - needs: [init, build-and-test] + needs: [init, build-and-test, generate-types] uses: ./.github/workflows/reusable-e2e-tests.yml secrets: inherit with: diff --git a/.github/workflows/reusable-e2e-tests.yml b/.github/workflows/reusable-e2e-tests.yml index 3b23b3efc5..c575a16779 100644 --- a/.github/workflows/reusable-e2e-tests.yml +++ b/.github/workflows/reusable-e2e-tests.yml @@ -22,6 +22,11 @@ on: description: "Set Mangata node version." type: string required: true + mangataTypesVersion: + description: "Set @mangata-finance/types version" + type: string + default: "" + required: false workflow_call: inputs: e2eBranch: @@ -153,6 +158,14 @@ jobs: run: | echo "This job name branch is: ${{ steps.branch-name.outputs.current_branch }}" + - name: Current branch name for generating types + run: | + echo "MANGATA_TYPES_VERSION=${{ steps.branch-name.outputs.current_branch }}" | sed "s@/@-@g" >> $GITHUB_ENV + + - name: What version of mangata types will be installed + run: | + echo "Correct branch for types: ${{ env.MANGATA_TYPES_VERSION }}" + - name: E2E- Calculate if run e2e feature branch or main. run: | echo DEFAULT: E2E test will run with: $E2EBRANCHNAME @@ -192,7 +205,17 @@ jobs: - name: Install e2e tests dependencies working-directory: e2eTests # TODO: remove cache clean later - run: yarn cache clean; yarn + run: | + yarn cache clean + yarn + + - name: Install @mangata-finance/types deps + run: | + if [[ -n "${{ github.event.inputs.mangataTypesVersion }}" ]]; then + yarn add @mangata-finance/types@${{ github.event.inputs.mangataTypesVersion }} + else + yarn add @mangata-finance/types@${{ env.MANGATA_TYPES_VERSION }} + fi - name: Run parachain launch working-directory: devops/parachain-launch diff --git a/.github/workflows/reusable-generate-types.yml b/.github/workflows/reusable-generate-types.yml new file mode 100644 index 0000000000..038bc30b54 --- /dev/null +++ b/.github/workflows/reusable-generate-types.yml @@ -0,0 +1,67 @@ +name: Reusable generate types workflow + +on: + workflow_dispatch: + inputs: + branch: + description: "Branch to create in mangata-dev-kit" + type: string + required: true + parachainDocker: + description: "Name of the parachain docker reference" + type: string + required: false + default: "mangatasolutions/mangata-node:latest" + globalVersion: + description: "Set Mangata node version." + type: string + required: true + workflow_call: + inputs: + branch: + description: "Branch to create in mangata-dev-kit" + type: string + required: true + parachainDocker: + description: "Name of the parachain docker reference" + type: string + required: false + default: "mangatasolutions/mangata-node:latest" + globalVersion: + description: "Set Mangata node version." + type: string + required: true + +permissions: + contents: write + id-token: write + deployments: write + checks: write + +jobs: + generate-mangata-types: + runs-on: ubuntu-latest + env: + MANGATA_NODE_VERSION: ${{ inputs.globalVersion }} + PARACHAIN_DOCKER_IMAGE: ${{ inputs.parachainDocker || format('mangatasolutions/mangata-node:{0}', inputs.globalVersion) }} + BRANCH: ${{ inputs.branch }} + steps: + - uses: actions/checkout@v3 + + - name: Create branch ${{ env.BRANCH }} in mangata-dev-kit + uses: GuillaumeFalourd/create-other-repo-branch-action@v1.5 + with: + repository_owner: mangata-finance + repository_name: mangata-dev-kit + new_branch_name: ${{ env.BRANCH }} + ignore_branch_exists: true + access_token: ${{ secrets.BOT_GITHUB_TOKEN }} + + - name: Invoke workflow in mangata-dev-kit repo with inputs + uses: jonas-schievink/workflow-proxy@v1 + with: + ref: ${{ env.BRANCH }} + workflow: pre-release-types.yml + repo: mangata-finance/mangata-dev-kit + token: ${{ secrets.BOT_GITHUB_TOKEN }} + inputs: '{"parachainDocker": "${{ env.PARACHAIN_DOCKER_IMAGE }}", "branch": "${{ env.BRANCH }}"}' \ No newline at end of file