2020-12-20 08:03:20 +00:00
|
|
|
name: test
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CFLAGS: -Werror
|
|
|
|
MAKEFLAGS: -j
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
# run tests
|
|
|
|
test:
|
2021-01-05 09:12:39 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2020-12-20 08:03:20 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
arch: [x86_64, thumb, mips, powerpc]
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: install
|
|
|
|
run: |
|
|
|
|
# need toml, also pip3 isn't installed by default?
|
2021-01-02 05:50:59 +00:00
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get install -qq python3 python3-pip lcov
|
2020-12-20 08:03:20 +00:00
|
|
|
sudo pip3 install toml
|
2021-01-03 21:38:48 +00:00
|
|
|
gcc --version
|
|
|
|
|
2021-01-04 03:14:49 +00:00
|
|
|
# setup a ram-backed disk to speed up reentrant tests
|
|
|
|
mkdir disks
|
|
|
|
sudo mount -t tmpfs -o size=100m tmpfs disks
|
|
|
|
TESTFLAGS="$TESTFLAGS --disk=disks/disk"
|
|
|
|
|
2021-01-03 21:38:48 +00:00
|
|
|
# collect coverage
|
|
|
|
mkdir -p coverage
|
2021-01-04 03:14:49 +00:00
|
|
|
TESTFLAGS="$TESTFLAGS --coverage=`
|
|
|
|
`coverage/${{github.job}}-${{matrix.arch}}.info"
|
|
|
|
|
|
|
|
echo "TESTFLAGS=$TESTFLAGS" >> $GITHUB_ENV
|
2021-01-03 21:38:48 +00:00
|
|
|
|
2020-12-20 08:03:20 +00:00
|
|
|
# cross-compile with ARM Thumb (32-bit, little-endian)
|
|
|
|
- name: install-thumb
|
2021-01-05 09:12:39 +00:00
|
|
|
if: ${{matrix.arch == 'thumb'}}
|
2020-12-20 08:03:20 +00:00
|
|
|
run: |
|
2021-01-02 05:50:59 +00:00
|
|
|
sudo apt-get install -qq \
|
2020-12-20 08:03:20 +00:00
|
|
|
gcc-arm-linux-gnueabi \
|
|
|
|
libc6-dev-armel-cross \
|
|
|
|
qemu-user
|
|
|
|
echo "CC=arm-linux-gnueabi-gcc -mthumb --static" >> $GITHUB_ENV
|
|
|
|
echo "EXEC=qemu-arm" >> $GITHUB_ENV
|
|
|
|
arm-linux-gnueabi-gcc --version
|
|
|
|
qemu-arm -version
|
|
|
|
# cross-compile with MIPS (32-bit, big-endian)
|
|
|
|
- name: install-mips
|
2021-01-05 09:12:39 +00:00
|
|
|
if: ${{matrix.arch == 'mips'}}
|
2020-12-20 08:03:20 +00:00
|
|
|
run: |
|
2021-01-02 05:50:59 +00:00
|
|
|
sudo apt-get install -qq \
|
2020-12-20 08:03:20 +00:00
|
|
|
gcc-mips-linux-gnu \
|
|
|
|
libc6-dev-mips-cross \
|
|
|
|
qemu-user
|
|
|
|
echo "CC=mips-linux-gnu-gcc --static" >> $GITHUB_ENV
|
|
|
|
echo "EXEC=qemu-mips" >> $GITHUB_ENV
|
|
|
|
mips-linux-gnu-gcc --version
|
|
|
|
qemu-mips -version
|
|
|
|
# cross-compile with PowerPC (32-bit, big-endian)
|
|
|
|
- name: install-powerpc
|
2021-01-05 09:12:39 +00:00
|
|
|
if: ${{matrix.arch == 'powerpc'}}
|
2020-12-20 08:03:20 +00:00
|
|
|
run: |
|
2021-01-02 05:50:59 +00:00
|
|
|
sudo apt-get install -qq \
|
2020-12-20 08:03:20 +00:00
|
|
|
gcc-powerpc-linux-gnu \
|
|
|
|
libc6-dev-powerpc-cross \
|
|
|
|
qemu-user
|
|
|
|
echo "CC=powerpc-linux-gnu-gcc --static" >> $GITHUB_ENV
|
|
|
|
echo "EXEC=qemu-ppc" >> $GITHUB_ENV
|
|
|
|
powerpc-linux-gnu-gcc --version
|
|
|
|
qemu-ppc -version
|
2021-01-03 21:38:48 +00:00
|
|
|
|
2020-12-20 08:03:20 +00:00
|
|
|
# make sure example can at least compile
|
|
|
|
- name: test-example
|
|
|
|
run: |
|
2021-01-05 09:12:39 +00:00
|
|
|
sed -n '/``` c/,/```/{/```/d; p}' README.md > test.c
|
2020-12-20 08:03:20 +00:00
|
|
|
make all CFLAGS+=" \
|
|
|
|
-Duser_provided_block_device_read=NULL \
|
|
|
|
-Duser_provided_block_device_prog=NULL \
|
|
|
|
-Duser_provided_block_device_erase=NULL \
|
|
|
|
-Duser_provided_block_device_sync=NULL \
|
|
|
|
-include stdio.h"
|
2021-01-05 09:12:39 +00:00
|
|
|
rm test.c
|
2021-01-03 21:38:48 +00:00
|
|
|
|
2021-01-05 09:12:39 +00:00
|
|
|
# test configurations
|
|
|
|
# normal+reentrant tests
|
|
|
|
- name: test-default
|
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make test TESTFLAGS+="-nrk"
|
|
|
|
# NOR flash: read/prog = 1 block = 4KiB
|
|
|
|
- name: test-nor
|
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make test TESTFLAGS+="-nrk \
|
|
|
|
-DLFS_READ_SIZE=1 -DLFS_BLOCK_SIZE=4096"
|
|
|
|
# SD/eMMC: read/prog = 512 block = 512
|
|
|
|
- name: test-emmc
|
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make test TESTFLAGS+="-nrk \
|
|
|
|
-DLFS_READ_SIZE=512 -DLFS_BLOCK_SIZE=512"
|
|
|
|
# NAND flash: read/prog = 4KiB block = 32KiB
|
|
|
|
- name: test-nand
|
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make test TESTFLAGS+="-nrk \
|
|
|
|
-DLFS_READ_SIZE=4096 -DLFS_BLOCK_SIZE=\(32*1024\)"
|
|
|
|
# other extreme geometries that are useful for various corner cases
|
|
|
|
- name: test-no-intrinsics
|
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make test TESTFLAGS+="-nrk \
|
|
|
|
-DLFS_NO_INTRINSICS"
|
|
|
|
- name: test-byte-writes
|
|
|
|
# it just takes too long to test byte-level writes when in qemu,
|
|
|
|
# should be plenty covered by the other configurations
|
|
|
|
if: ${{matrix.arch == 'x86_64'}}
|
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make test TESTFLAGS+="-nrk \
|
|
|
|
-DLFS_READ_SIZE=1 -DLFS_CACHE_SIZE=1"
|
|
|
|
- name: test-block-cycles
|
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make test TESTFLAGS+="-nrk \
|
|
|
|
-DLFS_BLOCK_CYCLES=1"
|
|
|
|
- name: test-odd-block-count
|
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make test TESTFLAGS+="-nrk \
|
|
|
|
-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD_SIZE=256"
|
|
|
|
- name: test-odd-block-size
|
|
|
|
run: |
|
|
|
|
make clean
|
|
|
|
make test TESTFLAGS+="-nrk \
|
|
|
|
-DLFS_READ_SIZE=11 -DLFS_BLOCK_SIZE=704"
|
2020-12-31 19:41:35 +00:00
|
|
|
|
2021-01-05 09:12:39 +00:00
|
|
|
# upload coverage for later coverage
|
2020-12-31 19:41:35 +00:00
|
|
|
- name: upload-coverage
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: coverage
|
|
|
|
path: coverage
|
2021-01-02 05:50:59 +00:00
|
|
|
retention-days: 1
|
2020-12-31 19:41:35 +00:00
|
|
|
|
2020-12-20 08:03:20 +00:00
|
|
|
# update results
|
|
|
|
- name: results-code
|
|
|
|
run: |
|
2021-01-02 05:50:59 +00:00
|
|
|
mkdir -p results
|
|
|
|
make clean
|
|
|
|
make code \
|
|
|
|
CFLAGS+=" \
|
|
|
|
-DLFS_NO_ASSERT \
|
|
|
|
-DLFS_NO_DEBUG \
|
|
|
|
-DLFS_NO_WARN \
|
|
|
|
-DLFS_NO_ERROR" \
|
2021-01-04 03:14:49 +00:00
|
|
|
CODEFLAGS+="-o results/code-${{matrix.arch}}.csv"
|
2020-12-20 08:03:20 +00:00
|
|
|
- name: results-code-readonly
|
|
|
|
run: |
|
2021-01-02 05:50:59 +00:00
|
|
|
mkdir -p results
|
|
|
|
make clean
|
|
|
|
make code \
|
|
|
|
CFLAGS+=" \
|
|
|
|
-DLFS_NO_ASSERT \
|
|
|
|
-DLFS_NO_DEBUG \
|
|
|
|
-DLFS_NO_WARN \
|
|
|
|
-DLFS_NO_ERROR \
|
|
|
|
-DLFS_READONLY" \
|
2021-01-04 03:14:49 +00:00
|
|
|
CODEFLAGS+="-o results/code-${{matrix.arch}}-readonly.csv"
|
2020-12-20 08:03:20 +00:00
|
|
|
- name: results-code-threadsafe
|
|
|
|
run: |
|
2021-01-02 05:50:59 +00:00
|
|
|
mkdir -p results
|
|
|
|
make clean
|
|
|
|
make code \
|
|
|
|
CFLAGS+=" \
|
|
|
|
-DLFS_NO_ASSERT \
|
|
|
|
-DLFS_NO_DEBUG \
|
|
|
|
-DLFS_NO_WARN \
|
|
|
|
-DLFS_NO_ERROR \
|
|
|
|
-DLFS_THREADSAFE" \
|
2021-01-04 03:14:49 +00:00
|
|
|
CODEFLAGS+="-o results/code-${{matrix.arch}}-threadsafe.csv"
|
2020-12-20 08:03:20 +00:00
|
|
|
- name: results-code-migrate
|
|
|
|
run: |
|
2021-01-02 05:50:59 +00:00
|
|
|
mkdir -p results
|
|
|
|
make clean
|
|
|
|
make code \
|
|
|
|
CFLAGS+=" \
|
|
|
|
-DLFS_NO_ASSERT \
|
|
|
|
-DLFS_NO_DEBUG \
|
|
|
|
-DLFS_NO_WARN \
|
|
|
|
-DLFS_NO_ERROR \
|
|
|
|
-DLFS_MIGRATE" \
|
2021-01-04 03:14:49 +00:00
|
|
|
CODEFLAGS+="-o results/code-${{matrix.arch}}-migrate.csv"
|
2021-01-18 18:23:25 +00:00
|
|
|
- name: results-code-error-asserts
|
|
|
|
run: |
|
|
|
|
mkdir -p results
|
|
|
|
make clean
|
|
|
|
make code \
|
|
|
|
CFLAGS+=" \
|
|
|
|
-DLFS_NO_DEBUG \
|
|
|
|
-DLFS_NO_WARN \
|
|
|
|
-DLFS_NO_ERROR \
|
|
|
|
-D'LFS_ASSERT(test)=do {if(!(test)) {return -1;}} while(0)'" \
|
|
|
|
CODEFLAGS+="-o results/code-${{matrix.arch}}-error-asserts.csv"
|
2021-01-02 05:50:59 +00:00
|
|
|
- name: upload-results
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: results
|
|
|
|
path: results
|
2020-12-20 08:03:20 +00:00
|
|
|
# limit reporting to Thumb, otherwise there would be too many numbers
|
|
|
|
# flying around for the results to be easily readable
|
|
|
|
- name: collect-status
|
2021-01-05 09:12:39 +00:00
|
|
|
if: ${{matrix.arch == 'thumb'}}
|
2020-12-20 08:03:20 +00:00
|
|
|
run: |
|
|
|
|
mkdir -p status
|
2021-01-05 09:12:39 +00:00
|
|
|
for f in $(shopt -s nullglob ; echo results/code*.csv)
|
2020-12-20 08:03:20 +00:00
|
|
|
do
|
2021-01-04 03:14:49 +00:00
|
|
|
export STEP="results-code$(
|
|
|
|
echo $f | sed -n 's/.*code-.*-\(.*\).csv/-\1/p')"
|
|
|
|
export CONTEXT="results / code$(
|
|
|
|
echo $f | sed -n 's/.*code-.*-\(.*\).csv/ (\1)/p')"
|
|
|
|
export PREV="$(curl -sS \
|
|
|
|
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/status/master" \
|
2021-01-05 09:12:39 +00:00
|
|
|
| jq -re 'select(.sha != env.GITHUB_SHA) | .statuses[]
|
2021-01-04 03:14:49 +00:00
|
|
|
| select(.context == env.CONTEXT).description
|
2021-01-05 09:12:39 +00:00
|
|
|
| capture("Code size is (?<result>[0-9]+)").result' \
|
2021-01-04 03:14:49 +00:00
|
|
|
|| echo 0)"
|
|
|
|
export DESCRIPTION="$(./scripts/code.py -u $f -s | awk '
|
|
|
|
NR==2 {printf "Code size is %d B",$2}
|
2021-01-05 09:12:39 +00:00
|
|
|
NR==2 && ENVIRON["PREV"]+0 != 0 {
|
|
|
|
printf " (%+.1f%%)",100*($2-ENVIRON["PREV"])/ENVIRON["PREV"]}')"
|
2021-01-04 03:14:49 +00:00
|
|
|
jq -n '{
|
|
|
|
state: "success",
|
|
|
|
context: env.CONTEXT,
|
|
|
|
description: env.DESCRIPTION,
|
|
|
|
target_job: "${{github.job}} (${{matrix.arch}})",
|
|
|
|
target_step: env.STEP}' \
|
|
|
|
| tee status/code$(
|
|
|
|
echo $f | sed -n 's/.*code-.*-\(.*\).csv/-\1/p').json
|
2020-12-20 08:03:20 +00:00
|
|
|
done
|
|
|
|
- name: upload-status
|
2021-01-05 09:12:39 +00:00
|
|
|
if: ${{matrix.arch == 'thumb'}}
|
2020-12-20 08:03:20 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: status
|
|
|
|
path: status
|
|
|
|
retention-days: 1
|
|
|
|
|
|
|
|
# run under Valgrind to check for memory errors
|
|
|
|
valgrind:
|
2021-01-05 09:12:39 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2020-12-20 08:03:20 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: install
|
|
|
|
run: |
|
|
|
|
# need toml, also pip3 isn't installed by default?
|
2021-01-02 05:50:59 +00:00
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get install -qq python3 python3-pip
|
2020-12-20 08:03:20 +00:00
|
|
|
sudo pip3 install toml
|
|
|
|
- name: install-valgrind
|
|
|
|
run: |
|
2021-01-02 05:50:59 +00:00
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get install -qq valgrind
|
2020-12-20 08:03:20 +00:00
|
|
|
valgrind --version
|
2021-01-05 09:12:39 +00:00
|
|
|
# normal tests, we don't need to test all geometries
|
|
|
|
- name: test-valgrind
|
|
|
|
run: make test TESTFLAGS+="-k --valgrind"
|
2021-01-02 05:50:59 +00:00
|
|
|
|
|
|
|
# self-host with littlefs-fuse for a fuzz-like test
|
|
|
|
fuse:
|
2021-01-05 09:12:39 +00:00
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
if: ${{!endsWith(github.ref, '-prefix')}}
|
2021-01-02 05:50:59 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: install
|
|
|
|
run: |
|
|
|
|
# need toml, also pip3 isn't installed by default?
|
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get install -qq python3 python3-pip libfuse-dev
|
|
|
|
sudo pip3 install toml
|
|
|
|
fusermount -V
|
|
|
|
gcc --version
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: littlefs-project/littlefs-fuse
|
|
|
|
ref: v2
|
|
|
|
path: littlefs-fuse
|
|
|
|
- name: setup
|
|
|
|
run: |
|
|
|
|
# copy our new version into littlefs-fuse
|
|
|
|
rm -rf littlefs-fuse/littlefs/*
|
|
|
|
cp -r $(git ls-tree --name-only HEAD) littlefs-fuse/littlefs
|
|
|
|
|
|
|
|
# setup disk for littlefs-fuse
|
|
|
|
mkdir mount
|
|
|
|
sudo chmod a+rw /dev/loop0
|
|
|
|
dd if=/dev/zero bs=512 count=128K of=disk
|
|
|
|
losetup /dev/loop0 disk
|
|
|
|
- name: test
|
|
|
|
run: |
|
|
|
|
# self-host test
|
|
|
|
make -C littlefs-fuse
|
|
|
|
|
|
|
|
littlefs-fuse/lfs --format /dev/loop0
|
|
|
|
littlefs-fuse/lfs /dev/loop0 mount
|
|
|
|
|
|
|
|
ls mount
|
|
|
|
mkdir mount/littlefs
|
|
|
|
cp -r $(git ls-tree --name-only HEAD) mount/littlefs
|
|
|
|
cd mount/littlefs
|
|
|
|
stat .
|
|
|
|
ls -flh
|
|
|
|
make -B test
|
|
|
|
|
|
|
|
# test migration using littlefs-fuse
|
|
|
|
migrate:
|
2021-01-05 09:12:39 +00:00
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
if: ${{!endsWith(github.ref, '-prefix')}}
|
2021-01-02 05:50:59 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: install
|
|
|
|
run: |
|
|
|
|
# need toml, also pip3 isn't installed by default?
|
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get install -qq python3 python3-pip libfuse-dev
|
|
|
|
sudo pip3 install toml
|
|
|
|
fusermount -V
|
|
|
|
gcc --version
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: littlefs-project/littlefs-fuse
|
|
|
|
ref: v2
|
|
|
|
path: v2
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: littlefs-project/littlefs-fuse
|
|
|
|
ref: v1
|
|
|
|
path: v1
|
|
|
|
- name: setup
|
|
|
|
run: |
|
|
|
|
# copy our new version into littlefs-fuse
|
|
|
|
rm -rf v2/littlefs/*
|
|
|
|
cp -r $(git ls-tree --name-only HEAD) v2/littlefs
|
|
|
|
|
|
|
|
# setup disk for littlefs-fuse
|
|
|
|
mkdir mount
|
|
|
|
sudo chmod a+rw /dev/loop0
|
|
|
|
dd if=/dev/zero bs=512 count=128K of=disk
|
|
|
|
losetup /dev/loop0 disk
|
|
|
|
- name: test
|
|
|
|
run: |
|
|
|
|
# compile v1 and v2
|
|
|
|
make -C v1
|
|
|
|
make -C v2
|
|
|
|
|
|
|
|
# run self-host test with v1
|
|
|
|
v1/lfs --format /dev/loop0
|
|
|
|
v1/lfs /dev/loop0 mount
|
|
|
|
|
|
|
|
ls mount
|
|
|
|
mkdir mount/littlefs
|
|
|
|
cp -r $(git ls-tree --name-only HEAD) mount/littlefs
|
|
|
|
cd mount/littlefs
|
|
|
|
stat .
|
|
|
|
ls -flh
|
|
|
|
make -B test
|
|
|
|
|
|
|
|
# attempt to migrate
|
|
|
|
cd ../..
|
|
|
|
fusermount -u mount
|
|
|
|
|
|
|
|
v2/lfs --migrate /dev/loop0
|
|
|
|
v2/lfs /dev/loop0 mount
|
|
|
|
|
|
|
|
# run self-host test with v2 right where we left off
|
|
|
|
ls mount
|
|
|
|
cd mount/littlefs
|
|
|
|
stat .
|
|
|
|
ls -flh
|
|
|
|
make -B test
|
|
|
|
|
|
|
|
# collect coverage info
|
|
|
|
coverage:
|
2021-01-05 09:12:39 +00:00
|
|
|
runs-on: ubuntu-18.04
|
2021-01-02 05:50:59 +00:00
|
|
|
needs: [test]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: install
|
|
|
|
run: |
|
|
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get install -qq python3 python3-pip lcov
|
|
|
|
sudo pip3 install toml
|
2021-01-05 09:12:39 +00:00
|
|
|
# yes we continue-on-error nearly every step, continue-on-error
|
2021-01-04 03:14:49 +00:00
|
|
|
# at job level apparently still marks a job as failed, which isn't
|
|
|
|
# what we want
|
2021-01-02 05:50:59 +00:00
|
|
|
- uses: actions/download-artifact@v2
|
2021-01-04 03:14:49 +00:00
|
|
|
continue-on-error: true
|
2021-01-02 05:50:59 +00:00
|
|
|
with:
|
|
|
|
name: coverage
|
|
|
|
path: coverage
|
|
|
|
- name: results-coverage
|
2021-01-04 03:14:49 +00:00
|
|
|
continue-on-error: true
|
2021-01-02 05:50:59 +00:00
|
|
|
run: |
|
|
|
|
mkdir -p results
|
|
|
|
lcov $(for f in coverage/*.info ; do echo "-a $f" ; done) \
|
|
|
|
-o results/coverage.info
|
|
|
|
./scripts/coverage.py results/coverage.info -o results/coverage.csv
|
|
|
|
- name: upload-results
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: results
|
|
|
|
path: results
|
|
|
|
- name: collect-status
|
|
|
|
run: |
|
|
|
|
mkdir -p status
|
2021-01-04 03:14:49 +00:00
|
|
|
[ -e results/coverage.csv ] || exit 0
|
2021-01-02 05:50:59 +00:00
|
|
|
export STEP="results-coverage"
|
|
|
|
export CONTEXT="results / coverage"
|
|
|
|
export PREV="$(curl -sS \
|
|
|
|
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/status/master" \
|
2021-01-05 09:12:39 +00:00
|
|
|
| jq -re 'select(.sha != env.GITHUB_SHA) | .statuses[]
|
2021-01-02 05:50:59 +00:00
|
|
|
| select(.context == env.CONTEXT).description
|
2021-01-05 09:12:39 +00:00
|
|
|
| capture("Coverage is (?<result>[0-9\\.]+)").result' \
|
2021-01-02 05:50:59 +00:00
|
|
|
|| echo 0)"
|
|
|
|
export DESCRIPTION="$(
|
2021-01-05 09:12:39 +00:00
|
|
|
./scripts/coverage.py -u results/coverage.csv -s | awk -F '[ /%]+' '
|
2021-01-02 05:50:59 +00:00
|
|
|
NR==2 {printf "Coverage is %.1f%% of %d lines",$4,$3}
|
2021-01-05 09:12:39 +00:00
|
|
|
NR==2 && ENVIRON["PREV"]+0 != 0 {
|
2021-01-02 05:50:59 +00:00
|
|
|
printf " (%+.1f%%)",$4-ENVIRON["PREV"]}')"
|
|
|
|
jq -n '{
|
|
|
|
state: "success",
|
|
|
|
context: env.CONTEXT,
|
|
|
|
description: env.DESCRIPTION,
|
|
|
|
target_job: "${{github.job}}",
|
|
|
|
target_step: env.STEP}' \
|
|
|
|
| tee status/coverage.json
|
|
|
|
- name: upload-status
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: status
|
|
|
|
path: status
|
|
|
|
retention-days: 1
|