-
Notifications
You must be signed in to change notification settings - Fork 10
151 lines (138 loc) Β· 4.28 KB
/
ci.yml
File metadata and controls
151 lines (138 loc) Β· 4.28 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
schedule:
- cron: "0 8 * * 1"
permissions:
contents: read
jobs:
metadata-validate:
name: Metadata Validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate README metadata
run: |
chmod +x scripts/validate-readme-metadata.sh
./scripts/validate-readme-metadata.sh
readme-sync-check:
name: README Sync Check
runs-on: ubuntu-latest
needs: metadata-validate
steps:
- uses: actions/checkout@v4
- name: Regenerate README
run: |
chmod +x scripts/update-readme.sh
./scripts/update-readme.sh
- name: Ensure README is committed
run: |
git diff --exit-code -- README.md README.pages.html
duplicate-problem-detector:
name: Duplicate Problem Detector
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Detect duplicate problem names
run: |
chmod +x scripts/check-duplicate-problems.sh
./scripts/check-duplicate-problems.sh
swift-build-check:
name: Swift Build Check
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Compile project
shell: bash
run: |
set -euo pipefail
project="Algorithm Solutions In Swift.xcodeproj"
list_output="$(xcodebuild -list -project "$project")"
echo "$list_output"
if echo "$list_output" | sed -n '/Schemes:/,$p' | grep -Fq "Algorithm Solutions In Swift"; then
xcodebuild \
-project "$project" \
-scheme "Algorithm Solutions In Swift" \
-destination "platform=macOS" \
build
else
xcodebuild -project "$project" -target "Algorithm Solutions In Swift" build
fi
swift-format-lint-check:
name: Swift Format And Lint Check
runs-on: macos-latest
if: github.event_name == 'pull_request'
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run style checks on changed Swift files
shell: bash
run: |
set -euo pipefail
chmod +x scripts/check-swift-style.sh
mapfile -d '' swift_files < <(
git diff -z --name-only --diff-filter=ACMR \
"${{ github.event.pull_request.base.sha }}" \
"${{ github.event.pull_request.head.sha }}" \
-- '*.swift'
)
if [[ "${#swift_files[@]}" -eq 0 ]]; then
echo "No changed Swift files in this PR."
exit 0
fi
./scripts/check-swift-style.sh "${swift_files[@]}"
link-health:
name: Link Health
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Check README links
uses: lycheeverse/lychee-action@v2
with:
fail: true
args: --no-progress --max-concurrency 8 --timeout 20 --accept 200,429,403 README.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
codeql:
name: CodeQL
runs-on: macos-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language:
- swift
steps:
- uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Build for CodeQL
shell: bash
run: |
set -euo pipefail
project="Algorithm Solutions In Swift.xcodeproj"
list_output="$(xcodebuild -list -project "$project")"
if echo "$list_output" | sed -n '/Schemes:/,$p' | grep -Fq "Algorithm Solutions In Swift"; then
xcodebuild \
-project "$project" \
-scheme "Algorithm Solutions In Swift" \
-destination "platform=macOS" \
build
else
xcodebuild -project "$project" -target "Algorithm Solutions In Swift" build
fi
- name: Analyze with CodeQL
uses: github/codeql-action/analyze@v3