Github Actions error

I’m new to GitHub actions and following a tutorial with the following yml. I’m getting a “duplicate mapping key” error on the line “-run: swift test --enable-test-discovery --sanitize=thread”. I think I need the “run: scrub swift…” in the steps: and the erroneous run is duplicated in the bionic build, but its a separate block? Any help would be appreciated. Thx.

name: test

on:
  pull_request:


jobs:
  test_on_macos:
    runs-on: macos-latest

env:
    DEVELOPER_DIR: /Applications/Xcode_11.5.app/Contents/Developer 
steps:
    -uses: actions/checkout@v2
    -run: xcrun swift test --enable-test-discovery --sanitize=thread

test_on_ubuntu_xenial:
  container:
    image: vapor/swift:5.2.2-xenial-ci
    runs-on: ubuntu-latest
    -run: apt update -y; apt install -y libsqlite3-dev    
    -uses: actions/checkout@v2
    -run: swift test --enable-test-discovery --sanitize=thread

test_on_ubuntu_bionic:
  container:
    image: vapor/swift:5.2.2-bionic-ci
    runs-on: ubuntu-latest
    steps:
    -run: apt update -y; apt install -y libsqlite3-dev 
    -uses: actions/checkout@v2
    -run: swift test --enable-test-discovery --sanitize=thread

I reformatted your included YAML to use a code block instead of a blockquote to make it more readable. I hope you don’t mind :grinning:

In addition, the thing that jumps out at me here is that the YAML specification requires a hyphen followed by a space for arrays. So instead of -run:, for example, you should be writing - run:, I suspect?

You may want to give that a try and see if that works better.

thanks… I tried using your re-format (thx)…and changed added the space as you directed. Unfortunately, I’m still getting the duplicate key error.

Another thing to note is that YAML is an indentation-significant language. So if your workflow is indented as it is shown in the code snippet above, that is probably causing some problems as well.

2 Likes

thanks… I’m using the GitHub editor and working through the indents… :upside_down_face:fingers crossed. :crossed_fingers:

1 Like

It appears to have worked… Github’s YAML editor helped do the trick on the indents. Appreciate your quick response… :grinning:

2 Likes