GSoC ' 2024 MetaCall
Connect Core CI with distributables

Feature

Consistent CI across multiple repositories in order to provide continuous delivery of MetaCall binaries with report of errors for when some distributable fails on a version of MetaCall Core.

Earlier when a new tag was being pushed it would only trigger the core repo CI to build binaries. Adding a new CI in which when a new tag is pushed and repo is built successfully then it will trigger the distributable repo’s (windows/linux/macos) to build new binaries with newer version/tags.

Describe the solution’s you’d like

Respository Dispatch

My current solution uses github.com/peter-evans/repository-dispatch@v2. Where we can use this Github Action to trigger in remote repo

Dispatch to multiple repositories. You can dispatch to multiple repositories by using a matrix strategy. In the following example, after the build job succeeds, an event is dispatched to three different repositories. The repository dispatch function can be used in 2 different method’s

  1. creating a seprate file and adding the followinfg code into the file after adding tests etc.
name: Release

on:
  push:
    tags:
    - 'v*.*.*'

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

env:
  GHR_VERSION: 0.12.0
  IMAGE_NAME: index.docker.io/metacall/core
  IMAGE_REGISTRY: index.docker.io
  ARTIFACTS_PATH: ./build-artifacts
  # GITHUB_TOKEN      - From default secrets
  # GITHUB_REPOSITORY - Default variable

jobs:
  build:
    name: Build the core
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repo
        uses: actions/checkout@v4
.
.
.
. [continued in core]
.
.
 dispatch:
    needs: build
    strategy:
      matrix:
        repo: ['company/repo1', 'company/repo2', 'company/repo3']
    runs-on: ubuntu-latest
    steps:
      - name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v3
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          repository: ${{ matrix.repo }}
          event-type: test-trigger   
  1. Adding the repository dispatch script to the test files of all the OS(windows, linux & macOS) & the distributable repos. So that if the test passes of that OS only then it will trigger the distributables repo CI. Add the following end-code in the CI tests file with proper changes to make it run.
name: CI Signal to other dist repos

on:
  push:
    tags:
      - 'v*'

jobs:
  check_completion:
    runs-on: ubuntu-latest
    outputs:
      {other OS}
      windows_success: ${{ steps.windows.outputs.success }}
      - name: Check Windows Test Completion
        id: windows
        if: github.event.workflow_run.name == 'Windows Test'
        run: |
          echo "::set-output name=success::${{ github.event.workflow_run.conclusion == 'success' }}"          

  dispatch_windows:
    if: ${{ steps.check_completion.outputs.windows_success == 'true' }}
    runs-on: ubuntu-latest
    steps:
      - name: Windows Repository Dispatch
        uses: peter-evans/repository-dispatch@v3
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          repository: shaggyyy2002/distributable-windows
          event-type: test-trigger

Add the code to the test files, so that when the test completes, it then trigger to that distributable repo eg. Windows test successful -> triggers -> dist-windows

  trigger_dist_windows:
    needs: windows-test
    if: ${{ success() }}
    runs-on: ubuntu-latest
    steps:
      - name: Windows Repository Dispatch
        uses: peter-evans/repository-dispatch@v3
        with:
          token: ${{ secrets.ACCESS_TOKEN }}
          repository: metacall/distributable-windows
          event-type: test-trigger
          ref: ${{ github.ref }}

How it works

Limitations

How to implement this

How to further strengthen

Examples

Further resources