Skip to content

Commit

Permalink
test new tidy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
qdrvm-ci committed Aug 21, 2024
1 parent 1b89aa3 commit 676b4e5
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,62 @@ jobs:
BUILD_TYPE: "${{ matrix.options.build-type }}"
run: ./housekeeping/docker/kagome-dev/make.sh

kagome_dev_docker_build_tidy:
runs-on: ubuntu-latest
timeout-minutes: 180
name: "Linux: clang-tidy GCE"

steps:
- name: "Checkout repository"
uses: actions/checkout@v4

- name: "Authenticate with Google Cloud"
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}

- name: "Set up Cloud SDK"
uses: 'google-github-actions/setup-gcloud@v2'

- name: "Configure Docker for GCR"
run: |
gcloud auth configure-docker --quiet
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet
- name: "Check version"
working-directory: ./housekeeping/docker/kagome-dev
run: |
SHORT_COMMIT_HASH=$(grep 'short_commit_hash:' commit_hash.txt | cut -d ' ' -f 2)
echo "short_commit_hash=${SHORT_COMMIT_HASH}" >> $GITHUB_ENV
- name: "Cache dependencies"
id: cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ env.CACHE_PATH }}
key: ${{ github.job }}-${{ env.CACHE_VERSION }}-tidy-${{ env.short_commit_hash }}
restore-keys: |
${{ github.job }}-${{ env.CACHE_VERSION }}-tidy-
- name: "Build target"
working-directory: ./housekeeping/docker/kagome-dev
run: make kagome_dev_docker_build_tidy \
DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH} \
GITHUB_HUNTER_USERNAME=${{ secrets.HUNTER_USERNAME }} \
GITHUB_HUNTER_TOKEN=${{ secrets.HUNTER_TOKEN }}

- name: "Cleaning cache"
run: |
find ${{ env.CACHE_PATH }} -name '*.pdf' -exec rm {} \;
- name: "Always Save Cache"
id: cache-save
if: always() && (steps.cache-restore.outputs.cache-hit != 'true' || env.package_exist != 'True')
uses: actions/cache/save@v4
with:
path: ${{ env.CACHE_PATH }}
key: ${{ steps.cache-restore.outputs.cache-primary-key }}

kagome_dev_docker_build:
runs-on: [ actions-runner-controller ]
timeout-minutes: 180
Expand Down
48 changes: 48 additions & 0 deletions housekeeping/docker/kagome-dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,54 @@ kagome_dev_docker_build:
fi; \
docker stop $$CONTAINER_NAME

kagome_dev_docker_build_tidy:
$(MAKE) get_versions
mkdir -p \
$(CACHE_DIR)/.cargo/git \
$(CACHE_DIR)/.cargo/registry \
$(CACHE_DIR)/.hunter \
$(CACHE_DIR)/.cache/ccache ; \
CONTAINER_NAME=kagome_dev_build_$$(openssl rand -hex 6); \
SHORT_COMMIT_HASH=$$(grep 'short_commit_hash:' commit_hash.txt | cut -d ' ' -f 2); \
BUILD_THREADS=$$(nproc 2>/dev/null || sysctl -n hw.ncpu); \
DOCKER_EXEC_RESULT=0 ; \
echo "Build type: $(BUILD_TYPE)"; \
docker run -d --name $$CONTAINER_NAME \
--platform $(PLATFORM) \
--entrypoint "/bin/bash" \
-e SHORT_COMMIT_HASH=$$SHORT_COMMIT_HASH \
-e BUILD_TYPE=$(BUILD_TYPE) \
-e BUILD_THREADS=$$BUILD_THREADS \
-e PACKAGE_ARCHITECTURE=$(PACKAGE_ARCHITECTURE) \
-e GITHUB_HUNTER_USERNAME=$(GITHUB_HUNTER_USERNAME) \
-e GITHUB_HUNTER_TOKEN=$(GITHUB_HUNTER_TOKEN) \
-e CTEST_OUTPUT_ON_FAILURE=$(CTEST_OUTPUT_ON_FAILURE) \
-v $$(pwd)/../../../../kagome:/opt/kagome \
-v $(GOOGLE_APPLICATION_CREDENTIALS):/root/.gcp/google_creds.json \
-v $(CACHE_DIR)/.cargo/git:/root/.cargo/git \
-v $(CACHE_DIR)/.cargo/registry:/root/.cargo/registry \
-v $(CACHE_DIR)/.hunter:/root/.hunter \
-v $(CACHE_DIR)/.cache/ccache:/root/.cache/ccache \
$(DOCKER_REGISTRY_PATH)kagome_builder_deb:$(MINIDEB_TAG) \
-c "tail -f /dev/null"; \
docker exec -t $$CONTAINER_NAME /bin/bash -c \
"cd /opt/kagome && \
git config --global --add safe.directory /opt/kagome && \
git config --global --add safe.directory /root/.hunter/_Base/Cache/meta && \
source /venv/bin/activate && \
git submodule update --init && \
echo \"Building in $$(pwd)\" && \
cmake . -B\"$(BUILD_DIR)\" -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=\"$(BUILD_TYPE)\" -DBACKWARD=OFF -DWERROR=$(WERROR) && \
cmake --build \"$(BUILD_DIR)\" --target generated -- -j${BUILD_THREADS} && \
cd /opt/kagome/ && ./housekeeping/clang-tidy-diff.sh \
" || DOCKER_EXEC_RESULT=$$? ; \
if [ $$DOCKER_EXEC_RESULT -ne 0 ]; then \
echo "Error: Docker exec failed with return code $$DOCKER_EXEC_RESULT"; \
docker stop $$CONTAINER_NAME; \
exit $$DOCKER_EXEC_RESULT; \
fi; \
docker stop $$CONTAINER_NAME

upload_apt_package:
SHORT_COMMIT_HASH=$$(grep 'short_commit_hash:' commit_hash.txt | cut -d ' ' -f 2); \
gcloud config set artifacts/repository $(ARTIFACTS_REPO); \
Expand Down

0 comments on commit 676b4e5

Please sign in to comment.