Skip to content

Commit 0e46c42

Browse files
authored
ci: add GitHub Actions workflow to build the demo app and test the iOS library (#259)
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
1 parent 5bd516b commit 0e46c42

File tree

5 files changed

+127
-12
lines changed

5 files changed

+127
-12
lines changed

.github/DEVELOP.md

+18-4
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,23 @@ Do not forget if possible to enable the warnings in the end of the file to reduc
279279

280280
## CI/CD
281281

282-
We use GitLab CI for CI/CD with our own runners so as to keep private our sensitive files likes certificates and provisioning profiles.
282+
### GitHub Action
283+
284+
We use also *GitHub Actions* so as to define a workflow with some actions to build demo application and test the library.
285+
It will help use to ensure code on pull requests or being merged compiles and has all tests green.
286+
This workflow is defined in [this YAML](https://github.com/Orange-OpenSource/ouds-ios/blob/develop/.github/workflows/build-and-test.yml)
287+
288+
We have also a *gitleaks* workflow making some scans on the code to loook fo secrets leaks, defined in [this YAML](https://github.com/Orange-OpenSource/ouds-ios/blob/develop/.github/workflows/gitleaks-action.yml).
289+
290+
We use also two GitHub apps making controls on pull requests and defining wether or not prerequisites are filled or not.
291+
There is on control to check if [PR template are all defined ](https://github.com/stilliard/github-task-list-completed), and one if [DCO is applied](https://probot.github.io/apps/dco/).
292+
293+
### GitLab CI (internal)
294+
295+
We use *GitLab CI*for CI/CD with our own runners so as to keep private our sensitive files likes certificates and provisioning profiles.
283296
Our currant plan does not allow to make GitHub mirroring, so we use GitHub HTTP REST API to download sources, before using Xcode to build and sign.
284-
If you want to set up your runners, feel free to have a look on */docs_release/README.md*
285-
However of course you will have to define all the variables, secrets and have the mandatory files listed above.
297+
However of course you will have to define all the variables, secrets and have the mandatory files.
298+
299+
You can find more details about the pipelines, how to set up runners and scripts to use [in the wiki](https://github.com/Orange-OpenSource/ouds-ios/wiki/5-%E2%80%90-About-continuous-integration-and-delivery).
286300

287-
You can find more details about the pipelines and script [in the wiki](https://github.com/Orange-OpenSource/ouds-ios/wiki/5-%E2%80%90-About-continuous-integration-and-delivery).
301+
In few words, there is a pipeline containing some stages and jobs to build alpha, nightly/beta and production releases.

.github/workflows/build-and-test.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#
2+
# Software Name: Orange Unified Design System
3+
# SPDX-FileCopyrightText: Copyright (c) Orange SA
4+
# SPDX-License-Identifier: MIT
5+
#
6+
# This software is distributed under the MIT license,
7+
# the text of which is available at https://opensource.org/license/MIT/
8+
# or see the "LICENSE" file for more details.
9+
#
10+
# Authors: See CONTRIBUTORS.txt
11+
# Software description: A SwiftUI components library with code examples for Orange Unified Design System
12+
#
13+
14+
name: Build and Test
15+
16+
on:
17+
# For protected and most important branches
18+
push:
19+
branches:
20+
- main
21+
- develop
22+
23+
# To trigger manually
24+
workflow_dispatch:
25+
26+
# Pull request events
27+
pull_request:
28+
types:
29+
- opened
30+
- synchronize
31+
32+
jobs:
33+
# Build the app (if there are linter errors or compiler issues, it will fail)
34+
build:
35+
runs-on: macos-latest
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Xcode 16
41+
run: |
42+
sudo xcode-select -s /Applications/Xcode_16.app/Contents/Developer
43+
44+
- name: Set up Ruby
45+
uses: ruby/setup-ruby@v1
46+
with:
47+
ruby-version: '3.1'
48+
49+
- name: Install Fastlane
50+
run: |
51+
bundle install
52+
53+
- name: Build demo app
54+
run: |
55+
cd Showcase
56+
bundle exec fastlane buildDebugApp
57+
58+
# Test the library with unit tests
59+
test:
60+
runs-on: macos-latest
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v4
64+
65+
- name: Set up Xcode 16
66+
run: |
67+
sudo xcode-select -s /Applications/Xcode_16.app/Contents/Developer
68+
69+
- name: Set up Ruby
70+
uses: ruby/setup-ruby@v1
71+
with:
72+
ruby-version: '3.1'
73+
74+
- name: Install Fastlane
75+
run: |
76+
bundle install
77+
78+
- name: Run unit tests on demo app
79+
run: |
80+
cd Showcase
81+
bundle exec pod install
82+
bundle exec fastlane ios test

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
/Showcase/Showcase.xcworkspace/xcuserdata/
2828
/DerivedData/
2929

30+
# Produced by Fastlane
31+
/Showcase/build/
32+
3033
# Produced by Swift Package Manager
3134
/.swiftpm/xcode/xcshareddata/
3235
/.swiftpm/xcode/xcuserdata/

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
### Added
1010

11+
- [Tool] GitHub Actions workflow for CI/CD ([#256](https://github.com/Orange-OpenSource/ouds-ios/issues/256))
1112
- [DemoApp] Add new tokens in size tokens page ([#245](https://github.com/Orange-OpenSource/ouds-ios/issues/245))
1213
- [Library] Semantic token `borderWidthFocusInset` (value of `borderWidth100`) ([#207](https://github.com/Orange-OpenSource/ouds-ios/issues/207), [#241](https://github.com/Orange-OpenSource/ouds-ios/issues/241))
1314
- [Library] Semantic token `fontWeightCode` ([#242](https://github.com/Orange-OpenSource/ouds-ios/issues/242))

Showcase/fastlane/Fastfile

+23-8
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,17 @@ platform :ios do
100100
device: device,
101101
skip_build: true)
102102

103-
publish_mattermost_notification("🧪 ✅ No issue with tests")
104-
103+
if MATTERMOST_HOOK_URL.nil? || MATTERMOST_HOOK_URL.empty?
104+
puts "ℹ️ No MATTERMOST_HOOK_URL defined, it could mean this lane is called on GitHub Action workflow or locally"
105+
else
106+
publish_mattermost_notification("🧪 ✅ No issue with tests")
107+
end
105108
rescue => error
106-
publish_mattermost_notification("🧪 🚨 @channel Some issue occured with tests (:test)")
109+
if MATTERMOST_HOOK_URL.nil? || MATTERMOST_HOOK_URL.empty?
110+
puts "ℹ️ No MATTERMOST_HOOK_URL defined, it could mean this lane is called on GitHub Action workflow or locally"
111+
else
112+
publish_mattermost_notification("🧪 🚨 @channel Some issue occured with tests (:test)")
113+
end
107114
raise error
108115
end
109116
end
@@ -125,10 +132,17 @@ platform :ios do
125132
skip_build: true
126133
)
127134

128-
publish_mattermost_notification("🧪 ✅ No issue with UI tests")
129-
135+
if MATTERMOST_HOOK_URL.nil? || MATTERMOST_HOOK_URL.empty?
136+
puts "ℹ️ No MATTERMOST_HOOK_URL defined, it could mean this lane is called on GitHub Action workflow or locally"
137+
else
138+
publish_mattermost_notification("🧪 ✅ No issue with UI tests")
139+
end
130140
rescue => error
131-
publish_mattermost_notification("🧪 🚨 @channel Some issue occured with tests (:test_ui)")
141+
if MATTERMOST_HOOK_URL.nil? || MATTERMOST_HOOK_URL.empty?
142+
puts "ℹ️ No MATTERMOST_HOOK_URL defined, it could mean this lane is called on GitHub Action workflow or locally"
143+
else
144+
publish_mattermost_notification("🧪 🚨 @channel Some issue occured with tests (:test_ui)")
145+
end
132146
raise error
133147
end
134148
end
@@ -167,10 +181,11 @@ platform :ios do
167181
scheme: OUDS_SCHEME,
168182
output_directory: 'build/',
169183
archive_path: 'build/',
170-
output_name: 'oudsApp',
184+
output_name: 'odsApp',
171185
configuration: 'Debug',
172186
include_symbols: true,
173-
export_method: 'development'
187+
skip_archive: true,
188+
destination: "generic/platform=iOS Simulator"
174189
)
175190
end
176191

0 commit comments

Comments
 (0)