aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/git.yml
blob: 95398087c2fa50cf629b9d97d2931c8689383c4c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
on: [push, pull_request]
name: Git Compatibility
permissions:
  contents: read

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        git: [[master, ubuntu-latest], [v2.11.0, ubuntu-latest]]

    runs-on: ${{ matrix.git[1] }}
    env:
        GIT_VERSION: ${{ matrix.git[0] }}
        GIT_DIST_PATH: .git-dist/${{ matrix.git[0] }}

    steps:
    - name: Install Go
      uses: actions/setup-go@v4
      with:
        go-version: 1.21.x

    - name: Checkout code
      uses: actions/checkout@v4

    - name: Install build dependencies
      run: sudo apt-get update && sudo apt-get install gettext libcurl4-openssl-dev

    - name: Git Build
      run: make build-git

    - name: Set Git config
      run: |
        export GIT_DIST_PATH=.git-dist/${{ matrix.git[0] }}
        export GIT_EXEC_PATH=${{ github.workspace }}/$GIT_DIST_PATH
        export PATH=$GIT_EXEC_PATH:$PATH
        git --exec-path
        git config --global user.email "gha@example.com"
        git config --global user.name "GitHub Actions"
 
    - name: Test
      run: make test-coverage

    - name: Test SHA256
      run: make test-sha256

    - name: Build go-git with CGO disabled
      run: go build ./...
      env:
        CGO_ENABLED: 0