-
Notifications
You must be signed in to change notification settings - Fork 209
75 lines (63 loc) · 2.47 KB
/
Copy pathci.yml
File metadata and controls
75 lines (63 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: CI
on:
# This runs in the context of the base of the pull request,
# rather than in the context of the merge commit.
# Maintainers must approve and we tighten permissions below.
pull_request_target:
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
test:
name: Test
uses: huggingface/hf-workflows/.github/workflows/swift_transformers_unit_tests.yml@main
with:
# Use the PR merge ref, not the head.
pr_number: ${{ github.event.pull_request.number }}
secrets:
HF_HUB_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
test-linux:
name: Test (Linux)
runs-on: ubuntu-latest
container: swift:6.2.3
steps:
- name: Checkout PR merge ref if called from PR
if: ${{ github.event.pull_request.number }}
uses: actions/checkout@v6
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
fetch-depth: 0
- name: Checkout fallback
if: ${{ !github.event.pull_request.number }}
uses: actions/checkout@v6
- name: Build
run: swift build
- name: Run tests
env:
CI_DISABLE_NETWORK_MONITOR: "1"
HF_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
run: swift test
lint:
name: Lint
runs-on: macos-latest
steps:
- name: Checkout PR merge ref if called from PR
if: ${{ github.event.pull_request.number }}
uses: actions/checkout@v6
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
fetch-depth: 0
- name: Checkout fallback
if: ${{ !github.event.pull_request.number }}
uses: actions/checkout@v6
- run: |
swift format lint --strict --recursive .
- name: Suggest fixes (if check fails)
if: failure()
run: |
echo "### Here's how to fix the formatting locally:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
echo "# Format all Swift files" >> $GITHUB_STEP_SUMMARY
echo 'swift format -i --recursive .' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY