mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Setup test reports uploading to SonarCloud
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
name: Sonar
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [ "Tests" ]
|
||||
types:
|
||||
- completed
|
||||
jobs:
|
||||
sonar:
|
||||
name: Sonar
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.workflow_run.conclusion == 'success'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
# Adapted from https://github.com/matrix-org/matrix-js-sdk/blob/develop/.github/workflows/sonarqube.yml
|
||||
# There's a 'download artifact' action, but it hasn't been updated for the workflow_run action
|
||||
# (https://github.com/actions/download-artifact/issues/60) so instead we get this mess:
|
||||
- name: Download Test Results
|
||||
uses: actions/github-script@v3.1.0
|
||||
with:
|
||||
script: |
|
||||
const artifacts = await github.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: ${{ github.event.workflow_run.id }},
|
||||
});
|
||||
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
||||
return artifact.name == "test_output"
|
||||
})[0];
|
||||
const download = await github.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: matchArtifact.id,
|
||||
archive_format: 'zip',
|
||||
});
|
||||
const fs = require('fs');
|
||||
fs.writeFileSync('${{github.workspace}}/test_output.zip', Buffer.from(download.data));
|
||||
|
||||
- name: Extract test tesults
|
||||
run: unzip -d fastlane/test_output test_output.zip && rm test_output.zip
|
||||
|
||||
- name: SonarCloud scan
|
||||
uses: SonarSource/sonarcloud-github-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Unit and UI Tests
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -31,5 +31,11 @@ jobs:
|
||||
bundle config path vendor/bundle
|
||||
bundle install --jobs 4 --retry 3
|
||||
|
||||
- name: Tests
|
||||
run: bundle exec fastlane tests
|
||||
- name: Run tests
|
||||
run: bundle exec fastlane tests
|
||||
|
||||
- name: Upload Test Results
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: test_output
|
||||
path: fastlane/test_output
|
||||
@@ -5,7 +5,7 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem 'fastlane'
|
||||
gem 'xcov'
|
||||
gem 'slather'
|
||||
|
||||
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
|
||||
eval_gemfile(plugins_path) if File.exist?(plugins_path)
|
||||
|
||||
+22
-10
@@ -3,6 +3,11 @@ GEM
|
||||
specs:
|
||||
CFPropertyList (3.0.5)
|
||||
rexml
|
||||
activesupport (7.0.2.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
artifactory (3.0.15)
|
||||
@@ -25,10 +30,12 @@ GEM
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
babosa (1.0.4)
|
||||
claide (1.1.0)
|
||||
clamp (1.3.2)
|
||||
colored (1.2)
|
||||
colored2 (3.1.2)
|
||||
commander (4.6.0)
|
||||
highline (~> 2.0.0)
|
||||
concurrent-ruby (1.1.10)
|
||||
declarative (0.0.20)
|
||||
digest-crc (0.6.4)
|
||||
rake (>= 12.0.0, < 14.0.0)
|
||||
@@ -154,6 +161,8 @@ GEM
|
||||
http-cookie (1.0.4)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
i18n (1.10.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jmespath (1.6.0)
|
||||
json (2.6.1)
|
||||
jwt (2.3.0)
|
||||
@@ -163,15 +172,19 @@ GEM
|
||||
mime-types-data (3.2022.0105)
|
||||
mini_magick (4.11.0)
|
||||
mini_mime (1.1.2)
|
||||
minitest (5.15.0)
|
||||
multi_json (1.15.0)
|
||||
multipart-post (2.0.0)
|
||||
nanaimo (0.3.0)
|
||||
naturally (2.2.1)
|
||||
netrc (0.11.0)
|
||||
nokogiri (1.13.4-arm64-darwin)
|
||||
racc (~> 1.4)
|
||||
optparse (0.1.1)
|
||||
os (1.1.4)
|
||||
plist (3.6.0)
|
||||
public_suffix (4.0.6)
|
||||
racc (1.6.0)
|
||||
rake (13.0.6)
|
||||
representable (3.1.1)
|
||||
declarative (< 0.1.0)
|
||||
@@ -196,7 +209,12 @@ GEM
|
||||
simctl (1.6.8)
|
||||
CFPropertyList
|
||||
naturally
|
||||
slack-notifier (2.4.0)
|
||||
slather (2.7.2)
|
||||
CFPropertyList (>= 2.2, < 4)
|
||||
activesupport
|
||||
clamp (~> 1.3)
|
||||
nokogiri (~> 1.12)
|
||||
xcodeproj (~> 1.21)
|
||||
terminal-notifier (2.0.0)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
@@ -205,6 +223,8 @@ GEM
|
||||
tty-screen (0.8.1)
|
||||
tty-spinner (0.9.3)
|
||||
tty-cursor (~> 0.7)
|
||||
tzinfo (2.0.4)
|
||||
concurrent-ruby (~> 1.0)
|
||||
uber (0.1.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
@@ -219,18 +239,10 @@ GEM
|
||||
colored2 (~> 3.1)
|
||||
nanaimo (~> 0.3.0)
|
||||
rexml (~> 3.2.4)
|
||||
xcov (1.8.1)
|
||||
fastlane (>= 2.141.0, < 3.0.0)
|
||||
multipart-post
|
||||
slack-notifier
|
||||
terminal-table
|
||||
xcodeproj
|
||||
xcresult (~> 0.2.0)
|
||||
xcpretty (0.3.0)
|
||||
rouge (~> 2.0.7)
|
||||
xcpretty-travis-formatter (1.0.1)
|
||||
xcpretty (~> 0.2, >= 0.0.7)
|
||||
xcresult (0.2.1)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin-21
|
||||
@@ -239,7 +251,7 @@ DEPENDENCIES
|
||||
fastlane
|
||||
fastlane-plugin-diawi
|
||||
fastlane-plugin-xcodegen
|
||||
xcov
|
||||
slather
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.7
|
||||
|
||||
+8
-1
@@ -92,7 +92,14 @@ end
|
||||
|
||||
lane :tests do
|
||||
run_tests()
|
||||
xcov()
|
||||
|
||||
slather(
|
||||
sonarqube_xml: true,
|
||||
output_directory: "./fastlane/test_output",
|
||||
proj: "ElementX.xcodeproj",
|
||||
scheme: "ElementX",
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
desc "Upload IPA to Diawi"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
sonar.coverageReportPaths=fastlane/test_output/sonarqube-generic-coverage.xml
|
||||
sonar.junit.reportPaths=fastlane/test_output/report.junit
|
||||
Reference in New Issue
Block a user