Fork me on GitHub
#datomic
<
2023-01-08
>
Jakub Holý (HolyJak)20:01:50

Hi folks! Do you have any tips for how to use dev-local with a GitHub Action? Namely I want to run https://github.com/fulcrologic/fulcro-rad-demo/pull/42/files#diff-c9346137b015156901cb500b96f00582ba4ff714a3cd3fabd9a6cdc93496e4cfR43 but currently have to skip running it for https://github.com/fulcrologic/fulcro-rad-demo/blob/main/deps.edn#L42-L44 b/c com.datomic/dev-local is not in Maven central. Do I need to add the cognitect repo and set up ~/.m2/settings.xml with my credentials, presumably leveraging https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28 to store my credentials? Or is there a simpler way? Thank you! (Notice this is a publicly accessible, OSS repo.)

vncz23:01:54

I wondered about that myself and that is the only possible way I found so far

🙏 2
Daniel Jomphe14:01:47

For a regular Github Action, it's very easy to setup Java and Maven's settings in one go:

- name: Install Java
        uses: actions/setup-java@v3 # 
        with:
          distribution: 'corretto'
          java-version: '11'
          server-id: cognitect-dev-tools
          server-username: MVN_DEVTOOLS_EML
          server-password: MVN_DEVTOOLS_PWD
The above generates the following on your test runner instance:
cat ~/.m2/settings.xml
<settings xmlns=""
  xmlns:xsi=""
  xsi:schemaLocation=" ">
  <servers>
    <server>
      <id>cognitect-dev-tools</id>
      <username>${env.MVN_DEVTOOLS_EML}</username>
      <password>${env.MVN_DEVTOOLS_PWD}</password>
    </server>
  </servers>
</settings>
So you need to prepare the envars for their usage when any process will want to read the maven settings file:
- name: Start backend
        env:
          MVN_DEVTOOLS_EML: ${{ secrets.MVN_DEVTOOLS_EML }}
          MVN_DEVTOOLS_PWD: ${{ secrets.MVN_DEVTOOLS_PWD }}
        run: |
          mkdir -p log
          DATOMIC_ENV_MAP="{:env :...}" clojure -M:dev... &> log/....log &

cch120:01:52

You can also put the jar in source (admittedly, yucky) and use :local/root in your deps.edn

Jakub Holý (HolyJak)22:01:25

can you? I am not sure that the license permits that

cch122:01:16

Sorry, I was assuming that your “sources” was private to you. If that is the case, I don’t think the license prohibits you from bundling the jar with your SCM-controlled source as long as it is only “controllable” by you and used for your internal business processes. If the source ls put into a public repo then that would be a problem.

Jakub Holý (HolyJak)09:01:58

no, it is all open source

Daniel Jomphe14:01:47

For a regular Github Action, it's very easy to setup Java and Maven's settings in one go:

- name: Install Java
        uses: actions/setup-java@v3 # 
        with:
          distribution: 'corretto'
          java-version: '11'
          server-id: cognitect-dev-tools
          server-username: MVN_DEVTOOLS_EML
          server-password: MVN_DEVTOOLS_PWD
The above generates the following on your test runner instance:
cat ~/.m2/settings.xml
<settings xmlns=""
  xmlns:xsi=""
  xsi:schemaLocation=" ">
  <servers>
    <server>
      <id>cognitect-dev-tools</id>
      <username>${env.MVN_DEVTOOLS_EML}</username>
      <password>${env.MVN_DEVTOOLS_PWD}</password>
    </server>
  </servers>
</settings>
So you need to prepare the envars for their usage when any process will want to read the maven settings file:
- name: Start backend
        env:
          MVN_DEVTOOLS_EML: ${{ secrets.MVN_DEVTOOLS_EML }}
          MVN_DEVTOOLS_PWD: ${{ secrets.MVN_DEVTOOLS_PWD }}
        run: |
          mkdir -p log
          DATOMIC_ENV_MAP="{:env :...}" clojure -M:dev... &> log/....log &