coq-community / docker-coq-action

GitHub Action using Docker-Coq [maintainers=@erikmd,@Zimmi48]
MIT License
12 stars 4 forks source link

Pass environment variables into Docker #23

Closed liyishuai closed 4 years ago

liyishuai commented 4 years ago

I want to set OPAMWITHTEST=true to perform run-test, but cannot do it with GitHub Actions' env, because that parameter should be passed into Docker.

liyishuai commented 4 years ago

and OPAMYES should always be set to true for CI.

erikmd commented 4 years ago

OK so I did some experiments, to summarize:

the GitHub Actions YAML syntax wouldn't support putting an env map in the docker-coq-action options:

https://github.com/erikmd/docker-coq-github-action-demo/actions/runs/166741107

However a working solution would consist in putting one such env map in one level above, and adding an option telling which variables to export within the Docker context:

  - uses: coq-community/docker-coq-action@todo
    with:
      opam_file: 'folder/coq-proj.opam'
      coq_version: ${{ matrix.coq_version }}
      ocaml_version: ${{ matrix.ocaml_version }}
      export_vars: 'VARIABLE OPAMWITHTEST'  # space-separated list of variables
    env:
      VARIABLE: 'some value'
      OPAMWITHTEST: 'true'

I didn't implement this fully yet, but would this syntax look good to you @liyishuai @Zimmi48 ?

erikmd commented 4 years ago

OPAMYES should always be set to true for CI.

This is not already the case indeed, but currently the -y option is inserted everywhere in the underlying script. But I don't see any drawback of always passing this environment variable by default.

liyishuai commented 4 years ago

The syntax looks good.