Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Incorporate get-tested as an action #189

Open
1 task
Kleidukos opened this issue Feb 13, 2023 · 6 comments
Open
1 task

Incorporate get-tested as an action #189

Kleidukos opened this issue Feb 13, 2023 · 6 comments
Labels
re: matrix Concerning the matrix strategy

Comments

@Kleidukos
Copy link
Member

Kleidukos commented Feb 13, 2023

https://github.com/Kleidukos/get-tested could be provided in a more ergonomic way to encourage package maintainers to declare supported compiler versions in their cabal files.

cc @hazelweakly

Example usage

jobs:
  generateMatrix:
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    steps:
      - name: Checkout base repo
        uses: actions/checkout@v3
      - name: Extract the tested GHC versions
        id: set-matrix
        uses: actions/haskell/get-tested@v2
  tests:
    name: ${{ matrix.ghc }} on ${{ matrix.os }}
    needs: generateMatrix
    runs-on: ${{ matrix.os }}
    strategy:
      matrix: ${{ fromJSON(needs.generateMatrix.outputs.matrix) }}
    steps:
      - name: Checkout base repo
        uses: actions/checkout@v3
      - name: Set up Haskell
        id: setup-haskell
        uses: haskell/actions/setup@v2
        with:
          ghc-version: ${{ matrix.ghc }}
          cabal-version: 'latest'
          caching-keys: |
            ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
            ${{ runner.os }}-${{ matrix.ghc }}-
      - name: Configure
        run: ./.github/workflows/install-libsodium.sh
      - name: Freeze
        run: cabal freeze
      - name: Build
        run: cabal build libsodium-bindings
      - name: Test
        run: cabal test libsodium-bindings

Stuff to figure out:

@Kleidukos
Copy link
Member Author

@michaelpj I believe this is relevant to your experiment on the HLS repo

@michaelpj
Copy link

HLS has many packages so putting all the information in the cabal files would be a lot of duplication, which defeats the point a bit. What I'm trying to do in that PR is reduce the duplication that we already have.

I'm sure it's a different story for single-package repos!

@Kleidukos
Copy link
Member Author

Thanks for the clarification! :)

@andreasabel
Copy link
Member

@Kleidukos: Thanks for pointing to your action and workflow! Very useful!

Kleidukos/get-tested could be provided in a more ergonomic way

Could you spell out your intent, i.e., what you mean by "could be provided in a more ergonomic way"?

Observe:

@Kleidukos
Copy link
Member Author

Could you spell out your intent, i.e., what you mean by "could be provided in a more ergonomic way"?

Okay so at the moment, its usage looks like this:

jobs:                                                                                                                   
  generateMatrix:                                                                                                       
    name: "Generate matrix from cabal"                                                                                  
    runs-on: ubuntu-latest                                                                                              
    outputs:                                                                                                            
      matrix: ${{ steps.set-matrix.outputs.matrix }}                                                                    
    steps:                                                                                                              
      - name: Checkout base repo                                                                                        
        uses: actions/checkout@v2                                                                                       
      - name: Extract the tested GHC versions                                                                           
        id: set-matrix                                                                                                  
        run: |                                                                                                          
          wget https://github.com/Kleidukos/get-tested/releases/download/v0.1.3.0/get-tested-0.1.3.0-linux-amd64 -O get-tested
          chmod +x get-tested                                                                                           
          ./get-tested --ubuntu --macos text-display.cabal >> $GITHUB_OUTPUT

and I'd like to provide an action so that it may be used as:

jobs:
  generateMatrix:
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    steps:
      - name: Checkout base repo
        uses: actions/checkout@v3
      - name: Extract the tested GHC versions
        id: set-matrix
        uses: actions/haskell/test-matrix # proper GH Action

@andreasabel
Copy link
Member

Ah, ok, so there would be two steps:

  1. Write and release an action that creates a build matrix (or should it be a GHC version vector?) via get-tested.
  2. Host it on haskell/actions.

Concerning 2., I have reservations because GitHub Marketplace does not support our "host multiple actions in one repo" approach, see #141. I suggest to host it yourself until this issue is settled.

Concerning 1., having such an action would be great indeed!

  • The easiest path to success (without knowing much about typescript or action writing) is to release a so-called "composite action". I did this recently, see https://github.com/andreasabel/fix-whitespace-action/blob/master/action.yml .
  • Composite actions have the drawback that they leak their implementation when run (so their log is confusing). Thus, a proper typescript implementation is certainly preferable, but has a higher entrance bar for the author.
  • Ideally, get-tested binaries would be available for all three platforms (Linux, macOS, Windows).

@andreasabel andreasabel added the re: matrix Concerning the matrix strategy label Feb 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
re: matrix Concerning the matrix strategy
Projects
None yet
Development

No branches or pull requests

3 participants