Giter Site home page Giter Site logo

git-for-windows / setup-git-for-windows-sdk Goto Github PK

View Code? Open in Web Editor NEW
18.0 6.0 21.0 31.4 MB

A GitHub Action to initialize various flavors of the Git for Windows SDK

License: MIT License

TypeScript 86.05% JavaScript 1.33% Shell 12.61%
actions github-action

setup-git-for-windows-sdk's Introduction

Set up a Git for Windows SDK (or a subset thereof)

Use this Action to initialize an environment to develop Git for Windows.

Getting Started

name: Build stuff in Git for Windows' SDK
on: [push]
jobs:
  build:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v3
    - name: Setup Git for Windows' minimal SDK
      uses: git-for-windows/setup-git-for-windows-sdk@v1
    - name: Build
      shell: bash
      run: make

Input parameters

Available flavors

This Action supports several flavors (read: subsets) of the Git for Windows SDK that can be configured like this:

- uses: git-for-windows/setup-git-for-windows-sdk
  with:
    flavor: build-installers

The supported flavors are:

  • minimal:

    This is the most useful flavor to build Git for Windows' source code and run its own test suite. Only available for x86_64.

  • makepkg-git:

    This flavor allows packaging mingw-w64-git, the Pacman package. It is only available for x86_64 but can be used to "cross-compile" for i686.

  • build-installers:

    In addition to building mingw-w64-git, this flavor allows bundling Git for Windows' artifacts such as the installer and the Portable Git.

  • full:

    This is the "full" SDK, as users would install it, with a pre-selected set of packages pre-installed. Additional packages can be installed via pacman -S <package>.

CPU architecture support

Git for Windows SDK comes in variants targeting x86_64 (AKA "64-bit"), i686 (AKA 32-bit) and aarch64 (AKA arm64). The default is x86_64 and can be overridden like this:

- uses: git-for-windows/setup-git-for-windows-sdk
  with:
    flavor: build-installers
    architecture: i686

Please note that only the build-installers and the full flavors are available for i686.

Verbosity

By default, this Action prints a line whenever 250 items were extracted (this does not work for the full flavor, where this Action is silent by default). It can be overridden by setting the input parameter verbose; setting it to a number will show updates whenever that many items were extracted. Setting it to false will suppress progress updates. Setting it to true will print every extracted file (this also works for the full flavor).

Caching

To accelerate this Action, artifacts are cached once downloaded. This can be turned off by setting the input parameter cache to false.

In practice, caching the full artifacts does not provide much of a speed-up. Instead, it slows it down by spending extra minutes on caching the artifact. Therefore, caching is disabled for the full artifacts by default, corresponding to cache: auto.

Clean-up

On self-hosted runners, the SDK files persist after the workflow run is done. To remove these files, set the input parameter cleanup to true.

Developing this Action

First, you'll need to have a reasonably modern version of node handy, such as Node 12.

Install the dependencies

$ npm install

Build the Action and package it for distribution

$ npm run build && npm run package

Run the tests ✔️

$ npm test

> [email protected] test C:\Users\me\setup-git-for-windows-sdk
> jest

PASS __tests__/main.test.ts (28.869 s)
  √ skipping tests requiring network access (224 ms)

  console.log
    If you want to run tests that access the network, set:
    export RUN_NETWORK_TESTS=true

      at __tests__/main.test.ts:26:13

PASS __tests__/downloader.test.ts (29.889 s)
  √ can obtain build ID (9 ms)

Test Suites: 2 passed, 2 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        31.11 s
Ran all test suites.
...

setup-git-for-windows-sdk's People

Contributors

dennisameling avatar dependabot[bot] avatar dscho avatar rimrul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

setup-git-for-windows-sdk's Issues

Handle `ECONNRESET` gracefully

When the connection is reset (typically by the server side), the common trick is to wait a little and then try again.

But we don't:

Downloading single artifact
Preparing to download the following artifacts:
- minimal-sdk (ID: 1273852098, Size: 95936760)
Error: Unable to download artifact(s): Failed to ListArtifacts: Unable to make request: ECONNRESET

Use node v16.x

I kind of missed the announcement, I guess, but according to the documentation, GitHub Actions can now use node v16.x instead of v12.x (which starts to age a little).

Let's do that, let's upgrade this Action to use the newer node version by changing action.yml and of course package.json/package-lock.json accordingly.

Self-hosted runner: `C:/git-sdk-64-full' already exists`

On a self-hosted runner, when running this action for the second time, it fails with the following error:

Downloading git-sdk-64-full
Cloning git-sdk-64
  Notice: Cloning https://github.com/git-for-windows/git-sdk-64 to .tmp
  Cloning into bare repository '.tmp'...
Checking out git-sdk-64
  Preparing worktree (detached HEAD 456de1018)
  fatal: 'C:/git-sdk-64-full' already exists
Error: process exited with code [12](https://github.com/dennisameling/git/runs/7046758549?check_suite_focus=true#step:3:13)8

This is because, unlike GitHub-hosted runners, self-hosted runners can reuse the filesystem on the machine. It would probably be good to update this Action to either:

  • Respect the already installed git-sdk-64-full and reuse it (and probably update it to the latest commit)
  • Remove the existing git-sdk-64-full (e.g. by adding a force input to the Action) and redownload

If you could let me know what your preference is, I'm happy to update the Action accordingly. Thanks!

Example run here: https://github.com/dennisameling/git/runs/7046758549?check_suite_focus=true

Error: spawn C:/Program Files/Git/cmd/git.exe ENOENT

Hi there,

Really appreaciate if this will work.

I saw an issue very similar to this closed last year, but it is still happening to my setup.

I have a self-hosted runner, running on windows-latest using the following steps:


 steps:
    - uses: actions/checkout@v4   
      with:
       fetch-depth: '0'      
       run: |
        npm install
        npm test
      name: Install node
    - uses: actions/setup-node@v4
      with:
         node-version: 18
    - name: Setup Git for Windows' minimal SDK
      uses: git-for-windows/setup-git-for-windows-sdk@v1  
      with:
        flavor: full
    - name: Build
      shell: bash
      run: make

  • the output for node install is:
`Environment details
  node: v18.18.2
  npm: 9.8.1
  yarn: 
  ::endgroup::`

but the Setup Git for Windows' minimal SDK step fails with the following:



`##[debug]Evaluating condition for step: 'Setup Git for Windows' minimal SDK'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Setup Git for Windows' minimal SDK
##[debug]Register post job cleanup for action: git-for-windows/setup-git-for-windows-sdk@v1
##[debug]Loading inputs
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run git-for-windows/setup-git-for-windows-sdk@v1
  with:
    flavor: full
    architecture: x86_64
    msys: false
    cleanup: false
    verbose: [2](https://github.com/MYREPOs/actions/runs/6874340462/job/18695842017#step:4:2)50
    cache: auto
    github-token: ***
  env:
    ENVIRONMENT: DV
    APPLICATION: DBConnector
Got commit 5df5f255fb75fc80[4](https://github.com/MYREPO/actions/runs/6874340462/job/18695842017#step:4:4)9009cd4cf[5](https://github.com/MYREPO/actions/runs/6874340462/job/18695842017#step:4:5)92b74dfb4ffc7 for git-sdk-[6](https://github.com/MYREPO/actions/runs/6874340462/job/18695842017#step:4:6)4
Found a fast, temporary disk on this VM (D:/). Will use that.
Downloading git-sdk-64-full
::group::Cloning git-sdk-64
Cloning git-sdk-64
  Cloning https://github.com/git-for-windows/git-sdk-64 to .tmp
  Error: spawn C:/Program Files/Git/cmd/git.exe ENOENT
      at Process.ChildProcess._handle.onexit (node:internal/child_process:2[8](https://github.com/MYREPO/actions/runs/6874340462/job/18695842017#step:4:8)6:1[9](https://github.com/MYREPO/actions/runs/6874340462/job/18695842017#step:4:9))
      at onErrorNT (node:internal/child_process:484:[16](https://github.com/MYREPO/actions/runs/6874340462/job/18695842017#step:4:16))
      at processTicksAndRejections (node:internal/process/task_queues:82:[21](https://github.com/MYREPO/actions/runs/6874340462/job/18695842017#step:4:21))
  ##[debug]Node Action run completed with exit code 1
  ##[debug]Save intra-action state isPost = true
  ##[debug]Finishing: Setup Git for Windows' minimal SDK`


Any advice would be really appreciated, thank you!

Encountered problem downloading/extracting https://dev.azure.com/Git-for-Windows/.....?artifactName=git-sdk-64-build-installers&api-version=7.0&%24format=zip

(Hi, thanks for all the efforts!)

I am trying to build installer for my patched version of git-for-windows (untracked cache fix), but it seems the action is now failing on the point where it interacts with the action from ref v0 from this repository.

https://github.com/michkot/git/runs/5835168717?check_suite_focus=true

Encountered problem downloading/extracting https://dev.azure.com/Git-for-Windows/f3317b6a-fa67-40d4-9a33-b652e06943df/_apis/build/builds/97203/artifacts?artifactName=git-sdk-64-build-installers&api-version=7.0&%24format=zip: Error: unexpected end of file; Retrying in 32 seconds...

I've tried to re-run, but the same issue occurs.

Now I am trying with v1, (different installer, right?), to see if the problem would be the same - still running: https://github.com/michkot/git/runs/5836877048

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.