Github ci: add custom registry

Hi, I have a dependency that is not registered on General so I add this line to my ci.yml file (full file at the end) before to run the tests:

- run: julia -e 'import Pkg; Pkg.Registry.add(Pkg.RegistrySpec(url = "https://github.com/josePereiro/CSC_Registry.jl"))'

All was fine for linux and macos but windows is throwing this error.

Run julia -e 'import Pkg; Pkg.Registry.add(Pkg.RegistrySpec(url = escape_string("https://github.com/josePereiro/CSC_Registry.jl")))'
  julia -e 'import Pkg; Pkg.Registry.add(Pkg.RegistrySpec(url = escape_string("https://github.com/josePereiro/CSC_Registry.jl")))'
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
ERROR: syntax: "//" is not a unary operator
Stacktrace:
 [1] top-level scope at none:1
Error: Process completed with exit code 1.

What is the correct way of doing this?

Thank!

ci.yml
name: CI
on:
  pull_request:
    branches:
      - master
  push:
    branches:
      - master
    tags: '*'
jobs:
  test:
    name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        version:
          - '1.5' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
          - '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
          - 'nightly'
        os:
          - ubuntu-latest
          - macOS-latest
          - windows-latest
        arch:
          - x64
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@v1
        with:
          version: ${{ matrix.version }}
          arch: ${{ matrix.arch }}
      - uses: actions/cache@v1
        env:
          cache-name: cache-artifacts
        with:
          path: ~/.julia/artifacts
          key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
          restore-keys: |
            ${{ runner.os }}-test-${{ env.cache-name }}-
            ${{ runner.os }}-test-
            ${{ runner.os }}-
      - run: julia -e 'import Pkg; Pkg.Registry.add(Pkg.RegistrySpec(url = "https://github.com/josePereiro/CSC_Registry.jl"))'
      - uses: julia-actions/julia-buildpkg@v1
      - uses: julia-actions/julia-runtest@v1
1 Like

Adding shell: bash solved this problem for me.

- run: julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url = "..."))'
  shell: bash
2 Likes