Skip to content

Commit 908cea3

Browse files
feat: Setup CI (#2)
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
1 parent 66ad132 commit 908cea3

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
# Main project
4+
- package-ecosystem: swift
5+
directory: "/"
6+
schedule:
7+
interval: weekly
8+
time: "01:00"
9+
open-pull-requests-limit: 20
10+
labels:
11+
- "dependencies"
12+
- "automerge"
13+
commit-message:
14+
prefix: "chore"

.github/workflows/pr-lint.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Lint PR title"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
main:
15+
permissions:
16+
# for amannn/action-semantic-pull-request to analyze PR titles
17+
# for marocchino/sticky-pull-request-comment to add comments to the PR
18+
pull-requests: write
19+
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
20+
name: Validate PR title
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: amannn/action-semantic-pull-request@v5
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- uses: marocchino/sticky-pull-request-comment@v2
28+
# When the previous steps fails, the workflow would stop. By adding this
29+
# condition you can continue the execution with the populated error message.
30+
if: always() && (steps.lint_pr_title.outputs.error_message != null)
31+
with:
32+
header: pr-title-lint-error
33+
message: |
34+
Hey there and thank you for opening this pull request! 👋🏼
35+
36+
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
37+
Details:
38+
39+
```
40+
${{ steps.lint_pr_title.outputs.error_message }}
41+
```
42+
43+
# Delete a previous comment when the issue has been resolved
44+
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
45+
uses: marocchino/sticky-pull-request-comment@v2
46+
with:
47+
header: pr-title-lint-error
48+
delete: true

.github/workflows/swift.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Swift
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build-test:
7+
name: Swift ${{ matrix.swift }} on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ macos-latest ]
12+
swift: [ "5.10" ]
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: swift-actions/setup-swift@v2
16+
with:
17+
swift-version: ${{ matrix.swift }}
18+
- name: Get swift version
19+
run: swift --version
20+
- name: Build
21+
run: swift build
22+
- name: Run tests
23+
run: swift test --enable-code-coverage
24+
- name: Upload coverage reports to Codecov
25+
uses: codecov/codecov-action@v4
26+
with:
27+
fail_ci_if_error: true
28+
token: ${{ secrets.CODECOV_TOKEN }}
29+
env:
30+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
31+
lint:
32+
name: Swift Lint
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: norio-nomura/action-swiftlint@3.2.1

0 commit comments

Comments
 (0)