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

Action execution duration #29

Open
tomshabtay opened this issue Jan 18, 2024 · 5 comments
Open

Action execution duration #29

tomshabtay opened this issue Jan 18, 2024 · 5 comments

Comments

@tomshabtay
Copy link

tomshabtay commented Jan 18, 2024

Running the action is taking about 20 seconds to complete.
does it sound reasonable? any suggestions how to make it faster?

Looking at the log, this the longest part of the action:

2024-01-18T09:55:27.9214877Z info: downloading installer (https://install.determinate.systems/nix/tag/v0.16.0/nix-installer-x86_64-linux)
2024-01-18T09:55:28.8724733Z �[2m�[33m`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...�[39m�[0m
2024-01-18T09:55:28.9186794Z   2024-01-18T09:55:28.916990Z  INFO nix_installer::plan: Step: Create directory `/nix`
2024-01-18T09:55:28.9188510Z     at src/plan.rs:191
2024-01-18T09:55:28.9189042Z 
2024-01-18T09:55:28.9190155Z   2024-01-18T09:55:28.918585Z  INFO nix_installer::plan: Step: Provision Nix
2024-01-18T09:55:28.9191175Z     at src/plan.rs:191
2024-01-18T09:55:28.9191827Z 
2024-01-18T09:55:31.3899558Z   2024-01-18T09:55:31.389678Z  INFO nix_installer::plan: Step: Create build users (UID 30001-30032) and group (GID 30000)
2024-01-18T09:55:31.3900841Z     at src/plan.rs:191
2024-01-18T09:55:31.3901250Z 
2024-01-18T09:55:32.1014458Z   2024-01-18T09:55:32.101007Z  INFO nix_installer::plan: Step: Configure Nix
2024-01-18T09:55:32.1015516Z     at src/plan.rs:191
2024-01-18T09:55:32.1015909Z 
2024-01-18T09:55:32.2438890Z   2024-01-18T09:55:32.243630Z  INFO nix_installer::plan: Step: Create directory `/etc/tmpfiles.d`
2024-01-18T09:55:32.2440316Z     at src/plan.rs:191
2024-01-18T09:55:32.2440849Z 
2024-01-18T09:55:32.2442779Z   2024-01-18T09:55:32.243648Z  INFO nix_installer::plan: Step: Configure Nix daemon related settings with systemd
2024-01-18T09:55:32.2444014Z     at src/plan.rs:191
2024-01-18T09:55:32.2444492Z 
2024-01-18T09:55:33.0706393Z   2024-01-18T09:55:33.069496Z  INFO nix_installer::plan: Step: Remove directory `/nix/temp-install-dir`
2024-01-18T09:55:33.0719670Z     at src/plan.rs:191
2024-01-18T09:55:33.0720331Z 
2024-01-18T09:55:33.7938019Z �[1m�[32mNix was installed successfully!�[39m�[0m
2024-01-18T09:55:33.7939600Z To get started using Nix, open a new shell or run `�[1m. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh�[0m`
2024-01-18T09:55:33.7940646Z 
2024-01-18T09:55:33.8858102Z ##[group]Run actions/cache/restore@v3
2024-01-18T09:55:33.8858677Z with:
2024-01-18T09:55:33.8859522Z   path: ~/.cache/devbox
~/.cache/nix
~/.local/state/nix
~/.nix-defexpr
~/.nix-profile
/nix/store
/nix/var/nix

2024-01-18T09:55:33.8860950Z   key: Linux-devbox-nix-store-9f117df80d478816ab1b9c40e8371c3827dab54e3df60c446479af6a63cc098f
2024-01-18T09:55:33.8861991Z   enableCrossOsArchive: false
2024-01-18T09:55:33.8862533Z   fail-on-cache-miss: false
2024-01-18T09:55:33.8863043Z   lookup-only: false
2024-01-18T09:55:33.8863486Z env:
2024-01-18T09:55:33.8863886Z   latest_version: 0.8.5
2024-01-18T09:55:33.8864366Z ##[endgroup]
2024-01-18T09:55:35.3614918Z Received 88080384 of 317438014 (27.7%), 83.9 MBs/sec
2024-01-18T09:55:36.3667546Z Received 313243710 of 317438014 (98.7%), 149.1 MBs/sec
2024-01-18T09:55:36.3837454Z Cache Size: ~303 MB (317438014 B)
2024-01-18T09:55:36.3884767Z [command]/home/runner/.local/bin/tar -xf /home/runner/work/_temp/124f78eb-9458-4929-9ce4-21731be5f070/cache.tzst -P -C /home/runner/work/xxxxxxxxxx --use-compress-program unzstd
2024-01-18T09:55:37.3645564Z Received 317438014 of 317438014 (100.0%), 100.7 MBs/sec
2024-01-18T09:55:45.1834989Z Cache restored successfully
2024-01-18T09:55:45.2338284Z Cache restored from key: Linux-devbox-nix-store-9f117df80d478816ab1b9c40e8371c3827dab54e3df60c446479af6a63cc098f

I tried changing the input skip-nix-installation to false which fail the action,
I guess this variable can help in case the github runner already has nix installed.

adding the devbox.json just in case:

{
  "packages": {
    "helmfile":                         "0.159.0",
    "kubernetes-helm":                  "3.13.2",
    "kubernetes-helmPlugins.helm-diff": "3.8.1",
    "kubernetes-helmPlugins.helm-s3":   "0.15.1",
    "kubectl":                          "1.28.4"
  }
}

Thanks!

@LucilleH
Copy link
Contributor

LucilleH commented Feb 16, 2024

20s sounds reasonable 🤔 . The bulk of the time is probably taken by installing Nix + packages.

I tried changing the input skip-nix-installation to false which fail the action,
I guess this variable can help in case the github runner already has nix installed.

Correct

@dephiros
Copy link

I noticed that install-nix-action is able to complete ~4s: https://github.com/cachix/install-nix-action/actions/runs/8198580795/job/22422336858
Maybe we can see what optimization that they use there?

@LucilleH
Copy link
Contributor

@dephiros I think for install-nix-action, the 4s is just installing Nix without any packages. Based on the screenshot it looks like ours also took around 5s (from 09:55:27 to 09:55:33). The rest of ~12s was spent on restoring the nix store cache from GitHub. Perhaps there's something we can do to optimize that cache restoration part 🤔

@dephiros
Copy link

cc @kalbasit

@kpervin
Copy link

kpervin commented Nov 14, 2024

I just had this action take 17 minutes for the following packages:

"packages": {
    "_1password": "2.30.0",
    "terraform": "1.9.8",
    "ansible": "2.17.5",
    "packer": "1.11.2",
    "git": "2.46.1",
    "path:./.flakes/azure-cli": "",
    "python3": "3.12",
    "ansible-lint": "latest"
  },
{
  description = "A flake to install azure-cli";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils, }:
    flake-utils.lib.eachDefaultSystem (system:
      let pkgs = nixpkgs.legacyPackages.${system};
      in {
        formatter = pkgs.nixfmt;
        packages = {
          default = pkgs.azure-cli.withExtensions
            [ pkgs.azure-cli-extensions.terraform ];
        };
      });
}

Using the action as follows:

      - name: Install devbox
        uses: jetify-com/[email protected]
        with:
          enable-cache: 'true'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants