diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 662a4c43..28778ea0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,8 +3,6 @@ name: Tests on: pull_request: push: - branches: - - master env: KONG_VERSION: master @@ -30,13 +28,28 @@ jobs: ref: ${{ env.KONG_VERSION }} path: kong + - name: Set the KONG_NGINX_MODULE_BRANCH in kong/.requirements + run: | + cd kong + branch="" + + if [ ${{ github.event_name }} == 'pull_request' ]; then + branch=${GITHUB_HEAD_REF} + else + branch=${GITHUB_REF} + fi + + branch=$(echo "$branch" | sed 's/\//\\\//g') + sed -i "s/KONG_NGINX_MODULE_BRANCH=.\+/KONG_NGINX_MODULE_BRANCH=${branch}/" .requirements + cat .requirements + - name: Lookup build cache id: cache-deps uses: actions/cache@v3 with: path: | ${{ env.BUILD_ROOT }} - key: ${{ hashFiles('src/**', 'lualib/**', '.github/workflows/tests.yml') }} + key: ${{ hashFiles('src/**', 'lualib/**', '.github/workflows/tests.yml', 'kong/.requirements') }} - name: Install packages if: steps.cache-deps.outputs.cache-hit != 'true' @@ -48,10 +61,6 @@ jobs: if: steps.cache-deps.outputs.cache-hit != 'true' run: | cd kong - branch=${GITHUB_HEAD_REF} - branch=$(echo "$branch" | sed 's/\//\\\//g') - sed -i "s/KONG_NGINX_MODULE_BRANCH=.\+/KONG_NGINX_MODULE_BRANCH=${branch}/" .requirements - cat .requirements make build-kong make build-venv BUILD_PREFIX=$BUILD_ROOT/kong-dev @@ -70,13 +79,35 @@ jobs: - name: Checkout source code uses: actions/checkout@v3 + - name: Checkout Kong source code + uses: actions/checkout@v3 + with: + repository: kong/kong + ref: ${{ env.KONG_VERSION }} + path: kong + + - name: Set the KONG_NGINX_MODULE_BRANCH in kong/.requirements + run: | + cd kong + branch="" + + if [ ${{ github.event_name }} == 'pull_request' ]; then + branch=${GITHUB_HEAD_REF} + else + branch=${GITHUB_REF} + fi + + branch=$(echo "$branch" | sed 's/\//\\\//g') + sed -i "s/KONG_NGINX_MODULE_BRANCH=.\+/KONG_NGINX_MODULE_BRANCH=${branch}/" .requirements + cat .requirements + - name: Load build cache id: cache-deps uses: actions/cache@v3 with: path: | ${{ env.BUILD_ROOT }} - key: ${{ hashFiles('src/**', 'lualib/**', '.github/workflows/tests.yml') }} + key: ${{ hashFiles('src/**', 'lualib/**', '.github/workflows/tests.yml', 'kong/.requirements') }} - name: Install packages run: |