Github action and creation scripts
This commit is contained in:
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# addons-linter is not happy to see a `.github` folder in src/_locales.
|
||||
# We need to do an horrible hack to run the test.
|
||||
|
||||
. $(dirname $0)/commons.sh
|
||||
|
||||
TMPDIR=/tmp/MAC_addonsLinter
|
||||
|
||||
print Y "Update the submodules..."
|
||||
git submodule init || die
|
||||
git submodule update --remote --depth 1 src/_locales || die
|
||||
|
||||
printn Y "Removing previous execution data... "
|
||||
rm -rf $TMPDIR || die
|
||||
print G "done."
|
||||
|
||||
printn Y "Creating a tmp folder ($TMPDIR)... "
|
||||
mkdir $TMPDIR || die
|
||||
print G "done."
|
||||
|
||||
printn Y "Copying data... "
|
||||
cp -r src $TMPDIR || die
|
||||
print G "done."
|
||||
|
||||
printn Y "Removing the github folder... "
|
||||
rm -rf $TMPDIR/src/_locales/.github || die
|
||||
print G "done."
|
||||
|
||||
print Y "Running the test..."
|
||||
$(npm bin)/addons-linter $TMPDIR/src || die
|
||||
+21
-1
@@ -1 +1,21 @@
|
||||
npm install && npm run deploy
|
||||
#!/bin/bash
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
. $(dirname $0)/commons.sh
|
||||
|
||||
print Y "Update the submodules..."
|
||||
git submodule init || die
|
||||
git submodule update --remote --depth 1 src/_locales || die
|
||||
|
||||
print Y "Installing dependencies..."
|
||||
npm install || die
|
||||
|
||||
print Y "Running tests..."
|
||||
npm test
|
||||
|
||||
print Y "Creating the final package..."
|
||||
cd src || die
|
||||
$(npm bin)/web-ext build --overwrite-dest || die
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
printv() {
|
||||
if [ -t 1 ]; then
|
||||
NCOLORS=$(tput colors)
|
||||
|
||||
if test -n "$NCOLORS" && test "$NCOLORS" -ge 8; then
|
||||
NORMAL="$(tput sgr0)"
|
||||
RED="$(tput setaf 1)"
|
||||
GREEN="$(tput setaf 2)"
|
||||
YELLOW="$(tput setaf 3)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $2 = 'G' ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
echo $1 -e "${GREEN}$3${NORMAL}"
|
||||
elif [[ $2 = 'Y' ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
echo $1 -e "${YELLOW}$3${NORMAL}"
|
||||
elif [[ $2 = 'N' ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
echo $1 -e "$3"
|
||||
else
|
||||
# shellcheck disable=SC2086
|
||||
echo $1 -e "${RED}$3${NORMAL}"
|
||||
fi
|
||||
}
|
||||
|
||||
print() {
|
||||
printv '' "$1" "$2"
|
||||
}
|
||||
|
||||
printn() {
|
||||
printv "-n" "$1" "$2"
|
||||
}
|
||||
|
||||
error() {
|
||||
printv '' R "$1"
|
||||
}
|
||||
|
||||
die() {
|
||||
if [[ "$1" ]]; then
|
||||
error "$1"
|
||||
else
|
||||
error Failed
|
||||
fi
|
||||
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user