Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up gha ci #7

Merged
merged 5 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
with:
python-version: "3.10"

- name: Set shfmt version environment variable
run: echo "SHFMT_VERSION=v3.7.0" >> $GITHUB_ENV

- name: Cache pip dependencies
uses: actions/cache@v3
with:
Expand All @@ -32,18 +35,18 @@ jobs:
uses: actions/cache@v3
with:
path: /usr/local/bin/shfmt
# key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
key: ${{ runner.os }}-shfmt-
key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
restore-keys: |
${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
${{ runner.os }}-shfmt-

- name: Cache Pre-Commit environments
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
# key: ${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
key: ${{ runner.os }}-pc-
key: ${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
${{ runner.os }}-pc-

- name: Install dependencies
Expand All @@ -53,7 +56,7 @@ jobs:

- name: Install shfmt
run: |
SHFMT_VERSION="v3.7.0"
SHFMT_VERSION=${{ env.SHFMT_VERSION }}
SHFMT_BIN="shfmt_${SHFMT_VERSION}_linux_amd64"
if [[ ! -f /usr/local/bin/shfmt ]]; then
wget -O shfmt "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/${SHFMT_BIN}"
Expand Down Expand Up @@ -81,8 +84,3 @@ jobs:
else
pre-commit run --from-ref origin/$DEFAULT_BRANCH --to-ref $CUR_SHA
fi

# git fetch origin $DEFAULT_BRANCH
# LAST_SHA=$(git log --pretty=tformat:"%H" -n2 . | tail -n1)
# echo "Last SHA is $LAST_SHA"
# pre-commit run --from-ref $LAST_SHA --to-ref $CUR_SHA
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
path: |
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
# key: ${{ runner.os }}-cargo-
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
${{ runner.os }}-cargo-

- name: Build Release
Expand Down
13 changes: 8 additions & 5 deletions example/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
with:
python-version: "3.10"

- name: Set shfmt version environment variable
run: echo "SHFMT_VERSION=v3.7.0" >> $GITHUB_ENV

- name: Cache pip dependencies
uses: actions/cache@v3
with:
Expand All @@ -32,18 +35,18 @@ jobs:
uses: actions/cache@v3
with:
path: /usr/local/bin/shfmt
# key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
key: ${{ runner.os }}-shfmt-
key: ${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
restore-keys: |
${{ runner.os }}-shfmt-${{ env.SHFMT_VERSION }}
${{ runner.os }}-shfmt-

- name: Cache Pre-Commit environments
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
# key: ${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
key: ${{ runner.os }}-pc-
key: ${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pc-${{ hashFiles('.pre-commit-config.yaml') }}
${{ runner.os }}-pc-

- name: Install dependencies
Expand All @@ -53,7 +56,7 @@ jobs:

- name: Install shfmt
run: |
SHFMT_VERSION="v3.7.0"
SHFMT_VERSION=${{ env.SHFMT_VERSION }}
SHFMT_BIN="shfmt_${SHFMT_VERSION}_linux_amd64"
if [[ ! -f /usr/local/bin/shfmt ]]; then
wget -O shfmt "https://github.com/mvdan/sh/releases/download/${SHFMT_VERSION}/${SHFMT_BIN}"
Expand Down