Skip to content

Commit

Permalink
update CI and test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhravya committed Apr 1, 2024
1 parent 561c0b0 commit dbba7c3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
38 changes: 29 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,38 @@ jobs:
prepare:
runs-on: ubuntu-latest
outputs:
web_changed: ${{ steps.set_outputs.outputs.web_changed }}
extension_changed: ${{ steps.set_outputs.outputs.extension_changed }}
cf_ai_backend_changed: ${{ steps.set_outputs.outputs.cf_ai_backend_changed }}
web_changed: ${{ steps.detect_changes.outputs.web_changed }}
extension_changed: ${{ steps.detect_changes.outputs.extension_changed }}
cf_ai_backend_changed: ${{ steps.detect_changes.outputs.cf_ai_backend_changed }}
steps:
- uses: actions/checkout@v3
- name: Set Outputs
id: set_outputs
- name: Fetching all history for all tags and branches
run: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Detect Changes
id: detect_changes
run: |
echo "web_changed=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q 'apps/web/' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
echo "extension_changed=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q 'apps/extension/' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
echo "cf_ai_backend_changed=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q 'apps/cf-ai-backend/' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
WEB_CHANGED="false"
EXTENSION_CHANGED="false"
CF_AI_BACKEND_CHANGED="false"
if [ "${{ github.event_name }}" = "push" ]; then
DIFF_REF="${{ github.event.before }} ${{ github.sha }}"
else
DIFF_REF="${{ github.base_ref }}...${{ github.head_ref }}"
fi
if git diff --name-only $DIFF_REF | grep -q 'apps/web/'; then
WEB_CHANGED="true"
fi
if git diff --name-only $DIFF_REF | grep -q 'apps/extension/'; then
EXTENSION_CHANGED="true"
fi
if git diff --name-only $DIFF_REF | grep -q 'apps/cf-ai-backend/'; then
CF_AI_BACKEND_CHANGED="true"
fi
echo "web_changed=$WEB_CHANGED" >> $GITHUB_OUTPUT
echo "extension_changed=$EXTENSION_CHANGED" >> $GITHUB_OUTPUT
echo "cf_ai_backend_changed=$CF_AI_BACKEND_CHANGED" >> $GITHUB_OUTPUT
echo "Differences detected: WEB=$WEB_CHANGED, EXTENSION=$EXTENSION_CHANGED, CF_AI_BACKEND=$CF_AI_BACKEND_CHANGED"
build-extension:
needs: prepare
if: needs.prepare.outputs.extension_changed == 'true'
Expand Down
2 changes: 1 addition & 1 deletion apps/web/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ index_name = "anycontext-idx"
[[d1_databases]]
binding = "DATABASE"
database_name = "dev-d1-anycontext"
database_id = "fc562605-157a-4f60-b439-2a24ffed5b4c"
database_id = "fc562605-157a-4f60-b439-2a24ffed5b4c"

0 comments on commit dbba7c3

Please sign in to comment.