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 actions #26

Merged
merged 12 commits into from
Apr 1, 2024
Merged

github actions #26

merged 12 commits into from
Apr 1, 2024

Conversation

vasylenko
Copy link
Contributor

Attempt to use GitHub actions instead of CircleCI

@vasylenko
Copy link
Contributor Author

@alexander-yakushev @roman-p
take a look, please
would that work instead of CircleCI?

@alexander-yakushev
Copy link
Contributor

Thank you! Yes, Actions will work too. There is currently a bug in the build script, the tests should pass if you make this change:

--- a/build.clj
+++ b/build.clj
@@ -32,5 +32,5 @@
   (bb/clean opts)
   (bb/run-tests (cond-> (assoc opts :aliases [:ssm])
-                  (:clj opts) (update :aliases into (:clj opts))))
+                  (:clj opts) (update :aliases conj (:clj opts))))
   opts)

@vasylenko
Copy link
Contributor Author

@alexander-yakushev cool! That worked! Thanks!

There's one more thing that does not work as expected (I guess) — the cache-saving
In CircleCI config, we're trying to cache ~/.m2. But with GH Actions, this does not work :-(
Neither ~/.m2 nor $HOME/.m2:

Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

(error when trying to save cache)

There's a bug where ~ does not work as expected in some Actions, but looks like it should work OK particularly with the cache action: softprops/action-gh-release#368 (comment)

Do we have/create/operate that directory at all? Did that work in CircleCI?
Just want to understand whether it's an Action issue or if it did not work before too.

@alexander-yakushev
Copy link
Contributor

The ~/.m2 directory is created when the dependencies are pulled – there's now way it is not present. I see that the example you linked and also other examples I find uses this action: actions/cache@v3, but your config has actions/cache/restore@v4. Is this the newer version of the action? Could it be that it doesn't support ~?

@vasylenko
Copy link
Contributor Author

@alexander-yakushev turned out it was a well-known GithHub Actions bug/feature when HOME inside the container is overridden by the runner's home: actions/runner#1876, actions/runner#863

So I used /root/.m2 and it works now.
However, with the cache key defined as project-${{ hashFiles('deps.edn') }} we have another issue:


/usr/bin/docker exec  53afe64f7e8c4bc8180d09e1525cc3d230a353e6fffc5ffa8188edbd377d75c8 sh -c "cat /etc/*release | grep ^ID"
/usr/bin/tar --posix -cf cache.tgz --exclude cache.tgz -P -C /__w/omniconf/omniconf --files-from manifest.txt -z
Failed to save: Unable to reserve cache with key project-f2c3871ce0af1620819c90af9d77864c2149e3184baf9d1d5765eff0c0a5b3fa, another job may be creating this cache. More details: Cache already exists. Scope: refs/pull/26/merge, Key: project-f2c3871ce0af1620819c90af9d77864c2149e3184baf9d1d5765eff0c0a5b3fa, Version: 0124b87dceb51f4826aba458de85d927c8026eadcff99ef93324f5e56c6befc4
Warning: Cache save failed.

It is the same key for all jobs.

So I changed that to ${{ matrix.docker-image }}-${{ matrix.clj-version }}-${{ hashFiles('deps.edn') }} to make it related to each specific combination of the temurin and clj versions. I suppose there is no sense to have the same cache for all combinations because of the different versions, but instead the intention is to have the cache for particular combination. Anyway, feel free to change that as needed, the important thing is that caching works now.

btw, the cache's TTL is 7 days: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy

Answering your question about actions/cache/restore@v4: v4 is newer and restore/save actions are the way to orchestrate the cache actions: https://github.com/actions/cache?tab=readme-ov-file#using-a-combination-of-restore-and-save-actions

@alexander-yakushev
Copy link
Contributor

alexander-yakushev commented Mar 31, 2024

Looks great to me! I say you can just delete the old CircleCI config and let's squash-merge this. ❤️

@vasylenko vasylenko merged commit 3675734 into master Apr 1, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants