Skip to content

Commit

Permalink
chore(CI): fix broken CI (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
ADD-SP authored Oct 6, 2023
1 parent 02dc08c commit c1ad682
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 34 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: codecov

on: [push]
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:
build_deps:
name: Build dependencies
Expand All @@ -19,7 +24,7 @@ jobs:
run: |
echo "CACHE_ROOT=$HOME/cache-root" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

Expand All @@ -45,6 +50,9 @@ jobs:
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
sudo apt-get --yes update
# https://github.com/actions/runner-images/issues/2139
sudo apt-get remove nginx-core nginx-full nginx-light nginx-extras
sudo apt-get remove libgd3
sudo apt-get install --yes libsodium23 libsodium-dev build-essential zlib1g-dev libpcre3 libpcre3-dev libssl-dev libxslt1-dev libxml2-dev libgeoip-dev libgd-dev libperl-dev libcurl4-openssl-dev
- name: Download and install ModSecurity
Expand Down Expand Up @@ -83,7 +91,7 @@ jobs:
python-version: '3.x'
architecture: 'x64'

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

Expand Down Expand Up @@ -111,6 +119,9 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get --yes update
# https://github.com/actions/runner-images/issues/2139
sudo apt-get remove nginx-core nginx-full nginx-light nginx-extras
sudo apt-get remove libgd3
sudo apt-get install --yes libsodium23 libsodium-dev build-essential zlib1g-dev libpcre3 libpcre3-dev libssl-dev libxslt1-dev libxml2-dev libgeoip-dev libgd-dev libperl-dev libcurl4-openssl-dev gcovr
- name: Download nginx
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:
matrix:
target: ['glibc', 'musl']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand Down Expand Up @@ -67,13 +67,13 @@ jobs:
matrix:
target: ['glibc', 'musl']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand Down Expand Up @@ -109,13 +109,13 @@ jobs:
matrix:
target: ['glibc', 'musl']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand Down Expand Up @@ -151,13 +151,13 @@ jobs:
matrix:
target: ['glibc', 'musl']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand Down
27 changes: 18 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: test

on:
push:
branches:
on:
pull_request:
schedule:
- cron: '0 0 * * SUN'
Expand All @@ -13,6 +11,11 @@ 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:
self-trigger:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -43,7 +46,7 @@ jobs:
run: |
echo "CACHE_ROOT=$HOME/cache-root" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

Expand All @@ -69,6 +72,9 @@ jobs:
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
sudo apt-get --yes update
# https://github.com/actions/runner-images/issues/2139
sudo apt-get remove nginx-core nginx-full nginx-light nginx-extras
sudo apt-get remove libgd3
sudo apt-get install --yes libsodium23 libsodium-dev build-essential zlib1g-dev libpcre3 libpcre3-dev libssl-dev libxslt1-dev libxml2-dev libgeoip-dev libgd-dev libperl-dev libcurl4-openssl-dev
- name: Download and install ModSecurity
Expand Down Expand Up @@ -115,7 +121,7 @@ jobs:
python-version: '3.x'
architecture: 'x64'

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

Expand Down Expand Up @@ -143,6 +149,9 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get --yes update
# https://github.com/actions/runner-images/issues/2139
sudo apt-get remove nginx-core nginx-full nginx-light nginx-extras
sudo apt-get remove libgd3
sudo apt-get install --yes libsodium23 libsodium-dev build-essential zlib1g-dev libpcre3 libpcre3-dev libssl-dev libxslt1-dev libxml2-dev libgeoip-dev libgd-dev libperl-dev libcurl4-openssl-dev
- name: Download nginx-${{ matrix.nginx-version }}
Expand Down Expand Up @@ -222,21 +231,21 @@ jobs:
version: ['stable', 'mainline']
target: ['glibc', 'musl']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Build module
run: docker build --file docker/Dockerfile.${{ matrix.target }} --build-arg=NGX_VER=${{ matrix.version }} .
triger:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (github.ref == 'refs/heads/lts' || github.ref == 'refs/heads/current')) }}
needs: ['native', 'docker']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-python@v2
Expand Down
12 changes: 6 additions & 6 deletions docker/Dockerfile.glibc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG NGX_VER=stable
FROM nginx:${NGX_VER} as base
ARG CHANGE_SOURCE=false
ARG CN_MIRROR=false
ARG NGX_VER=stable
ARG LIB_SODIUM_VER=1.0.18-RELEASE

Expand All @@ -9,7 +9,7 @@ COPY . ./ngx_waf

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -xe \
&& if [ ${CHANGE_SOURCE} == true ] ; then \
&& if [ ${CN_MIRROR} == true ] ; then \
cp ./ngx_waf/docker/sources.list /etc/apt/sources.list ; \
apt-get clean all ; \
fi \
Expand All @@ -30,7 +30,7 @@ RUN set -xe \
libgd-dev \
libperl-dev \
libcurl4-openssl-dev \
python3 \
python3-full \
python3-pip \
libtool \
autoconf \
Expand All @@ -41,10 +41,10 @@ RUN set -xe \
libmodsecurity3 \
flex \
bison \
&& if [ ${CHANGE_SOURCE} == true ] ; then \
pip3 config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple ; \
&& if [ ${CN_MIRROR} == true ] ; then \
pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple ; \
fi \
&& pip3 install lastversion
&& pip3 install lastversion || pip3 install lastversion --break-system-packages

RUN set -xe \
&& git clone -b v1.7.15 https://github.com/DaveGamble/cJSON.git ngx_waf/lib/cjson
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM owasp/modsecurity:3.0.5-alpine AS modsecurity

ARG NGX_VER=stable
FROM nginx:${NGX_VER}-alpine as base
ARG CHANGE_SOURCE=false
ARG CN_MIRROR=false
ARG NGX_VER=stable
ARG LIB_SODIUM_VER=1.0.18-RELEASE
ARG MODSEC_VERSION=v3.0.5
Expand All @@ -17,7 +17,7 @@ COPY --from=modsecurity /usr/local/modsecurity/ /usr/local/modsecurity/

SHELL ["/bin/sh", "-o", "pipefail", "-c"]
RUN set -xe \
&& if [ ${CHANGE_SOURCE} = true ]; then \
&& if [ ${CN_MIRROR} = true ]; then \
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories ; \
fi \
&& apk update \
Expand Down Expand Up @@ -46,10 +46,10 @@ RUN set -xe \
libmaxminddb \
flex \
bison \
&& if [ ${CHANGE_SOURCE} = true ]; then \
&& if [ ${CN_MIRROR} = true ]; then \
pip3 config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple ; \
fi \
&& pip3 install lastversion
&& pip3 install lastversion || pip3 install lastversion --break-system-packages

RUN set -xe \
&& git clone https://github.com/DaveGamble/cJSON.git --branch ${CJSON_VERSION} ngx_waf/lib/cjson
Expand Down

0 comments on commit c1ad682

Please sign in to comment.