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

✨ prepare Android specific test runs by paramaterization and test coverage #25

Merged
merged 28 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
92a6759
chore: support Android specific test run
jreimone Jul 13, 2023
63aa41f
test: mock github request using undici
agierlicki Jul 13, 2023
9b571c9
test: mock Octokit calls
jreimone Jul 13, 2023
7787da8
test: assert correct prepare comment
jreimone Jul 13, 2023
941ae05
fix undefined state of github token
jreimone Jul 13, 2023
aebfe1b
test: add parameters fro template and prepare object files
jreimone Jul 13, 2023
bbf249c
chore: add new parameters to call in addComment()
jreimone Jul 13, 2023
b2eafe8
test: add test for retrieving comment
jreimone Jul 14, 2023
0f013ec
test: figure how to retrieve response in correct format
jreimone Jul 14, 2023
46dc32f
chore: introduce context
jreimone Jul 14, 2023
748701e
test: output env
jreimone Jul 14, 2023
ce46e90
test: arg processing
jreimone Jul 14, 2023
c9f3219
chore: enable contexts for default, android, ios
jreimone Jul 14, 2023
8e4a125
chore: test and implement gha.retrieveValidPrepareObjectFromComment
jreimone Jul 17, 2023
6d9dd32
chore: test and implement gha.createAndPersistTestIoPayload
jreimone Jul 17, 2023
f855d75
chore: test and implement gha.triggerTestIoTest
jreimone Jul 17, 2023
262b350
chore: use gha.triggerTestIoTest in triggerTest.ts
jreimone Jul 17, 2023
88c4872
test: more edge cases
jreimone Jul 18, 2023
0f485d9
test: more edge cases
jreimone Jul 18, 2023
962db7e
ci: add workflow for executing tests on PRs
jreimone Jul 18, 2023
8055a19
test: create temp dir if not exists
jreimone Jul 18, 2023
3383285
test: fix folder hiccups
jreimone Jul 18, 2023
417cbd3
chore: relativized payload file in success report
jreimone Jul 18, 2023
dd3c4d3
test: create dir structure
jreimone Jul 18, 2023
b602300
chore(sonar): remove constructor parameters
jreimone Jul 18, 2023
795edaf
chore(sonar): add more tests
jreimone Jul 18, 2023
942e76b
chore: bump
jreimone Jul 18, 2023
8d0f9c8
Merge branch 'main' into support-android-tests
jreimone Jul 18, 2023
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
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Continuous Integration
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

jobs:
ci:
name: Continuous Integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install Dependencies
run: npm install

- name: Unit Tests
run: npm run test

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v1.9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ node_modules

# Jest
coverage

# custom
temp
17 changes: 13 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,23 @@ runs:
cd ${{github.action_path}}
npm install

- name: TestIO - Add PR comment for requesting required input
id: prepare
if: startsWith(github.event.comment.body, '@bot-testio exploratory-test create')
- name: TestIO - Add PR comment for requesting required input for default context
id: prepare-default
if: startsWith(github.event.comment.body, '@bot-testio exploratory-test create') && !startsWith(github.event.comment.body, '@bot-testio exploratory-test create android')
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
TESTIO_CREATE_COMMENT_URL: ${{ github.event.comment.html_url }}
shell: bash
run: npx ts-node ${{github.action_path}}/src/addPRcomment.ts
run: npx ts-node ${{github.action_path}}/src/addPRcomment.ts default

- name: TestIO - Add PR comment for requesting required input for Android context
id: prepare-android
if: startsWith(github.event.comment.body, '@bot-testio exploratory-test create android')
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
TESTIO_CREATE_COMMENT_URL: ${{ github.event.comment.html_url }}
shell: bash
run: npx ts-node ${{github.action_path}}/src/addPRcomment.ts android

- name: TestIO - Retrieve input and create payload
id: payload
Expand Down
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ module.exports = {
testEnvironment: 'node',
collectCoverage: true,
coverageReporters: ["clover", "json", "lcov", "text", "html"],
setupFiles: ['./test.setup.ts'],
// testTimeout: 10 * 1000,
restoreMocks: true
};
36 changes: 35 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"jest": "^29.6.1",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.3"
"typescript": "^5.1.3",
"undici": "^5.22.1"
},
"dependencies": {
"@actions/core": "^1.10.0",
Expand Down
18 changes: 18 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
sonar.projectKey=com.staffbase:testio-trigger-test-github-action
sonar.organization=staffbase

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=testio-management
#sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# https://docs.sonarqube.org/9.6/project-administration/narrowing-the-focus/
sonar.sources=src/
sonar.tests=test/

# required for enabling the scanner to use the generated coverage info
# https://docs.sonarcloud.io/enriching/test-coverage/javascript-typescript-test-coverage/
sonar.javascript.lcov.reportPaths=coverage/**/lcov.info

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
Loading