Skip to content

add folders for script arguments #17

add folders for script arguments

add folders for script arguments #17

name: 'Static code analysis'
on:
push:
workflow_dispatch:
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- name: Get cache
uses: actions/cache/restore@v4
with:
path: /media/saved-cache
key: docker-encoder-build-cache-${{ github.run_id }}
restore-keys: docker-encoder-build-cache
- name: Import cache
run: |
if (ls /media/saved-cache/*.tar.zst); then
docker run --pull always --rm \
--volume "/media/saved-cache:/media/saved-cache" \
--volume "docker-encoder-build-cache:/media/build-cache" \
--workdir /media \
madebytimo/scripts \
compress.sh --decompress /media/saved-cache/*.tar.zst
rm /media/saved-cache/*.tar.zst
fi
- name: Checkout
uses: actions/checkout@v4
- name: Download script
run: |
curl --silent --output /usr/local/bin/static-code-analysis.sh \
https://gitlab.com/madebyTimo/scripts-development/-/raw/main/scripts/\
static-code-analysis.sh \
&& chmod +x /usr/local/bin/static-code-analysis.sh
- name: Analyze
run: static-code-analysis.sh
env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Publish result
if: success() || failure()
run: cat test-results/*.txt >> $GITHUB_STEP_SUMMARY
- name: Export cache
run: |
docker run --pull always --rm \
--volume "/media/saved-cache:/media/saved-cache" \
--volume "docker-encoder-build-cache:/media/build-cache" \
madebytimo/scripts \
compress.sh --fast --output /media/saved-cache/build-cache /media/build-cache
sudo chown -R "$(whoami)" /media/saved-cache
- name: Delete old caches
env:
GH_TOKEN: ${{ github.token }}
run: |
for CACHE in $(gh cache list --key Factory-build-cache --ref ${{ github.ref}} \
| cut --fields 1); do
echo "Deleting cache \"$CACHE\"."
gh cache delete "$CACHE"
done
- name: Set cache
uses: actions/cache/save@v4
with:
path: /media/saved-cache
key: docker-encoder-build-cache-${{ github.run_id }}