Skip to content

Commit

Permalink
ci: github actions
Browse files Browse the repository at this point in the history
- remove .travis.yml
- ./travis_{script,install}.sh -> ./ci_{script,install}.sh
- flush stdout in test script to see logs more promptly
- adjust git config to ignore 'detachedHead' warnings
  • Loading branch information
mcspr committed Dec 30, 2020
1 parent 15e3806 commit f11468a
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 76 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Normal push, check the build status for the nighly builder or the release

name: ESPurna build

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: x64
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Cache Node
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-${{ hashFiles('code/package-lock.json', 'code/package.json') }}
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('code/platformio.ini') }}
- name: Host tests
run: |
./ci_install.sh host
./ci_script.sh host
- name: WebUI tests
run: |
./ci_install.sh webui
./ci_script.sh webui
- name: PlatformIO build
env:
BUILDER_TOTAL_THREADS: 4
ESPURNA_PIO_PATCH_ISSUE_1610: "y"
ESPURNA_PIO_SHARED_LIBRARIES: "y"
TEST_ENV: "esp8266-4m-latest-base"
TEST_EXTRA_ARGS: "-a test/build/extra/secure_client.h"
run: |
git config --global advice.detachedHead false
./ci_install.sh build
./ci_script.sh build
61 changes: 0 additions & 61 deletions .travis.yml

This file was deleted.

20 changes: 13 additions & 7 deletions travis_install.sh → ci_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,29 @@ npm_install() {
}

pio_install() {
pip install -U platformio
pip3 install -U platformio
pio upgrade --dev
pio platform update -p
}

cd code

if [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test Host" ]; then
case "$1" in
("host")
pio_install
elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test WebUI" ]; then
;;
("webui")
npm_install
elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test PlatformIO Build" ]; then
;;
("build")
pio_install
elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Release" ]; then
;;
("release")
npm_install
pio_install
else
;;
(*)
echo -e "\e[1;33mUnknown stage name, exiting!\e[0m"
exit 1
fi
;;
esac
18 changes: 12 additions & 6 deletions travis_script.sh → ci_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@ set -x -e -v

cd code

if [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test Host" ]; then
case "$1" in
("host")
cd test/ && pio test
elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test WebUI" ]; then
;;
("webui")
./build.sh -f environments
elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Test PlatformIO Build" ]; then
;;
("build")
# shellcheck disable=SC2086
scripts/test_build.py -e "$TEST_ENV" $TEST_EXTRA_ARGS
elif [ "${TRAVIS_BUILD_STAGE_NAME}" = "Release" ]; then
;;
("release")
./build.sh -r
else
;;
(*)
echo -e "\e[1;33mUnknown stage name, exiting!\e[0m"
exit 1
fi
;;
esac
5 changes: 3 additions & 2 deletions code/scripts/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def run_configurations(args, configurations):
cmd.extend(["-e", args.environment])

for cfg in configurations:
print(clr(Color.BOLD, "> Building {}".format(cfg)))
print(clr(Color.BOLD, "> Building {}".format(cfg)), flush=True)
with open(args.custom_h, "w") as custom_h:

def write(line):
Expand Down Expand Up @@ -100,7 +100,8 @@ def write(line):
).st_size,
datetime.timedelta(seconds=diff),
),
)
),
flush=True,
)


Expand Down

0 comments on commit f11468a

Please sign in to comment.