update for CI #488
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit test | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
env: | ||
UBUNTU_RUNNER: ubuntu-latest | ||
MACOS_RUNNER: macos-14 | ||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
os: [${{ env.UBUNTU_RUNNER }}, ${{ env.MACOS_RUNNER }}] | ||
system: [client, server] | ||
exclude: | ||
- os: macos-14 | ||
system: server | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
OS: ${{ matrix.os }} | ||
SYSTEM: ${{ matrix.system }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install tools | ||
run: | | ||
if [ "${OS}" == "${{ env.MACOS_RUNNER }}" ]; then | ||
brew install bats-core kcov parallel | ||
elif [ "${OS}" == "${{ env.UBUNTU_RUNNER }}" ]; then | ||
sudo apt-get install -y bats parallel | ||
bash ./install/ubuntu/common/kcov.sh | ||
else | ||
echo "${OS} and ${SYSTEM} are not supported" >&2 | ||
exit 1 | ||
fi | ||
- name: Run unit test | ||
run: | | ||
./scripts/run_unit_test.sh | ||
- name: Setup for codecov | ||
run: | | ||
if [ "${OS}" == "${{ env.MACOS_RUNNER }}" ]; then | ||
echo "flags=${OS}" >> $GITHUB_ENV | ||
brew install gpg jq curl | ||
elif [ "${OS}" == "${{ env.UBUNTU_RUNNER }}" ]; then | ||
echo "flags=${OS}-${SYSTEM}" >> $GITHUB_ENV | ||
sudo apt-get install -y gpg jq curl | ||
else | ||
echo "${OS} and ${SYSTEM} are not supported" >&2 | ||
exit 1 | ||
fi | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v5 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
with: | ||
# directory: ./coverage/kcov-merged | ||
files: ./coverage/kcov-merged/cobertura.xml | ||
env_vars: OS,SYSTEM | ||
fail_ci_if_error: true | ||
flags: ${{ env.flags }} | ||
name: codecov-dotfiles | ||
verbose: true | ||
# run: | | ||
# bash <(curl -s https://codecov.io/bash) \ | ||
# -n "codecov-dotfiles" `# Custom defined name of the upload. Visible in Codecov UI.` \ | ||
# -s ./coverage/kcov-merged `# Directory to search for coverage reports.` \ | ||
# -t ${{ secrets.CODECOV_TOKEN }} `# Set the private repository token.` \ | ||
# -e OS,SYSTEM `# Specify environment variables to be included with this build.` \ | ||
# -C ${{ github.sha }} `# Specify the commit sha.` \ | ||
# -F ${{ env.flags }} `# Flag the upload to group coverage metrics.` \ | ||
# -Z `# Exit with 1 if not successful. Default will Exit with 0.` \ | ||
# -v `# Verbose mode.` |