Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Fastlane workflows #2

Merged
merged 42 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
08b0a7b
Added project
Apr 19, 2024
00d5299
Added project
Apr 19, 2024
b45fc87
Updated file structure
Apr 19, 2024
f3d7c97
Updated file structure
Apr 19, 2024
e986d89
Added Fastlane
Apr 19, 2024
15d8296
Fixed Fastlane
Apr 19, 2024
4442510
Added pull_request workflow
Apr 22, 2024
faabc30
Added mac os runner
Apr 22, 2024
84c40d5
Added setup-ruby
Apr 22, 2024
3013aad
Moved setup-ruby
Apr 22, 2024
998df70
Added setup ruby step
Apr 22, 2024
00d6213
Fixed unit test call
Apr 22, 2024
cd66f9a
Neaten workflows
Apr 22, 2024
ecb9211
Added rubocop
Apr 22, 2024
726a46a
Added linters
Apr 22, 2024
78c6618
Updated swiftlint build phase
Apr 22, 2024
f9edb5c
Updated display name -> Gov.UK
Apr 22, 2024
e40a185
Added build number update
Apr 22, 2024
0efbeda
Added rubocop
Apr 22, 2024
4e50f94
Fixed configuration.rb case
Apr 22, 2024
58d69c9
Added swiftlint action
Apr 22, 2024
7e09e23
Removed swiftlint from github actions
Apr 22, 2024
215471e
Added linter
Apr 22, 2024
55750c6
Added Swiftlint
Apr 23, 2024
2f77458
Changed Rubocop linter
Apr 23, 2024
d39f53f
Added Rubocop error
Apr 23, 2024
07c8486
Use bundler for Rubocop
Apr 23, 2024
951dda4
Stop using bundler for Rubocop
Apr 23, 2024
8976b69
Cache bundler
Apr 23, 2024
3d9eff0
Run Swiftlint even if Rubocop fails
Apr 23, 2024
6b04365
Fail swiftlint
Apr 23, 2024
44313c7
Fixed lint errors
Apr 23, 2024
ddda506
Added .xcode-version
Apr 23, 2024
4dab0a0
Added select xcode
Apr 23, 2024
2809113
Removed local packages
Apr 24, 2024
0362262
Removed commented code
Apr 24, 2024
6066fdd
Added additional branches to Lint workflow
Apr 24, 2024
6a0ee06
Removed lint permissions
Apr 24, 2024
90fcb64
Added ruby lint error
Apr 24, 2024
1e4a96c
Added re-usable workflows
Apr 24, 2024
733f0e5
Updated concurrency
Apr 24, 2024
ad23022
Fixed ruby lint errors
Apr 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/alpha.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Alpha

on:
push:
branches:
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
uses: ./.github/workflows/lint.yml
unit-test:
uses: ./.github/workflows/unit_test.yml
33 changes: 33 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Lint

on:
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-lint
cancel-in-progress: true

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Rubocop
uses: reviewdog/action-rubocop@v2
with:
use_bundler: true

- name: SwiftLint
uses: norio-nomura/action-swiftlint@3.2.1
if: always()
with:
args: --strict
16 changes: 16 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Pull Request

on:
pull_request:
batesyuk marked this conversation as resolved.
Show resolved Hide resolved
types: [ opened, reopened, synchronize, ready_for_review ]
branches: [ develop, release/*, main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
uses: ./.github/workflows/lint.yml
unit-test:
uses: ./.github/workflows/unit_test.yml
31 changes: 31 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Unit Test

on:
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-unit
cancel-in-progress: true

jobs:
build:
name: Unit test
runs-on: macos-14

steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
fetch-depth: 0

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Select xcode
run: xcodes select

- name: Unit tests
run: bundle exec fastlane unit
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,5 @@ fastlane/test_output
iOSInjectionProject/
.idea/
secrets.xcconfig

build_for_unit_testing/
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.0
24 changes: 24 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
included:
- Production

analyzer_rules:
- unused_import

opt_in_rules:
- private_action
- private_outlet

trailing_whitespace:
ignores_empty_lines: false
vertical_whitespace:
max_empty_lines: 2
line_length:
warning: 120
ignores_urls: true
ignores_interpolated_strings: true
ignores_comments: true
large_tuple:
warning: 3
error: 4
nesting:
type_level: 2
1 change: 1 addition & 0 deletions .xcode-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
15.3
17 changes: 17 additions & 0 deletions Fastlane/.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

default: &DEFAULTS
app: &APP_DEFAULTS
scheme: GovUK
display_name: Gov.UK - Dev
output_directory: build_output
scan:
devices:
- iPhone 15 Pro

unit:
<<: *DEFAULTS

alpha:
app:
<<: *APP_DEFAULTS
display_name: Gov.UK - Alpha
50 changes: 50 additions & 0 deletions Fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# frozen_string_literal: true

require_relative 'configuration'

default_platform :ios

# rubocop:disable Metrics/BlockLength
platform :ios do
batesyuk marked this conversation as resolved.
Show resolved Hide resolved
desc 'Runs all the tests'
lane :unit do
unit_test
end

desc 'Builds alpha configuration'
lane :alpha do
update_build_number
build
end

private_lane :unit_test do
batesyuk marked this conversation as resolved.
Show resolved Hide resolved
scan(
scheme: configuration.app_scheme,
devices: configuration.scan_devices,
clean: false,
prelaunch_simulator: true,
derived_data_path: './build_for_unit_testing'
)
end

private_lane :build do |options|
gym(
scheme: configuration.app_scheme,
output_directory: configuration.app_output_directory,
clean: options[:clean].nil? ? true : options[:clean],
skip_profile_detection: true
)
end

private_lane :update_build_number do
increment_build_number(build_number: configuration.build_number)
end
end
batesyuk marked this conversation as resolved.
Show resolved Hide resolved

def configuration
@configuration ||= Configuration.new(
lane_context[SharedValues::LANE_NAME],
'.build.yml'
)
end
# rubocop:enable Metrics/BlockLength
40 changes: 40 additions & 0 deletions Fastlane/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
fastlane documentation
----

# Installation

Make sure you have the latest version of the Xcode command line tools installed:

```sh
xcode-select --install
```

For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)

# Available Actions

## iOS

### ios unit

```sh
[bundle exec] fastlane ios unit
```

Runs all the tests

### ios alpha

```sh
[bundle exec] fastlane ios alpha
```

Builds alpha configuration

----

This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.

More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).

The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
43 changes: 43 additions & 0 deletions Fastlane/configuration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# frozen_string_literal: true

require 'yaml'

# Configuration class to interface with .build.yml
class Configuration
def initialize(lane_name, yaml)
@lane_name = lane_name
@yaml = YAML.load_file(yaml, aliases: true)[lane]
end

def build_number
ENV['BUILD_NUMBER'] || '1'
end

def app_scheme
setting(:app, :scheme)
end

def app_output_directory
setting(:app, :output_directory)
end

def app_display_name
setting(:app, :display_name)
end

def scan_devices
setting(:scan, :devices)
end

private

attr_reader :lane_name, :yaml

def setting(prefix, key)
yaml[prefix.to_s][key.to_s]
end

def lane
@lane ||= lane_name.split(' ').last
end
end
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'fastlane'
gem 'rubocop'
Loading