From de84220222453d9b09c9a62bea7a83e68bee467b Mon Sep 17 00:00:00 2001 From: ADD-SP Date: Fri, 6 Oct 2023 16:05:56 +0800 Subject: [PATCH] chore(CI): fix broken deps --- .github/workflows/codecov.yml | 13 ++++++++++++- .github/workflows/test.yml | 15 ++++++++++++--- docker/Dockerfile.glibc | 10 +++++----- docker/Dockerfile.musl | 6 +++--- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 88b392d4..f4f12ca5 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 14f0c959..c9bd674d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,6 @@ name: test -on: - push: - branches: +on: pull_request: schedule: - cron: '0 0 * * SUN' @@ -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 @@ -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 @@ -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 }} diff --git a/docker/Dockerfile.glibc b/docker/Dockerfile.glibc index 9a16fc13..695a43c0 100644 --- a/docker/Dockerfile.glibc +++ b/docker/Dockerfile.glibc @@ -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 @@ -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 \ @@ -30,7 +30,7 @@ RUN set -xe \ libgd-dev \ libperl-dev \ libcurl4-openssl-dev \ - python3 \ + python3-full \ python3-pip \ libtool \ autoconf \ @@ -41,10 +41,10 @@ RUN set -xe \ libmodsecurity3 \ 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 --break-system-packages lastversion RUN set -xe \ && git clone -b v1.7.15 https://github.com/DaveGamble/cJSON.git ngx_waf/lib/cjson diff --git a/docker/Dockerfile.musl b/docker/Dockerfile.musl index 4ec0f405..944a05ac 100644 --- a/docker/Dockerfile.musl +++ b/docker/Dockerfile.musl @@ -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 @@ -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 \ @@ -46,7 +46,7 @@ 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