tarantool / tarantool

Get your data in RAM. Get compute close to data. Enjoy the performance.
https://www.tarantool.io
Other
3.39k stars 379 forks source link

Reuse GitHub workflows definitions #6604

Open locker opened 2 years ago

locker commented 2 years ago

We have quite a few almost identical GitHub workflows, which differ by just a few lines:

diff -u .github/workflows/fedora_30.yml .github/workflows/ubuntu_18_04.yml ```diff --- .github/workflows/fedora_30.yml 2021-10-27 12:00:53.271846099 +0300 +++ .github/workflows/ubuntu_18_04.yml 2021-10-27 12:00:53.275846083 +0300 @@ -1,4 +1,4 @@ -name: fedora_30 +name: ubuntu_18_04 on: push: @@ -8,7 +8,7 @@ workflow_dispatch: jobs: - fedora_30: + ubuntu_18_04: # We want to run on external PRs, but not on our own internal PRs # as they'll be run by the push to the branch. if: ( github.event_name == 'push' || @@ -41,8 +41,8 @@ PRERELEASE_REPO_S3_DIR: ${{ secrets.PRERELEASE_REPO_S3_DIR }} GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} GPG_SIGN_KEY: ${{ secrets.GPG_SIGN_KEY }} - OS: 'fedora' - DIST: '30' + OS: 'ubuntu' + DIST: 'bionic' uses: ./.github/actions/pack_and_deploy - name: call action to send Telegram message on failure env: @@ -54,6 +54,6 @@ uses: actions/upload-artifact@v2 if: failure() with: - name: fedora-30 + name: ubuntu-bionic retention-days: 21 path: build/usr/src/*/tarantool-*/test/var/artifacts ```

Bulk-patching them is toilsome and error-prone, e.g. see 73bf6a66f1c8046e93daa57948eda881bfbfb37f.

Looks like GitHub supports reusing workflows. Need to investigate if it's applicable in our case.

Totktonada commented 2 years ago

The idea behind splitting jobs one per workflow is ability to re-run them individually (that is especially important for package deployments). GitHub does not allow to re-run individual jobs, when they're grouped in one workflow, but I hope it'll be fixed in 2021: https://github.com/github/roadmap/issues/271.

locker commented 2 years ago

The idea behind splitting jobs one per workflow is ability to re-run them individually (that is especially important for package deployments). GitHub does not allow to re-run individual jobs, when they're grouped in one workflow, but I hope it'll be fixed in 2021: github/roadmap#271.

According to this document, it's possible to reuse a workflow, so AFAIU we can still have one workflow per package deployment while having most of the code in one reusable workflow definition file.

Totktonada commented 2 years ago

There is also an idea about deduplication the Telegram notification code.

Totktonada commented 2 years ago

The idea behind splitting jobs one per workflow is ability to re-run them individually (that is especially important for package deployments). GitHub does not allow to re-run individual jobs, when they're grouped in one workflow, but I hope it'll be fixed in 2021: https://github.com/github/roadmap/issues/271.

Re-running of individual jobs is implemented now: https://github.blog/2022-03-16-save-time-partial-re-runs-github-actions/