-
Notifications
You must be signed in to change notification settings - Fork 582
104 lines (87 loc) · 3.35 KB
/
ci_testbuild.yml
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
name: CI
on:
push:
branches:
- master
pull_request:
jobs:
build:
name: Build and Test
runs-on: macos-15
permissions:
contents: read
checks: write
pull-requests: write
env:
IS_CI: 1
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 16.1.0
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare CI environment
run: ./scripts/github-ci-pre.sh
- name: Generate and lint docs
run: ./scripts/github-ci-docs.sh
- name: Build for testing
run: ./scripts/github-ci-testbuild.sh
- name: Run tests
id: test
run: ./scripts/github-ci-test.sh
- name: Report test results
uses: kishikawakatsumi/xcresulttool@v1
with:
path: build/TestResults.xcresult
upload-bundles: never
if: always()
- name: Report test coverage to Codecov
if: always()
uses: codecov/codecov-action@v4
with:
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}
plugin: xcode
files: artifacts/coverage.xml
- name: Upload artifacts (build log)
if: always()
uses: actions/upload-artifact@v4
with:
name: build.log
path: artifacts/build.log
- name: Upload artifacts (test log)
if: always()
uses: actions/upload-artifact@v4
with:
name: test.log
path: artifacts/test.log
- name: Upload artifacts (test results)
if: always()
uses: actions/upload-artifact@v4
with:
name: TestResults.xcresult
path: artifacts/TestResults.xcresult
- name: Upload artifacts (docstrings lint annotations)
if: always()
uses: actions/upload-artifact@v4
with:
name: docstrings-lint-annotations.json
path: artifacts/annotations.json
- name: Upload artifacts (coverage)
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage.xml
path: artifacts/coverage.xml
- name: Send notification (Push)
if: ${{ always() && github.event_name == 'push' && github.repository == 'hammerspoon/hammerspoon' }}
run: |
/usr/bin/curl -H "X-CI-WebHook: true" -H "Content-Type: application/json" -d '{"secret": "${{ secrets.CI_WEBHOOK_SECRET }}", "repository": "hammerspoon", "workflow": "CI (Push)", "message": "CI for ${{ github.event.compare }} (${{ github.event.head_commit.author.name }}):\n * ${{ toJSON(github.event.head_commit.message)}}\n * ${{ steps.test.outputs.test_result }}"}' "${{ secrets.CI_WEBHOOK_URL }}"
- name: Send notification (PR)
if: ${{ always() && github.event_name == 'pull_request' && github.repository == 'hammerspoon/hammerspoon' && env.CI_WEBHOOK_URL != '' }}
env:
CI_WEBHOOK_URL: ${{ secrets.CI_WEBHOOK_URL }}
run: |
/usr/bin/curl -H "X-CI-WebHook: true" -H "Content-Type: application/json" -d '{"secret": "${{ secrets.CI_WEBHOOK_SECRET }}", "repository": "hammerspoon", "workflow": "CI (PR)", "message": "CI for ${{ github.event.pull_request.html_url }} (${{ github.actor }})\n * ${{ github.event.pull_request.title }}\n * ${{ steps.test.outputs.test_result }}"}' "${{ secrets.CI_WEBHOOK_URL }}"