Skip to content

Commit c77d446

Browse files
authored
Github Actions cleanup and linting additions (#1461)
Adds some new linters: YamlLint (YAML files) and RuboCop (Ruby files). Moves SwiftLint to our own runner. All three of these have built-in GitHub Actions output formats, so we don't need to do anything special to have them work. Applies YAML and Ruby cleanup. Adds some short-circuit logic for caching to speed up various Actions. Adds a flag to make Firebase optionally use xcframeworks for test builds so they don't need to compile them. We only need to build it for release builds since they lack the ARM Mac slices.
1 parent 71ccf41 commit c77d446

18 files changed

+529
-425
lines changed

.github/move.yml

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ lockSourceIssue: false
1010
# aliases:
1111
# r: repo
1212
# or: owner/repo
13-

.github/workflows/ci.yml

+87-51
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,101 @@ env:
1212
FASTLANE_XCODE_LIST_TIMEOUT: 60
1313
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60
1414
HOMEBREW_NO_INSTALL_CLEANUP: TRUE
15+
BUNDLE_PATH: vendor/bundle
1516

1617
jobs:
17-
SwiftLint:
18+
YamlLint:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: YamlLint
23+
run: yamllint --strict --format github .
24+
25+
RuboCop:
1826
runs-on: ubuntu-latest
1927
steps:
2028
- uses: actions/checkout@v2
29+
- uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: '2.7'
32+
bundler-cache: true
33+
- name: RuboCop
34+
run: bundle exec rubocop --format github
35+
36+
SwiftLint:
37+
runs-on: macos-latest
38+
steps:
39+
- uses: actions/checkout@v2
40+
41+
- uses: actions/cache@v2
42+
name: "Cache: Pods"
43+
id: cache_pods
44+
with:
45+
path: Pods
46+
key: ${{ runner.os }}-lint-pods-${{ hashFiles('**/Podfile.lock') }}
47+
48+
- name: Install Pods
49+
if: steps.cache_pods.outputs.cache-hit != 'true'
50+
run: |
51+
bundle install
52+
ONLY_SUPPORT_MODULES=1 bundle exec pod install --repo-update
53+
2154
- name: SwiftLint
22-
uses: norio-nomura/action-swiftlint@3.1.0
23-
env:
24-
DIFF_BASE: ${{ github.base_ref }}
55+
run: Pods/SwiftLint/swiftlint lint --strict --config .swiftlint.yml --reporter github-actions-logging
2556

2657
test:
2758
runs-on: macos-latest
2859
timeout-minutes: 60
2960
steps:
30-
- uses: actions/checkout@v2
31-
32-
- uses: actions/cache@v2
33-
name: "Cache: Pods"
34-
with:
35-
path: |
36-
Pods
37-
Tools/MaterialDesignIcons.ttf
38-
Tools/MaterialDesignIcons.json
39-
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock', 'Tools/BuildMaterialDesignIconsFont.sh') }}
40-
restore-keys: |
41-
${{ runner.os }}-pods-
42-
43-
- uses: actions/cache@v2
44-
name: "Cache: Gems"
45-
with:
46-
path: vendor/bundle
47-
key: ${{ runner.os }}-gems-${{ env.ImageVersion }}-${{ env.DEVELOPER_DIR }}-${{ hashFiles('**/Gemfile.lock') }}
48-
restore-keys: |
49-
${{ runner.os }}-gems-${{ env.ImageVersion }}-${{ env.DEVELOPER_DIR }}
50-
51-
- name: Install Brews
52-
run: brew bundle
53-
54-
- name: Install Gems
55-
run: |
56-
bundle config path vendor/bundle
57-
bundle install --jobs 4 --retry 3
58-
59-
- name: Install Pods
60-
run: diff Pods/Manifest.lock Podfile.lock >/dev/null || bundle exec pod install --repo-update
61-
62-
- name: Run tests
63-
run: bundle exec fastlane test
64-
65-
- uses: codecov/codecov-action@v1
66-
name: "Upload Code Coverage"
67-
68-
- uses: actions/upload-artifact@v2
69-
name: "Upload Test Logs"
70-
if: ${{ always() }}
71-
with:
72-
name: test-logs
73-
path: |
74-
~/Library/Logs/DiagnosticReports
75-
~/Library/Developer/Xcode/DerivedData/HomeAssistant-*/Logs/Test
76-
~/Library/Logs/scan
61+
- uses: actions/checkout@v2
62+
63+
- uses: actions/cache@v2
64+
name: "Cache: Pods"
65+
id: cache_pods
66+
with:
67+
path: |
68+
Pods
69+
Tools/MaterialDesignIcons.ttf
70+
Tools/MaterialDesignIcons.json
71+
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock', 'Tools/BuildMaterialDesignIconsFont.sh') }}
72+
restore-keys: |
73+
${{ runner.os }}-pods-
74+
75+
- uses: actions/cache@v2
76+
name: "Cache: Gems"
77+
id: cache_gems
78+
with:
79+
path: vendor/bundle
80+
key: >-
81+
${{ runner.os }}-gems-${{ env.ImageVersion }}-${{ env.DEVELOPER_DIR }}-${{ hashFiles('**/Gemfile.lock') }}
82+
restore-keys: |
83+
${{ runner.os }}-gems-${{ env.ImageVersion }}-${{ env.DEVELOPER_DIR }}
84+
85+
- name: Install Brews
86+
# right now, we don't need anything from brew for tests, so save some time
87+
if: ${{ false }}
88+
run: brew bundle
89+
90+
- name: Install Gems
91+
if: steps.cache_gems.outputs.cache-hit != 'true'
92+
run: bundle install --jobs 4 --retry 3
93+
94+
- name: Install Pods
95+
if: steps.cache_pods.outputs.cache-hit != 'true'
96+
run: bundle exec pod install --repo-update
97+
98+
- name: Run tests
99+
run: bundle exec fastlane test
100+
101+
- uses: codecov/codecov-action@v1
102+
name: "Upload Code Coverage"
103+
104+
- uses: actions/upload-artifact@v2
105+
name: "Upload Test Logs"
106+
if: ${{ always() }}
107+
with:
108+
name: test-logs
109+
path: |
110+
~/Library/Logs/DiagnosticReports
111+
~/Library/Developer/Xcode/DerivedData/HomeAssistant-*/Logs/Test
112+
~/Library/Logs/scan

.github/workflows/distribute.yml

+58-59
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ env:
1212
FASTLANE_XCODE_LIST_TIMEOUT: 60
1313
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60
1414
HOMEBREW_NO_INSTALL_CLEANUP: TRUE
15+
BUNDLE_PATH: vendor/bundle
1516

1617
jobs:
1718
build:
@@ -20,70 +21,68 @@ jobs:
2021
matrix:
2122
kind: [mac, ios]
2223
steps:
23-
- uses: actions/checkout@v2
24+
- uses: actions/checkout@v2
2425

25-
- name: Install Brews
26-
run: brew bundle
26+
- name: Install Brews
27+
run: brew bundle
2728

28-
- name: Install Gems
29-
run: |
30-
bundle config path vendor/bundle
31-
bundle install --jobs 4 --retry 3
29+
- name: Install Gems
30+
run: bundle install --jobs 4 --retry 3
3231

33-
- name: Install Pods
34-
run: bundle exec pod install --repo-update
32+
- name: Install Pods
33+
run: COMPILE_FIREBASE=1 bundle exec pod install --repo-update
3534

36-
- name: Build ${{ matrix.kind }}
37-
run: |
38-
bundle exec fastlane ${{ matrix.kind }} build
39-
env:
40-
HOMEASSISTANT_APPLE_ID: ${{ secrets.HOMEASSISTANT_APPLE_ID }}
41-
HOMEASSISTANT_APP_STORE_CONNECT_PASSWORD: ${{ secrets.HOMEASSISTANT_APP_STORE_CONNECT_PASSWORD }}
42-
HOMEASSISTANT_APP_STORE_CONNECT_TEAM_ID: ${{ secrets.HOMEASSISTANT_APP_STORE_CONNECT_TEAM_ID }}
43-
HOMEASSISTANT_TEAM_ID: ${{ secrets.HOMEASSISTANT_TEAM_ID }}
44-
P12_KEY_IOS_APP_STORE: ${{ secrets.P12_KEY_IOS_APP_STORE }}
45-
P12_KEY_MAC_APP_STORE: ${{ secrets.P12_KEY_MAC_APP_STORE }}
46-
P12_KEY_MAC_DEVELOPER_ID: ${{ secrets.P12_KEY_MAC_DEVELOPER_ID }}
47-
P12_VALUE_IOS_APP_STORE: ${{ secrets.P12_VALUE_IOS_APP_STORE }}
48-
P12_VALUE_MAC_APP_STORE: ${{ secrets.P12_VALUE_MAC_APP_STORE }}
49-
P12_VALUE_MAC_DEVELOPER_ID: ${{ secrets.P12_VALUE_MAC_DEVELOPER_ID }}
50-
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
51-
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
52-
# hard-coded so it doesn't cause 'ios' to be *** everywhere in the logs
53-
SENTRY_PROJECT: ios
35+
- name: Build ${{ matrix.kind }}
36+
run: |
37+
bundle exec fastlane ${{ matrix.kind }} build
38+
env:
39+
HOMEASSISTANT_APPLE_ID: ${{ secrets.HOMEASSISTANT_APPLE_ID }}
40+
HOMEASSISTANT_APP_STORE_CONNECT_PASSWORD: ${{ secrets.HOMEASSISTANT_APP_STORE_CONNECT_PASSWORD }}
41+
HOMEASSISTANT_APP_STORE_CONNECT_TEAM_ID: ${{ secrets.HOMEASSISTANT_APP_STORE_CONNECT_TEAM_ID }}
42+
HOMEASSISTANT_TEAM_ID: ${{ secrets.HOMEASSISTANT_TEAM_ID }}
43+
P12_KEY_IOS_APP_STORE: ${{ secrets.P12_KEY_IOS_APP_STORE }}
44+
P12_KEY_MAC_APP_STORE: ${{ secrets.P12_KEY_MAC_APP_STORE }}
45+
P12_KEY_MAC_DEVELOPER_ID: ${{ secrets.P12_KEY_MAC_DEVELOPER_ID }}
46+
P12_VALUE_IOS_APP_STORE: ${{ secrets.P12_VALUE_IOS_APP_STORE }}
47+
P12_VALUE_MAC_APP_STORE: ${{ secrets.P12_VALUE_MAC_APP_STORE }}
48+
P12_VALUE_MAC_DEVELOPER_ID: ${{ secrets.P12_VALUE_MAC_DEVELOPER_ID }}
49+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
50+
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
51+
# hard-coded so it doesn't cause 'ios' to be *** everywhere in the logs
52+
SENTRY_PROJECT: ios
5453

55-
- name: Dump Version Information
56-
run: cat Configuration/Version.xcconfig
54+
- name: Dump Version Information
55+
run: cat Configuration/Version.xcconfig
5756

58-
- uses: actions/upload-artifact@v2
59-
name: "Upload iOS IPA"
60-
if: success() && matrix.kind == 'ios'
61-
with:
62-
name: ios-app-store.ipa
63-
path: build/ios/Home Assistant.ipa
64-
- uses: actions/upload-artifact@v2
65-
name: "Upload iOS dSYMs"
66-
if: success() && matrix.kind == 'ios'
67-
with:
68-
name: ios.dSYM.zip
69-
path: build/ios/Home Assistant.app.dSYM.zip
57+
- uses: actions/upload-artifact@v2
58+
name: "Upload iOS IPA"
59+
if: success() && matrix.kind == 'ios'
60+
with:
61+
name: ios-app-store.ipa
62+
path: build/ios/Home Assistant.ipa
63+
- uses: actions/upload-artifact@v2
64+
name: "Upload iOS dSYMs"
65+
if: success() && matrix.kind == 'ios'
66+
with:
67+
name: ios.dSYM.zip
68+
path: build/ios/Home Assistant.app.dSYM.zip
7069

71-
- uses: actions/upload-artifact@v2
72-
name: "Upload Mac Developer ID App"
73-
if: success() && matrix.kind == 'mac'
74-
with:
75-
name: mac-developer-id.zip
76-
path: build/macos/home-assistant-mac.zip
77-
- uses: actions/upload-artifact@v2
78-
name: "Upload Mac App Store Package"
79-
if: success() && matrix.kind == 'mac'
80-
with:
81-
name: mac-app-store.pkg
82-
path: build/macos/Home Assistant.pkg
70+
- uses: actions/upload-artifact@v2
71+
name: "Upload Mac Developer ID App"
72+
if: success() && matrix.kind == 'mac'
73+
with:
74+
name: mac-developer-id.zip
75+
path: build/macos/home-assistant-mac.zip
76+
- uses: actions/upload-artifact@v2
77+
name: "Upload Mac App Store Package"
78+
if: success() && matrix.kind == 'mac'
79+
with:
80+
name: mac-app-store.pkg
81+
path: build/macos/Home Assistant.pkg
8382

84-
- uses: actions/upload-artifact@v2
85-
name: "Upload Mac dSYMs"
86-
if: success() && matrix.kind == 'mac'
87-
with:
88-
name: mac.dSYM.zip
89-
path: build/macos/Home Assistant.app.dSYM.zip
83+
- uses: actions/upload-artifact@v2
84+
name: "Upload Mac dSYMs"
85+
if: success() && matrix.kind == 'mac'
86+
with:
87+
name: mac.dSYM.zip
88+
path: build/macos/Home Assistant.app.dSYM.zip

.github/workflows/download_localized_strings.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ name: Download Localized Strings
22
on:
33
workflow_dispatch:
44
schedule:
5-
# If there are no changes, this does nothing. If there are changes, it either creates or updates an existing PR.
6-
- cron: '0 6 * * *'
5+
# If there are no changes, this does nothing. If there are changes, it either creates or updates an existing PR.
6+
- cron: '0 6 * * *'
77

88
env:
99
HOMEBREW_NO_INSTALL_CLEANUP: TRUE
10+
BUNDLE_PATH: vendor/bundle
1011

1112
jobs:
1213
update_strings:
@@ -20,9 +21,7 @@ jobs:
2021
run: brew bundle
2122

2223
- name: Install Gems
23-
run: |
24-
bundle config path vendor/bundle
25-
bundle install --jobs 4 --retry 3
24+
run: bundle install --jobs 4 --retry 3
2625

2726
- name: Install Pods
2827
run: bundle exec pod install --repo-update

.github/workflows/set_version.yml

+25-25
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ jobs:
99
bump:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
13-
with:
14-
ssh-key: ${{ secrets.HOMEASSISTANT_SSH_DEPLOY_KEY }}
15-
- uses: ruby/setup-ruby@v1
16-
with:
17-
ruby-version: '2.7'
18-
bundler-cache: true
19-
- run: "bundle exec fastlane set_version version:${{ github.event.inputs.version }}"
20-
- name: Commit changes
21-
id: commit
22-
run: |
23-
source Configuration/Version.xcconfig
24-
git config --global user.name 'Home Assistant Bot'
25-
git config --global user.email 'hello@home-assistant.io'
26-
git add Configuration/Version.xcconfig
27-
git commit -m "Bump Build to $MARKETING_VERSION ($CURRENT_PROJECT_VERSION)"
28-
git clean -xfd
29-
echo ::set-output name=pr_title::"$(git log -1 --pretty='%s')"
30-
- name: Create Pull Request
31-
uses: peter-evans/create-pull-request@v3
32-
with:
33-
base: master
34-
branch: create-pull-request/bump_build
35-
title: ${{ steps.commit.outputs.pr_title }}
36-
body: "Automatically created by ${{ github.actor }}."
12+
- uses: actions/checkout@v2
13+
with:
14+
ssh-key: ${{ secrets.HOMEASSISTANT_SSH_DEPLOY_KEY }}
15+
- uses: ruby/setup-ruby@v1
16+
with:
17+
ruby-version: '2.7'
18+
bundler-cache: true
19+
- run: "bundle exec fastlane set_version version:${{ github.event.inputs.version }}"
20+
- name: Commit changes
21+
id: commit
22+
run: |
23+
source Configuration/Version.xcconfig
24+
git config --global user.name 'Home Assistant Bot'
25+
git config --global user.email 'hello@home-assistant.io'
26+
git add Configuration/Version.xcconfig
27+
git commit -m "Bump Build to $MARKETING_VERSION ($CURRENT_PROJECT_VERSION)"
28+
git clean -xfd
29+
echo ::set-output name=pr_title::"$(git log -1 --pretty='%s')"
30+
- name: Create Pull Request
31+
uses: peter-evans/create-pull-request@v3
32+
with:
33+
base: master
34+
branch: create-pull-request/bump_build
35+
title: ${{ steps.commit.outputs.pr_title }}
36+
body: "Automatically created by ${{ github.actor }}."

.rubocop.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
AllCops:
2+
NewCops: enable
3+
Exclude:
4+
- 'Pods/**/*'
5+
- 'vendor/**/*'
6+
7+
Metrics/BlockLength:
8+
Enabled: false
9+
10+
Style/FrozenStringLiteralComment:
11+
Enabled: false

.swiftlint.yml

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ excluded:
66
- fastlane
77
- Tests
88
- Pods
9+
- vendor

0 commit comments

Comments
 (0)