lamhieu commited on
Commit
91fd384
Β·
1 Parent(s): ab5d160

ci(workflows): mirror lightweight-embeddings style for simpler, more reliable HF sync

Browse files

- Drop workflow_run dependency in githubhfsync.yaml; trigger directly on push to main
(matches lightweight-embeddings pattern, avoids fragile cross-workflow chaining)
- Simplify ci.yaml: remove redundant concurrency/timeout/format-check steps
- Keep docsifer-specific concerns: libmagic1/ffmpeg system deps, full requirements.txt
install (tests need them), HF_USERNAME/HF_SPACE repo-variable overrides, force-push
so the Space mirrors GitHub exactly

.github/workflows/ci.yaml CHANGED
@@ -7,15 +7,10 @@ on:
7
  branches: [main]
8
  workflow_dispatch:
9
 
10
- concurrency:
11
- group: ci-${{ github.ref }}
12
- cancel-in-progress: true
13
-
14
  jobs:
15
  lint-and-test:
16
- name: Lint & Tests
17
  runs-on: ubuntu-latest
18
- timeout-minutes: 15
19
  steps:
20
  - uses: actions/checkout@v4
21
 
@@ -28,6 +23,7 @@ jobs:
28
  pyproject.toml
29
 
30
  - name: Install system packages
 
31
  run: |
32
  sudo apt-get update
33
  sudo apt-get install -y --no-install-recommends libmagic1 ffmpeg
@@ -43,9 +39,6 @@ jobs:
43
  - name: Ruff check
44
  run: ruff check docsifer tests
45
 
46
- - name: Ruff format check
47
- run: ruff format --check docsifer tests
48
-
49
  - name: Pytest
50
  env:
51
  DOCSIFER_LOG_JSON: "false"
@@ -57,7 +50,6 @@ jobs:
57
  runs-on: ubuntu-latest
58
  needs: lint-and-test
59
  if: github.event_name == 'push' && github.ref == 'refs/heads/main'
60
- timeout-minutes: 20
61
  steps:
62
  - uses: actions/checkout@v4
63
  - uses: docker/setup-buildx-action@v3
 
7
  branches: [main]
8
  workflow_dispatch:
9
 
 
 
 
 
10
  jobs:
11
  lint-and-test:
12
+ name: Lint & Unit Tests
13
  runs-on: ubuntu-latest
 
14
  steps:
15
  - uses: actions/checkout@v4
16
 
 
23
  pyproject.toml
24
 
25
  - name: Install system packages
26
+ # Required by python-magic (libmagic1) and audio transcription (ffmpeg).
27
  run: |
28
  sudo apt-get update
29
  sudo apt-get install -y --no-install-recommends libmagic1 ffmpeg
 
39
  - name: Ruff check
40
  run: ruff check docsifer tests
41
 
 
 
 
42
  - name: Pytest
43
  env:
44
  DOCSIFER_LOG_JSON: "false"
 
50
  runs-on: ubuntu-latest
51
  needs: lint-and-test
52
  if: github.event_name == 'push' && github.ref == 'refs/heads/main'
 
53
  steps:
54
  - uses: actions/checkout@v4
55
  - uses: docker/setup-buildx-action@v3
.github/workflows/githubhfsync.yaml CHANGED
@@ -1,9 +1,10 @@
1
  name: Sync Repository to HuggingFace Space
2
 
3
- # Auto-deploys the repo to a Hugging Face Space.
 
4
  #
5
  # Triggers:
6
- # - workflow_run β†’ only fires when the CI workflow on main succeeds.
7
  # - workflow_dispatch β†’ manual override (e.g. emergency redeploy).
8
  #
9
  # Required secret: HF_TOKEN (Hugging Face access token with write scope)
@@ -12,9 +13,7 @@ name: Sync Repository to HuggingFace Space
12
  # HF_SPACE default: docsifer
13
 
14
  on:
15
- workflow_run:
16
- workflows: ["CI"]
17
- types: [completed]
18
  branches: [main]
19
  workflow_dispatch:
20
 
@@ -26,17 +25,12 @@ jobs:
26
  sync-to-huggingface:
27
  name: Sync code to HuggingFace Space
28
  runs-on: ubuntu-latest
29
- timeout-minutes: 10
30
- if: |
31
- github.event_name == 'workflow_dispatch' ||
32
- (github.event.workflow_run.conclusion == 'success' &&
33
- github.event.workflow_run.head_branch == 'main')
34
  steps:
35
  - name: Checkout repository
36
  uses: actions/checkout@v4
37
  with:
38
- fetch-depth: 0
39
- lfs: true
40
 
41
  - name: Push to HuggingFace Space
42
  env:
@@ -59,4 +53,7 @@ jobs:
59
 
60
  # Force-push so the Space mirrors GitHub exactly. The Space history
61
  # is treated as a derived artifact, not a source of truth.
62
- git push -f "${REMOTE}" HEAD:main
 
 
 
 
1
  name: Sync Repository to HuggingFace Space
2
 
3
+ # Auto-deploys the repo to the Hugging Face Space on every push to main.
4
+ # Mirrors the simple, always-triggers approach used by ``lightweight-embeddings``.
5
  #
6
  # Triggers:
7
+ # - push (main) β†’ fires immediately when code lands on main.
8
  # - workflow_dispatch β†’ manual override (e.g. emergency redeploy).
9
  #
10
  # Required secret: HF_TOKEN (Hugging Face access token with write scope)
 
13
  # HF_SPACE default: docsifer
14
 
15
  on:
16
+ push:
 
 
17
  branches: [main]
18
  workflow_dispatch:
19
 
 
25
  sync-to-huggingface:
26
  name: Sync code to HuggingFace Space
27
  runs-on: ubuntu-latest
 
 
 
 
 
28
  steps:
29
  - name: Checkout repository
30
  uses: actions/checkout@v4
31
  with:
32
+ fetch-depth: 0 # Fetch all history for all branches and tags
33
+ lfs: true # Enable Git LFS support
34
 
35
  - name: Push to HuggingFace Space
36
  env:
 
53
 
54
  # Force-push so the Space mirrors GitHub exactly. The Space history
55
  # is treated as a derived artifact, not a source of truth.
56
+ if ! git push -f "${REMOTE}" HEAD:main; then
57
+ echo "::error::Failed to sync with HuggingFace Space"
58
+ exit 1
59
+ fi