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

test a faster way to generate cache keys for CI #4500

Merged
merged 4 commits into from
Aug 26, 2024
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
12 changes: 10 additions & 2 deletions .github/actions/build_app/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ runs:
using: 'composite'
steps:

- name: Get last Git commit hashes for cache key
shell: bash
# Instead of hasing files, use the latest git commit in a directory to speed up cache key https://github.com/actions/runner/issues/1840#issuecomment-2094847172
run: |
echo "NPM_PACKAGES_COMMIT=$(git log -1 --pretty=format:%H -- package-lock.json)" >> $GITHUB_ENV
echo "SOURCE_CODE_COMMIT=$(git log -1 --pretty=format:%H -- lib @connect-shared apps/${{ inputs.app_name }})" >> $GITHUB_ENV

- name: Restore build
id: restore_build
uses: actions/cache@v4
Expand All @@ -18,9 +25,10 @@ runs:
apps/${{ inputs.app_name }}/.next
apps/${{ inputs.app_name }}/public
# Generate a new cache whenever packages or source files change.
key: app-${{ inputs.app_name }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('lib/**/*.ts', 'lib/**/*.tsx', '@connect-shared/**/*.ts', '@connect-shared/**/*.tsx', format('apps/{0}/**/*.ts', inputs.app_name), format('apps/{0}/**/*.tsx', inputs.app_name), format('apps/{0}/**/*.scss', inputs.app_name)) }}
# key: app-${{ inputs.app_name }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('lib/**/*.ts', 'lib/**/*.tsx', '@connect-shared/**/*.ts', '@connect-shared/**/*.tsx', format('apps/{0}/**/*.ts', inputs.app_name), format('apps/{0}/**/*.tsx', inputs.app_name), format('apps/{0}/**/*.scss', inputs.app_name)) }}
key: app-${{ inputs.app_name }}-${{ env.NPM_PACKAGES_COMMIT }}-${{ env.SOURCE_CODE_COMMIT }}
restore-keys: |
app-${{ inputs.app_name }}-${{ hashFiles('**/package-lock.json') }}-
app-${{ inputs.app_name }}-${{ env.NPM_PACKAGES_COMMIT }}-

- name: Build app
shell: bash
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy_farcaster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
# Fetch all commits in all branches and tags
fetch-depth: 0

- name: Install dependencies
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/deploy_scoutgame.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Restore dependencies from cache
uses: ./.github/actions/install
Expand Down Expand Up @@ -153,6 +155,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Restore dependencies from cache
uses: ./.github/actions/install
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/deploy_sunnyawards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Restore dependencies from cache
uses: ./.github/actions/install
Expand Down Expand Up @@ -147,6 +149,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Restore dependencies from cache
uses: ./.github/actions/install
Expand Down Expand Up @@ -283,8 +287,7 @@ jobs:
ebextensions: sunnyawards
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4.x
with:
Expand Down
1 change: 1 addition & 0 deletions apps/farcaster/lib/postCreateCastMessage.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// send a message to the parent window to create a new cast
export function postCreateCastMessage({ embeds, text }: { text: string; embeds: string[] }) {
window.parent.postMessage(
{
Expand Down
Loading