chore: enhance CI tests (#3344)

* chore: add swift linter

* chore: add clang linters

* chore: add kotlin linter

* chore(ci): update workflows

* chore(ci): clean workflows
This commit is contained in:
Krzysztof Moch
2023-12-02 15:58:43 +01:00
committed by GitHub
parent 26043335e1
commit 91d7135562
15 changed files with 271 additions and 3 deletions

26
scripts/bootstrap.js vendored Normal file
View File

@@ -0,0 +1,26 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const child_process = require('child_process');
const root = path.resolve(__dirname, '..');
const args = process.argv.slice(2);
const options = {
cwd: process.cwd(),
env: process.env,
stdio: 'inherit',
encoding: 'utf-8',
};
let result;
if (process.cwd() !== root || args.length) {
// We're not in the root of the project, or additional arguments were passed
// In this case, forward the command to `yarn`
result = child_process.spawnSync('yarn', args, options);
} else {
// If `yarn` is run without arguments, perform bootstrap
result = child_process.spawnSync('yarn', ['bootstrap'], options);
}
process.exitCode = result.status;

9
scripts/clang-format.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
if which clang-format >/dev/null; then
find ios -type f \( -name "*.h" -o -name "*.cpp" -o -name "*.m" -o -name "*.mm" \) -print0 | while read -d $'\0' file; do
clang-format -style=file:./ios/.clang-format -i "$file"
done
else
echo "[ERROR]: clang-format is not installed - Install with 'brew install clang-format' (or manually from https://clang.llvm.org/docs/ClangFormat.html)"
fi

7
scripts/kotlin-lint.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
if which ktlint >/dev/null; then
cd android && ktlint --color --relative --editorconfig=./.editorconfig -F ./**/*.kt*
else
echo "[ERROR]: KTLint is not installed - Install with 'brew install ktlint' (or manually from https://github.com/pinterest/ktlint)"
fi

7
scripts/swift-format.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
if which swiftformat >/dev/null; then
cd ios && swiftformat --quiet .
else
echo "[ERROR]: SwiftFormat is not installed -Install with 'brew install swiftformat' (or manually from https://github.com/nicklockwood/SwiftFormat)"
fi

7
scripts/swift-lint.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
if which swiftlint >/dev/null; then
cd ios && swiftlint --quiet --fix && swiftlint --quiet
else
echo "[ERROR]: SwiftLint is not installed - Install with 'brew install swiftlint' (or manually from https://github.com/realm/SwiftLint)"
fi