Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update workflow generate types #623

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/branch-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/reusable-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/reusable-generate-types.yml
Original file line number Diff line number Diff line change
@@ -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 }}"}'
Loading