diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml new file mode 100644 index 00000000..99583c7e --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,33 @@ +name: cleanup caches by a branch +on: + pull_request: + types: + - closed + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Cleanup + run: | + gh extension install actions/gh-actions-cache + + REPO=${{ github.repository }} + BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" + + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index 331cc5a7..7ac79a8b 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -11,13 +11,7 @@ jobs: runs-on: ubuntu-latest container: image: alt:sisyphus - - env: - CC: ccache gcc - CCACHE_DIR: ${{ github.workspace }}/.ccache - CXX: ccache g++ - USE_CCACHE: 1 - + options: --privileged steps: - name: install packages run: | @@ -28,18 +22,17 @@ jobs: libmosquitto-devel \ libopen62541-devel libopen62541pp-devel \ libclickhouse-cpp-devel \ - xsltproc python3-dev python-module-distribute swig iputils + xsltproc python-base python3-dev swig python-devel \ + python-module-distribute swig iputils - - name: cache - uses: actions/cache@v2 - if: always() + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 with: - path: ${{ env.CCACHE_DIR }} - key: ${{ runner.os }}-ccache - restore-keys: | - ${{ runner.os }}-ccache + key: ${{ vars.GITHUB_REF_NAME }} - - uses: actions/checkout@v2 - name: configure run: | export CCACHE_ENABLE=yes @@ -53,6 +46,7 @@ jobs: run: | export GCC_USE_CCACHE=1 export ALLOW_ROOT_USER=1 + echo "%_topdir %homedir/RPM" >> ~/.rpmmacros jmake - name: testsuite run: |