| 1 |
name: Build gitconfig |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
pull_request: |
| 8 |
branches: |
| 9 |
- master |
| 10 |
|
| 11 |
concurrency: |
| 12 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 13 |
cancel-in-progress: true |
| 14 |
|
| 15 |
permissions: |
| 16 |
contents: read |
| 17 |
|
| 18 |
jobs: |
| 19 |
linux: |
| 20 |
runs-on: ubuntu-latest |
| 21 |
steps: |
| 22 |
- name: Harden Runner |
| 23 |
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 |
| 24 |
with: |
| 25 |
egress-policy: block |
| 26 |
allowed-endpoints: > |
| 27 |
github.com:443 |
| 28 |
objects.githubusercontent.com:443 |
| 29 |
proxy.golang.org:443 |
| 30 |
raw.githubusercontent.com:443 |
| 31 |
release-assets.githubusercontent.com:443 |
| 32 |
storage.googleapis.com:443 |
| 33 |
sum.golang.org:443 |
| 34 |
golang.org:443 |
| 35 |
go.dev:443 |
| 36 |
azure.archive.ubuntu.com:443 |
| 37 |
azure.archive.ubuntu.com:80 |
| 38 |
archive.ubuntu.com:443 |
| 39 |
security.ubuntu.com:443 |
| 40 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 41 |
with: |
| 42 |
fetch-depth: 0 |
| 43 |
|
| 44 |
- name: Set up Go |
| 45 |
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 |
| 46 |
with: |
| 47 |
go-version: '1.24' |
| 48 |
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 |
| 49 |
with: |
| 50 |
path: ~/go/pkg/mod |
| 51 |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 52 |
restore-keys: | |
| 53 |
${{ runner.os }}-go- |
| 54 |
- name: Ubuntu Dependencies |
| 55 |
run: sudo apt-get install --yes git |
| 56 |
|
| 57 |
- |
| 58 |
name: Debug |
| 59 |
run: | |
| 60 |
echo "Go env ------------------" |
| 61 |
pwd |
| 62 |
echo ${HOME} |
| 63 |
echo ${GITHUB_WORKSPACE} |
| 64 |
echo ${GOPATH} |
| 65 |
echo ${GOROOT} |
| 66 |
env |
| 67 |
|
| 68 |
- name: Unit Test with Coverage |
| 69 |
run: | |
| 70 |
go test -coverprofile=coverage.out ./... |
| 71 |
go tool cover -func=coverage.out | tail -1 |
| 72 |
|
| 73 |
windows: |
| 74 |
runs-on: windows-latest |
| 75 |
defaults: |
| 76 |
run: |
| 77 |
shell: msys2 {0} |
| 78 |
steps: |
| 79 |
- name: Harden Runner |
| 80 |
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 |
| 81 |
with: |
| 82 |
egress-policy: audit |
| 83 |
|
| 84 |
- uses: msys2/setup-msys2@61f9e5e925871ba6c9e3e8da24ede83ea27fa91f # v2.27.0 |
| 85 |
with: |
| 86 |
release: false |
| 87 |
path-type: inherit |
| 88 |
install: >- |
| 89 |
base-devel |
| 90 |
git |
| 91 |
|
| 92 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 93 |
with: |
| 94 |
fetch-depth: 0 |
| 95 |
|
| 96 |
- name: Set up Go |
| 97 |
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 |
| 98 |
with: |
| 99 |
go-version: '1.24' |
| 100 |
|
| 101 |
- name: Build and Unit Test |
| 102 |
run: go test ./... |
| 103 |
|
| 104 |
macos: |
| 105 |
runs-on: macos-latest |
| 106 |
steps: |
| 107 |
- name: Harden Runner |
| 108 |
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 |
| 109 |
with: |
| 110 |
egress-policy: audit |
| 111 |
|
| 112 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 113 |
with: |
| 114 |
fetch-depth: 0 |
| 115 |
|
| 116 |
- name: Set up Go |
| 117 |
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 |
| 118 |
with: |
| 119 |
go-version: '1.24' |
| 120 |
|
| 121 |
- name: Build and Unit Test |
| 122 |
run: go test ./... |