chore: build deps using Bazel #249
Workflow file for this run
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: codecov | |
on: [pull_request] | |
defaults: | |
run: | |
shell: bash | |
# cancel previous runs if new commits are pushed to the PR, but run for each commit on master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
codecov: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
architecture: 'x64' | |
- name: Install dependencies | |
run: | | |
sudo apt-get --yes update | |
# https://github.com/actions/runner-images/issues/2139 | |
sudo apt-get remove \ | |
libgd3 \ | |
nginx-core \ | |
nginx-full \ | |
nginx-light \ | |
nginx-extras | |
sudo apt-get install --yes \ | |
build-essential \ | |
zlib1g-dev \ | |
libpcre3 \ | |
libpcre3-dev \ | |
libssl-dev \ | |
libxslt1-dev \ | |
libxml2-dev \ | |
libgeoip-dev \ | |
libgd-dev \ | |
libperl-dev \ | |
flex \ | |
bison \ | |
autoconf \ | |
libtool \ | |
automake \ | |
gcovr | |
sudo pip install lastversion | |
- name: Download nginx | |
run: | | |
lastversion download nginx:stable | |
mkdir nginx-src | |
tar zxf nginx-*.tar.gz --directory nginx-src --strip-components=1 | |
- name: Configure | |
run: | | |
make parser | |
bazel build --config release //:dependencies --verbose_failures | |
pushd bazel-bin | |
tar -zxf ngx_waf_deps.tar.gz | |
export LIB_INJECTION=$(realpath ngx_waf_deps)/libinjection | |
export LIB_SODIUM=$(realpath ngx_waf_deps)/libsodium | |
export LIB_UTHASH=$(realpath ngx_waf_deps)/uthash | |
popd | |
cd nginx-src | |
./configure --add-module=.. --with-cc-opt='-Wno-unused-but-set-variable -Wno-unused-function -fstack-protector-strong -Wno-sign-compare' --with-http_realip_module | |
- name: Install nginx | |
run: | | |
cd nginx-src | |
make -j$(nproc) | |
sudo make install | |
sudo useradd nginx -s /sbin/nologin -M | |
sudo chmod 777 -R /usr/local/nginx | |
sudo ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx | |
- name: Install Test::Nginx | |
run: | | |
sudo cpan Test::Nginx | |
- name: Test | |
run: | | |
sudo chmod 777 -R /tmp | |
cd test/test-nginx | |
export MODULE_TEST_PATH=/tmp/module_test | |
sh ./init.sh | |
exec sudo sh start.sh t/*.t | |
- name: Generate coverage report | |
run: | | |
gcovr -v -r ${{ github.workspace }}/src/ --xml --xml-pretty -o ./coverage.xml nginx-src/objs/addon/src/ | |
cat ./coverage.xml | |
sudo chmod -R 777 ${{ github.workspace }} | |
- name: Run codacy-coverage-reporter | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: ${{ github.workspace }}/coverage.xml |