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

GitHub CI: Deduplicate workflow configuration #2422

Open
Anton-Latukha opened this issue Nov 30, 2021 · 9 comments
Open

GitHub CI: Deduplicate workflow configuration #2422

Anton-Latukha opened this issue Nov 30, 2021 · 9 comments
Labels
CI Continuous integration type: enhancement New feature or request

Comments

@Anton-Latukha
Copy link
Collaborator

Anton-Latukha commented Nov 30, 2021

After adding #2419, workflow configs, platform-specific things & matrix'es became shotgun-surgery enough to think about doing the https://docs.github.com/en/actions/learn-github-actions/reusing-workflows#overview work to configure configuration in workflows in one place as much as possible.

@Anton-Latukha
Copy link
Collaborator Author

Anton-Latukha commented Nov 30, 2021

At the same time it would be useful to look into: does those $CABAL*-platform depended env variables even need to be set, or the:

      - name: "Haskell env setup"
        id: HaskEnvSetup
        uses: haskell/actions/setup@v1
        with:
          ghc-version: ${{ matrix.ghc }}
          
### ...
      - name: "Configuring GitHub cache"
        uses: actions/cache@v2
        with:
          path: |
            ${{ steps.HaskEnvSetup.outputs.cabal-store }}

is enough (seems enough).

@jneira jneira added CI Continuous integration and removed status: needs triage labels Dec 1, 2021
@jneira
Copy link
Member

jneira commented Dec 1, 2021

Thanks for opening the issue, reusing workflows looks promising

@Anton-Latukha
Copy link
Collaborator Author

Anton-Latukha commented Dec 2, 2021

Bad news: seems like OS/GHC matrix seems to be needed to be restated for every reusable workflow.

Good news: It would save in code complexity & maintenance anyway. I already today churned to keep in sync the cache-deps & test code & decided to concentrate only on the first one. And deduplicating that code would make CI work & setup more robust.

@Anton-Latukha
Copy link
Collaborator Author

The first thing to do with reusable workflows - is to start with having a workflow for cabal.project processing. The file basically can be passed even as a value. But it is useful to do it through artifact passing.

@Anton-Latukha
Copy link
Collaborator Author

Anton-Latukha commented Dec 6, 2021

I looked into what GitHub has & it is ...

I basically wanted/imagined simple things:

  • as loading & sharing the steps or jobs (for example loading them from json).
  • macros are impossible.

Also, GitHub CI allows only 1 level of inheritance (does not allow to inherit workflow that inherited anything).

Caching is designed by GitHub so - that its setup is not sharable, every workflow that uses caching - needs the action setup.

So ... deduplication is limited. The best possible I see is still sync files into seamless form & then look at how to do #2422 (comment)

I hope in the future GitHub would expand reuse abilities.

@jneira
Copy link
Member

jneira commented Dec 6, 2021

What about custom actions? could we extract some reusable bits and make it actions (like our use of skip actions)?

@Anton-Latukha
Copy link
Collaborator Author

Anton-Latukha commented Dec 7, 2021

Custom actions are also partial solutions & not flawless.

There are JS, sh & docker actions, each has its pros & cons. I know that now GitHub allows caching inside actions, but do not how system works or its limitations.

@Anton-Latukha
Copy link
Collaborator Author

I've looked into DHall & its alternatives.

& DHall syntax is not pretty, & it is { } based. But seems there are no real alternatives with such abilities & it should do the job.

I am not holding my breath to be surprised or anything, but we would see.

I for this purpose tried to unify a subset of yml as much as possible.

@Anton-Latukha
Copy link
Collaborator Author

There are also automations for CI to keep generated files in accordance with dhall changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous integration type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants