Це відео не доступне.
Перепрошуємо.

Caching Dependencies to SPEED UP Workflows in GitHub Actions

Поділитися
Вставка
  • Опубліковано 15 сер 2024
  • To make your GitHub Actions workflows faster and more efficient, you can start Caching Dependencies to SPEED UP Workflows in GitHub Actions, for dependencies and other commonly reused files.
    GitHub Actions caching is not complex, let's take a look at it in 3 minute. We will see how to add cache to GitHub Actions!
    Learn how to use the GitHub Actions Cache
    🌟EXCLUSIVE CONTENT🌟
    Do you want to access exclusive content, live chats and Q&As, polls, and even 1:1 calls with me? Join my Patreon: / coderdave
    🆘 NEED HELP? 🆘
    Book a 1:1 Consultation with CoderDave: geni.us/cdconsult
    🙏🏻SUPPORT THE CHANNEL🙏🏻
    Buy me a coffee: www.buymeacoff...
    PayPal me donation: paypal.me/dabe...
    💬JOIN THE COMMUNITY
    ► Website: coderdave.io
    ► Discord: geni.us/cddiscord
    ► Newsletter: coderdave.io/n...
    ► Blog: dev.to/n3wt0n
    ► GitHub: github.com/n3wt0n
    ► Twitter: / davidebenvegnu
    ► Facebook: / coderdaveyt
    🎥VIDEOS
    ► Automate EVERYTHING with GitHub Actions: • Automate EVERYTHING wi...
    ► How to trigger GitHub Actions manually: • We can START GitHub Ac...
    ► Composite GitHub Actions: • GitHub Actions - Compo...
    🎤PODCAST: geni.us/cdpodcast
    ❓QUESTIONS?
    Have a question about DevOps, Cloud, Coding, or Anything Else? Post in comments section of this video!
    🔴SUBSCRIBE to CoderDave here: www.youtube.co...
    _______________
    👕GET MY MERCH: geni.us/cdmerch
    🔮TOOLS I USE
    ► Twingate - Connect to your Private Resources SECURELY: geni.us/twingate
    ► TubeBuddy - #1 UA-cam channel Management tool (FREE): www.tubebuddy....
    ► Moosend - Free Newsletter and Automation Platform: geni.us/moosend
    📸🖥️GEAR AND SOFTWARE
    ► Music - Epidemic Sound (Get 30 days free): epidemicsound....
    ► Editing - Adobe Premiere Pro: geni.us/AdobeV...
    ► Gear I Use for UA-cam: kit.co/CoderDa...
    ► Gear I Use for Streaming: kit.co/CoderDa...
    ► My Computer Setup: kit.co/CoderDa...
    ► Full office setup: github.com/n3w...
    Disclaimer:
    Some product links are affiliate links which means if you buy something I'll receive a small commission at no additional cost to you.
    As an Amazon Associate, I earn from qualifying purchases.

КОМЕНТАРІ • 31

  • @DevsLikeUs
    @DevsLikeUs 3 роки тому +1

    Great advice , thank you!

  • @jonyijoe
    @jonyijoe 3 роки тому +1

    This was an amazing video thanks a lot

    • @CoderDave
      @CoderDave  3 роки тому +1

      Thanks! Really happy it’s been helpful ☺️

  • @Chrosam
    @Chrosam 9 місяців тому

    Don't you wish UA-cam had a feature to track how many minutes and seconds a video has progressed so far ?

  • @alexandervu6015
    @alexandervu6015 3 роки тому +1

    Great and amazing video. Thanks a lot!!! Some advice on npm. We do not use `npm install` but `npm ci`. `npm install` do not use the package-lock.json file. `npm ci` do.

    • @CoderDave
      @CoderDave  3 роки тому +1

      Thanks for your comment. Npm ci is only available in version 6, if someone is using version 5 they wouldn’t have it. Also, since I’m using it in Hosted Agents I don’t have the problem of needing to make sure it’s a clean state... because it is always a new clean agent by design. Finally, you can’t cache npm ci... in fact, if it finds an npm modules folder it deletes it and reinstall everything

  • @omoruboreoluwatobi6115
    @omoruboreoluwatobi6115 Рік тому +1

    @CoderDave what if you want the cache action to work for different JOBS. In your case you only use it inside BUILD. In my case I want to use the automated dependencies in TEST, BUILD, ANALYSE

    • @CoderDave
      @CoderDave  Рік тому

      I think it should be possible, just using the same key to retrieve from the caceh

  • @moustafakamal9399
    @moustafakamal9399 3 роки тому +1

    Amazing thnx!

  • @ashikurrahman4875
    @ashikurrahman4875 Рік тому

    Life saver!

    • @CoderDave
      @CoderDave  Рік тому

      Very happy you liked it ☺️

  • @Cyril_C_C
    @Cyril_C_C 2 роки тому +2

    Hi Dave,
    Please, could you send me link to this project, let me try it myself.
    I'm new to this, please.
    Thank you. Regards

    • @CoderDave
      @CoderDave  2 роки тому +2

      Hi, here is the link to the GitHub Actions file: github.com/n3wt0n/HKOSCon2020/blob/master/.github/workflows/npmCache.yml

    • @Cyril_C_C
      @Cyril_C_C 2 роки тому +1

      @@CoderDave
      Thank you so much, Dave.
      I will keep in touch with you always.
      Definitely, I will join your community as I am preparing to join CI team at College of Computer Science, University of Illinois.
      Take good care always. Cheers.
      Regards
      Cyril

  • @travissimmons8129
    @travissimmons8129 2 роки тому +1

    @CoderDave can the id value be dynamic or does it have to be a static value like what you have in the video with: myCacheStep

    • @CoderDave
      @CoderDave  2 роки тому

      Good question. The ID must be static, because it is used before runtime to generate an execution plan for the Action. It is used to reference that step in other steps

    • @travissimmons8129
      @travissimmons8129 2 роки тому +1

      @@CoderDave Thank you. I could not find this documented anywhere.

  • @Cyril_C_C
    @Cyril_C_C 2 роки тому +2

    Dave, I was wondering...
    How would your caching know if the dependencies changed or not, i.e.,
    whether it can use the result from the cache or not?
    Thanks

    • @Cyril_C_C
      @Cyril_C_C 2 роки тому +1

      😇😇😇 Waiting for your response...

    • @CoderDave
      @CoderDave  2 роки тому +3

      The cache knows that based on the `key` which is specified. In the example I used (and the file linked to my other comment), you see that they key for the cache is cmposed by the runner OS, a cachename variable and most importantly by the hash of the dependency definition file. Because of that, if a dependency changes the hash of the file will be different, making the cache key different... hence, the cache knows that it can't use the current cache value but will generate a new one
      PS: I've replied to your email as well

    • @Cyril_C_C
      @Cyril_C_C 2 роки тому +2

      @@CoderDave
      Thank you so much, Dave...

    • @Cyril_C_C
      @Cyril_C_C 2 роки тому +1

      @@CoderDave
      Hi Dave,
      Just some concerns below:
      >>>> The cache knows that based on the `key` which is specified.
      >>>> the key [...] is composed [...] the hash of the dependency definition file.
      What if some dependency/ies have the same name but different content? In
      the Java world, one usually does that by naming dependencies SNAPSHOT. I
      don't know what's commonly done in the NPM world.
      Thank you so much.
      Regards

    • @CoderDave
      @CoderDave  2 роки тому +1

      Hey, well that shouldn’t be a problem. You should never have 2 different libraries / dependencies with the same name but different content.
      If you have 2 version of the same library, then even if the name is the same the version changes and invalidate the cache
      If instead you have 2 different libraries with the same name it is a big problem not just for the cache but in general… how would any dependency manager know which library to consume? Plus any dependency repo requires unique names so you won’t be able to save the dependencies anywhere..

  • @pascalie23109612
    @pascalie23109612 3 роки тому +1

    Is there a reason why you use npm install over npm ci in your pipeline?

    • @CoderDave
      @CoderDave  3 роки тому +2

      Npm ci is only available in version 6, if someone is using version 5 they wouldn’t have it. Also, since I’m using it in Hosted Agents I don’t have the problem of needing to make sure it’s a clean state... because it is always a new clean agent by design. Finally, you can’t cache npm ci... in fact, if it finds an npm modules folder it deletes it and reinstall everything

    • @moustafakamal9399
      @moustafakamal9399 3 роки тому +1

      @@CoderDave well explained thnx

    • @stephanschuster9106
      @stephanschuster9106 Рік тому

      @@CoderDave It is correct, that npm ci would clear the node_modules folder. But the use case discussed here doesn't try to cache the the local node_modules but the global .npm cache.