Skip to content

Commit 00c1020

Browse files
authored
clean up gha ci (#7)
* add ci feat * clean * clean * clean up gha ci
1 parent dcfe669 commit 00c1020

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
with:
2121
python-version: "3.10"
2222

23+
- name: Set shfmt version environment variable
24+
run: echo "SHFMT_VERSION=v3.7.0" >> $GITHUB_ENV
25+
2326
- name: Cache pip dependencies
2427
uses: actions/cache@v3
2528
with:
@@ -32,18 +35,18 @@ jobs:
3235
uses: actions/cache@v3
3336
with:
3437
path: /usr/local/bin/shfmt
35-
# key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
36-
key: ${{ runner.os }}-shfmt-
38+
key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
3739
restore-keys: |
40+
${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
3841
${{ runner.os }}-shfmt-
3942
4043
- name: Cache Pre-Commit environments
4144
uses: actions/cache@v3
4245
with:
4346
path: ~/.cache/pre-commit
44-
# key: ${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
45-
key: ${{ runner.os }}-pc-
47+
key: ${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
4648
restore-keys: |
49+
${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
4750
${{ runner.os }}-pc-
4851
4952
- name: Install dependencies
@@ -53,7 +56,7 @@ jobs:
5356
5457
- name: Install shfmt
5558
run: |
56-
SHFMT_VERSION="v3.7.0"
59+
SHFMT_VERSION=${{ env.SHFMT_VERSION }}
5760
SHFMT_BIN="shfmt_${SHFMT_VERSION}_linux_amd64"
5861
if [[ ! -f /usr/local/bin/shfmt ]]; then
5962
wget -O shfmt "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/${SHFMT_BIN}"
@@ -81,8 +84,3 @@ jobs:
8184
else
8285
pre-commit run --from-ref origin/$DEFAULT_BRANCH --to-ref $CUR_SHA
8386
fi
84-
85-
# git fetch origin $DEFAULT_BRANCH
86-
# LAST_SHA=$(git log --pretty=tformat:"%H" -n2 . | tail -n1)
87-
# echo "Last SHA is $LAST_SHA"
88-
# pre-commit run --from-ref $LAST_SHA --to-ref $CUR_SHA

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ jobs:
4545
path: |
4646
target
4747
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
48-
# key: ${{ runner.os }}-cargo-
4948
restore-keys: |
49+
${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
5050
${{ runner.os }}-cargo-
5151
5252
- name: Build Release

example/.github/workflows/ci.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
with:
2121
python-version: "3.10"
2222

23+
- name: Set shfmt version environment variable
24+
run: echo "SHFMT_VERSION=v3.7.0" >> $GITHUB_ENV
25+
2326
- name: Cache pip dependencies
2427
uses: actions/cache@v3
2528
with:
@@ -32,18 +35,18 @@ jobs:
3235
uses: actions/cache@v3
3336
with:
3437
path: /usr/local/bin/shfmt
35-
# key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
36-
key: ${{ runner.os }}-shfmt-
38+
key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
3739
restore-keys: |
40+
${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
3841
${{ runner.os }}-shfmt-
3942
4043
- name: Cache Pre-Commit environments
4144
uses: actions/cache@v3
4245
with:
4346
path: ~/.cache/pre-commit
44-
# key: ${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
45-
key: ${{ runner.os }}-pc-
47+
key: ${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
4648
restore-keys: |
49+
${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
4750
${{ runner.os }}-pc-
4851
4952
- name: Install dependencies
@@ -53,7 +56,7 @@ jobs:
5356
5457
- name: Install shfmt
5558
run: |
56-
SHFMT_VERSION="v3.7.0"
59+
SHFMT_VERSION=${{ env.SHFMT_VERSION }}
5760
SHFMT_BIN="shfmt_${SHFMT_VERSION}_linux_amd64"
5861
if [[ ! -f /usr/local/bin/shfmt ]]; then
5962
wget -O shfmt "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/${SHFMT_BIN}"

0 commit comments

Comments
 (0)