Skip to content

Commit 928e948

Browse files
committed
feat: Adding pre-commit hooks
1 parent f53e2a9 commit 928e948

File tree

2 files changed

+83
-7
lines changed

2 files changed

+83
-7
lines changed

.github/workflows/build-no-proxy.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,13 @@ jobs:
4444
- id: go-cache-paths
4545
run: |
4646
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
47-
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
4847
4948
- name: Go Build Cache
5049
uses: actions/cache@v4
5150
with:
5251
path: ${{ steps.go-cache-paths.outputs.go-build }}
5352
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}-${{ matrix.os }}-${{ matrix.arch }}
5453

55-
- name: Go Mod Cache
56-
uses: actions/cache@v4
57-
with:
58-
path: ${{ steps.go-cache-paths.outputs.go-mod }}
59-
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}-${{ matrix.os }}-${{ matrix.arch }}
60-
6154
- name: Build Terragrunt without Go proxy
6255
env:
6356
GOPROXY: direct

.github/workflows/precommit.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build Without Go Proxy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
build-no-proxy:
12+
name: Build (${{ matrix.os }}/${{ matrix.arch }})
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
include:
17+
- os: darwin
18+
arch: amd64
19+
- os: darwin
20+
arch: arm64
21+
- os: linux
22+
arch: "386"
23+
- os: linux
24+
arch: amd64
25+
- os: linux
26+
arch: arm64
27+
- os: windows
28+
arch: "386"
29+
- os: windows
30+
arch: amd64
31+
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
36+
- name: Append python to mise.toml
37+
run: |
38+
echo "python = \"3.13.3\"" >> mise.toml
39+
40+
- name: Create default packages file
41+
run: |
42+
# Unlike the Python one below, this one can't be at
43+
# a configurable location, so we always write it to the home dir.
44+
cat <<EOF > ~/.default-go-packages
45+
golang.org/x/tools/cmd/goimports@latest
46+
EOF
47+
48+
echo "$HOME/go/bin" >> "$GITHUB_PATH"
49+
50+
cat <<EOF > .mise-python-default-packages
51+
pre-commit==1.21.0
52+
cfgv==2.0.1
53+
zipp==1.1.0
54+
EOF
55+
56+
echo "MISE_PYTHON_DEFAULT_PACKAGES_FILE=.mise-python-default-packages" >> "$GITHUB_ENV"
57+
58+
- name: Use mise to install dependencies
59+
uses: jdx/mise-action@v2
60+
with:
61+
version: 2025.4.4
62+
env:
63+
# Adding token here to reduce the likelihood of hitting rate limit issues.
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- id: go-cache-paths
67+
run: |
68+
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
69+
70+
- name: Go Build Cache
71+
uses: actions/cache@v4
72+
with:
73+
path: ${{ steps.go-cache-paths.outputs.go-build }}
74+
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}-${{ matrix.os }}-${{ matrix.arch }}
75+
76+
- name: Run pre-commit hooks
77+
env:
78+
GOPROXY: direct
79+
GOOS: ${{ matrix.os }}
80+
GOARCH: ${{ matrix.arch }}
81+
run: |
82+
pre-commit install
83+
pre-commit run --all-files

0 commit comments

Comments
 (0)