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

feat/custom gh actions for reassure #244

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6137433
Setup basic gh actions package
ShaswatPrabhat Oct 30, 2022
a304f3b
Merge branch 'main' into feat/custom_gh_actions
ShaswatPrabhat Oct 30, 2022
dfe1092
Update build script for gh action package
ShaswatPrabhat Oct 30, 2022
551f5db
Add changeset
ShaswatPrabhat Oct 30, 2022
9484a1b
Slight refactoring, add ts to new gh actions package
ShaswatPrabhat Oct 30, 2022
44ef601
Add function reassureGhAction
ShaswatPrabhat Oct 30, 2022
b008a93
Update action.yml index entry
ShaswatPrabhat Oct 30, 2022
7dd69b2
Update gh-actions and integrate custom action
ShaswatPrabhat Oct 30, 2022
bc278c7
Update action name in main yml file
ShaswatPrabhat Oct 30, 2022
a472ab9
Update gh action name
ShaswatPrabhat Oct 30, 2022
c09a91c
Update gh action name
ShaswatPrabhat Oct 30, 2022
8495bdc
Update version in gh action
ShaswatPrabhat Oct 30, 2022
3323a6b
Update gh action with relative path to package
ShaswatPrabhat Oct 30, 2022
4e01654
Update gh action with relative path to package
ShaswatPrabhat Oct 30, 2022
c11a0e5
Update gh action with repo path to package
ShaswatPrabhat Oct 30, 2022
e1a3912
Update gh action with repo path to package
ShaswatPrabhat Oct 30, 2022
b6e060b
Update action yaml to pick up ESM path
ShaswatPrabhat Oct 30, 2022
1506fcb
Update gh action - final attempt
ShaswatPrabhat Oct 30, 2022
199babd
Revert "Update gh action - final attempt"
ShaswatPrabhat Oct 30, 2022
5c764ab
Update action yaml to include yaml args
ShaswatPrabhat Oct 30, 2022
dd4b092
Update action in yaml
ShaswatPrabhat Oct 30, 2022
879551f
Add seperate job for new plugin
ShaswatPrabhat Oct 30, 2022
b24f1fe
Update branch ref in new job
ShaswatPrabhat Oct 30, 2022
8bb6ef8
Update branch ref in new job
ShaswatPrabhat Oct 30, 2022
6dc87cb
Remove ref from checkout job
ShaswatPrabhat Oct 31, 2022
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
5 changes: 5 additions & 0 deletions .changeset/modern-pillows-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@callstack/reassure-gh-actions': minor
---

Add custom gh actions package for reassure
17 changes: 14 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,19 @@ jobs:

- name: Run performance tests
run: cd examples/native && ./reassure-tests.sh

- name: Run Danger.js
run: yarn danger ci

build-validate-pref-tests-with-custom-action:
runs-on: ubuntu-latest
name: A job to test the new custom GH action
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'yarn'
- run: yarn install --force
- run: cd examples/native && ./reassure-tests.sh
- uses: ./../../packages/reassure-gh-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

12 changes: 12 additions & 0 deletions packages/reassure-gh-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'reassureGHAction'
description: 'Checks the files output by example react-native reassure tests'
inputs:
inputFilePath:
description: 'The input test file path'
required: false
debug:
description: 'Flag to enable debug'
required: false
runs:
using: 'node16'
main: 'lib/module/index.js'
42 changes: 42 additions & 0 deletions packages/reassure-gh-action/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@callstack/reassure-gh-actions",
"version": "0.0.1",
"description": "Performance testing companion for React and React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
"types": "lib/typescript/index.d.ts",
"source": "src/index",
"scripts": {
"build": "bob build"
},
"keywords": [
"react-native",
"ios",
"android"
],
"repository": "https://github.com/callstack/reassure",
"author": "Maciej Jastrzębski <[email protected]> (https://github.com/mdjastrzebski)",
"contributors": [
"Jakub Bujko <[email protected]> (https://github.com/Xiltyn)",
"Tomasz Krzyżowski <[email protected]> (https://github.com/TMaszko)",
"Michał Pierzchała <[email protected]> (https://github.com/thymikee)"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/callstack/reassure/issues"
},
"homepage": "https://github.com/callstack/reassure#readme",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1"
},
"react-native-builder-bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
"typescript"
]
}
}
14 changes: 14 additions & 0 deletions packages/reassure-gh-action/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import path from 'path';
import core from '@actions/core';
import { reassureGhAction, reassureGhActionConfig } from './reassureGhAction';

const index = () => {
const inputFilePath = core.getInput('inputFilePath', { required: false });
const debug = !!core.getInput('debug', { required: false });

const defaultInputFilePath = path.join(__dirname, './examples/native/.reassure/output.md');
const config: reassureGhActionConfig = { inputFilePath: inputFilePath || defaultInputFilePath, debug };
reassureGhAction(config);
};

export default index;
35 changes: 35 additions & 0 deletions packages/reassure-gh-action/src/reassureGhAction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import * as fs from 'fs';
import * as path from 'path';

export type reassureGhActionConfig = { inputFilePath: string; debug?: boolean };

export function reassureGhAction(config: reassureGhActionConfig = { inputFilePath: '.reassure/output.md' }) {
const _warning = `
⚠️ No output file found @ ${config.inputFilePath}
-------------------------------------------------------------
Review reassure configuration and make sure your markdown output
file can be found in the location shown above.
-------------------------------------------------------------
`;

try {
const perfFilePath = path.resolve(config.inputFilePath);
const perfFileContents = fs.readFileSync(perfFilePath, 'utf8');

if (config.debug) {
if (!perfFileContents) {
console.log(_warning);
} else {
console.log(perfFileContents);
}
} else {
if (!perfFileContents) {
console.warn(_warning);
} else {
console.log(perfFileContents);
}
}
} catch (error) {
console.error(_warning, error);
}
}
28 changes: 28 additions & 0 deletions packages/reassure-gh-action/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"allowJs": true,
"baseUrl": "./",
"isolatedModules": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"esModuleInterop": true,
"importsNotUsedAsValues": "error",
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["esnext"],
"module": "CommonJS",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noImplicitUseStrict": false,
"noStrictGenericChecks": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "esnext"
},
"include": ["src/**/*"],
"exclude": ["**/__tests__/**"]
}
77 changes: 76 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@
# yarn lockfile v1


"@actions/core@^1.10.0":
version "1.10.0"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.10.0.tgz#44551c3c71163949a2f06e94d9ca2157a0cfac4f"
integrity sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==
dependencies:
"@actions/http-client" "^2.0.1"
uuid "^8.3.2"

"@actions/github@^5.1.1":
version "5.1.1"
resolved "https://registry.yarnpkg.com/@actions/github/-/github-5.1.1.tgz#40b9b9e1323a5efcf4ff7dadd33d8ea51651bbcb"
integrity sha512-Nk59rMDoJaV+mHCOJPXuvB1zIbomlKS0dmSIqPGxd0enAXBnOfn4VWF+CGtRCwXZG9Epa54tZA7VIRlJDS8A6g==
dependencies:
"@actions/http-client" "^2.0.1"
"@octokit/core" "^3.6.0"
"@octokit/plugin-paginate-rest" "^2.17.0"
"@octokit/plugin-rest-endpoint-methods" "^5.13.0"

"@actions/http-client@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.0.1.tgz#873f4ca98fe32f6839462a6f046332677322f99c"
integrity sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==
dependencies:
tunnel "^0.0.6"

"@ampproject/remapping@^2.1.0":
version "2.1.2"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.1.2.tgz#4edca94973ded9630d20101cd8559cedb8d8bd34"
Expand Down Expand Up @@ -1829,6 +1854,19 @@
before-after-hook "^2.2.0"
universal-user-agent "^6.0.0"

"@octokit/core@^3.6.0":
version "3.6.0"
resolved "https://registry.yarnpkg.com/@octokit/core/-/core-3.6.0.tgz#3376cb9f3008d9b3d110370d90e0a1fcd5fe6085"
integrity sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==
dependencies:
"@octokit/auth-token" "^2.4.4"
"@octokit/graphql" "^4.5.8"
"@octokit/request" "^5.6.3"
"@octokit/request-error" "^2.0.5"
"@octokit/types" "^6.0.3"
before-after-hook "^2.2.0"
universal-user-agent "^6.0.0"

"@octokit/endpoint@^6.0.1":
version "6.0.12"
resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-6.0.12.tgz#3b4d47a4b0e79b1027fb8d75d4221928b2d05658"
Expand All @@ -1852,13 +1890,25 @@
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-11.2.0.tgz#b38d7fc3736d52a1e96b230c1ccd4a58a2f400a6"
integrity sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA==

"@octokit/openapi-types@^12.11.0":
version "12.11.0"
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-12.11.0.tgz#da5638d64f2b919bca89ce6602d059f1b52d3ef0"
integrity sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==

"@octokit/plugin-paginate-rest@^2.16.8":
version "2.17.0"
resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.17.0.tgz#32e9c7cab2a374421d3d0de239102287d791bce7"
integrity sha512-tzMbrbnam2Mt4AhuyCHvpRkS0oZ5MvwwcQPYGtMv4tUa5kkzG58SVB0fcsLulOZQeRnOgdkZWkRUiyBlh0Bkyw==
dependencies:
"@octokit/types" "^6.34.0"

"@octokit/plugin-paginate-rest@^2.17.0":
version "2.21.3"
resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz#7f12532797775640dbb8224da577da7dc210c87e"
integrity sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw==
dependencies:
"@octokit/types" "^6.40.0"

"@octokit/plugin-request-log@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz#5e50ed7083a613816b1e4a28aeec5fb7f1462e85"
Expand All @@ -1872,6 +1922,14 @@
"@octokit/types" "^6.34.0"
deprecation "^2.3.1"

"@octokit/plugin-rest-endpoint-methods@^5.13.0":
version "5.16.2"
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz#7ee8bf586df97dd6868cf68f641354e908c25342"
integrity sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==
dependencies:
"@octokit/types" "^6.39.0"
deprecation "^2.3.1"

"@octokit/request-error@^2.0.5", "@octokit/request-error@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.1.0.tgz#9e150357831bfc788d13a4fd4b1913d60c74d677"
Expand All @@ -1881,7 +1939,7 @@
deprecation "^2.0.0"
once "^1.4.0"

"@octokit/request@^5.6.0":
"@octokit/request@^5.6.0", "@octokit/request@^5.6.3":
version "5.6.3"
resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.6.3.tgz#19a022515a5bba965ac06c9d1334514eb50c48b0"
integrity sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==
Expand Down Expand Up @@ -1910,6 +1968,13 @@
dependencies:
"@octokit/openapi-types" "^11.2.0"

"@octokit/types@^6.39.0", "@octokit/types@^6.40.0":
version "6.41.0"
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.41.0.tgz#e58ef78d78596d2fb7df9c6259802464b5f84a04"
integrity sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==
dependencies:
"@octokit/openapi-types" "^12.11.0"

"@react-native-community/cli-clean@^9.1.0":
version "9.1.0"
resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-9.1.0.tgz#8d6c3591dbaa52a02bf345dcd79c3a997df6ade5"
Expand Down Expand Up @@ -8490,6 +8555,11 @@ tty-table@^4.1.5:
wcwidth "^1.0.1"
yargs "^17.1.1"

tunnel@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c"
integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==

[email protected]:
version "1.5.6"
resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.5.6.tgz#2e0e14343c84dde33b5a09ea5389ee6a9565779c"
Expand Down Expand Up @@ -8716,6 +8786,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=

uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==

v8-to-istanbul@^9.0.1:
version "9.0.1"
resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz#b6f994b0b5d4ef255e17a0d17dc444a9f5132fa4"
Expand Down