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] support maps in matrix arrays #54

Open
jimsheldon opened this issue Mar 28, 2023 · 2 comments
Open

[github] support maps in matrix arrays #54

jimsheldon opened this issue Mar 28, 2023 · 2 comments
Labels
backlog Investigate at a later date bug Something isn't working github GitHub Actions conversion target

Comments

@jimsheldon
Copy link
Contributor

Example pipeline

jobs:
  job1:
    strategy:
      matrix:
        app:
          [
            { name: theapp1, port: 8080, runner: my-runner },
            { name: theapp2, port: 8081, runner: ubuntu-latest },
            {
              name: theapp3,
              port: 8082,
              runner: my-other-runner,
            }
          ]
    name: build-${{ matrix.app.name }}
    runs-on: ${{ matrix.app.runner }}
    steps:
      - name: Build app
        run: ./build.sh ${{ matrix.app.name }}

Conversion fails

$ go-convert github example.yml
2023/03/28 09:54:00 yaml: unmarshal errors:
  line 7: cannot unmarshal !!map into string
  line 8: cannot unmarshal !!map into string
  line 9: cannot unmarshal !!map into string
@jimsheldon jimsheldon added bug Something isn't working github GitHub Actions conversion target labels Mar 28, 2023
@jimsheldon
Copy link
Contributor Author

jimsheldon commented Mar 28, 2023

Similar approach found here https://github.com/nedbat/coveragepy/blob/master/.github/workflows/kit.yml

Example

jobs:
  wheels:
    name: "${{ matrix.py }} ${{ matrix.os }} ${{ matrix.arch }} wheels"
    runs-on: ${{ matrix.os }}-latest
    strategy:
      matrix:
        include:
          - {"os": "ubuntu", "py": "cp310", "arch": "aarch64"}
          - {"os": "ubuntu", "py": "cp311", "arch": "aarch64"}
          - {"os": "macos", "py": "cp38", "arch": "arm64"}
          - {"os": "macos", "py": "cp311", "arch": "x86_64"}
          - {"os": "windows", "py": "cp37", "arch": "x86"}
          - {"os": "windows", "py": "cp310", "arch": "AMD64"}
          - {"os": "windows", "py": "cp311", "arch": "AMD64"}
      fail-fast: false

Converts successfully

$ go-convert github example.yml
stages:
- name: wheels
  spec:
    platform:
      arch: amd64
      os: linux
    runtime:
      spec: {}
      type: cloud
  strategy:
    spec:
      include:
      - arch: aarch64
        os: ubuntu
        py: cp310
      - arch: aarch64
        os: ubuntu
        py: cp311
      - arch: arm64
        os: macos
        py: cp38
      - arch: x86_64
        os: macos
        py: cp311
      - arch: x86
        os: windows
        py: cp37
      - arch: AMD64
        os: windows
        py: cp310
      - arch: AMD64
        os: windows
        py: cp311
    type: matrix
  type: ci
version: 1

Note that name strips out the matrix variables, and runs-on is missing.

@jimsheldon
Copy link
Contributor Author

Putting this in the backlog for now.

@jimsheldon jimsheldon added the backlog Investigate at a later date label Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Investigate at a later date bug Something isn't working github GitHub Actions conversion target
Projects
None yet
Development

No branches or pull requests

1 participant