1# Copyright (c) 2021, 2022 Nordic Semiconductor ASA 2# SPDX-License-Identifier: Apache-2.0 3 4# Make a snapshot of open bugs as a python pickle file, compressed 5# using xz. Upload the xz file to Amazon S3. 6 7name: Bug Snapshot 8 9on: 10 workflow_dispatch: 11 branches: [main] 12 schedule: 13 # Run daily at 14:05 14 - cron: '5 14 * * *' 15 16jobs: 17 make_bugs_pickle: 18 name: Make bugs pickle 19 runs-on: ubuntu-22.04 20 if: github.repository_owner == 'zephyrproject-rtos' 21 22 steps: 23 - name: Checkout 24 uses: actions/checkout@v3 25 26 - name: Install Python dependencies 27 run: | 28 sudo pip3 install -U setuptools wheel pip 29 pip3 install -U pygithub 30 31 - name: Snapshot bugs 32 env: 33 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 34 run: | 35 BUGS_PICKLE_FILENAME="zephyr-bugs-$(date -I).pickle.xz" 36 BUGS_PICKLE_PATH="${RUNNER_TEMP}/${BUGS_PICKLE_FILENAME}" 37 38 set -euo pipefail 39 python3 scripts/make_bugs_pickle.py | xz > ${BUGS_PICKLE_PATH} 40 41 echo "BUGS_PICKLE_FILENAME=${BUGS_PICKLE_FILENAME}" >> ${GITHUB_ENV} 42 echo "BUGS_PICKLE_PATH=${BUGS_PICKLE_PATH}" >> ${GITHUB_ENV} 43 44 - name: Configure AWS Credentials 45 uses: aws-actions/configure-aws-credentials@v2 46 with: 47 aws-access-key-id: ${{ vars.AWS_BUILDS_ZEPHYR_BUG_SNAPSHOT_ACCESS_KEY_ID }} 48 aws-secret-access-key: ${{ secrets.AWS_BUILDS_ZEPHYR_BUG_SNAPSHOT_SECRET_ACCESS_KEY }} 49 aws-region: us-east-1 50 51 - name: Upload to AWS S3 52 run: | 53 REPOSITORY_NAME="${GITHUB_REPOSITORY#*/}" 54 55 PUBLISH_BUCKET="builds.zephyrproject.org" 56 PUBLISH_DOMAIN="builds.zephyrproject.io" 57 if [ "${{github.event_name}}" = "schedule" ]; then 58 PUBLISH_ROOT="${REPOSITORY_NAME}/bug-snapshot/daily" 59 else 60 PUBLISH_ROOT="${REPOSITORY_NAME}/bug-snapshot" 61 fi 62 63 PUBLISH_UPLOAD_URI="s3://${PUBLISH_BUCKET}/${PUBLISH_ROOT}/${BUGS_PICKLE_FILENAME}" 64 PUBLISH_DOWNLOAD_URI="https://${PUBLISH_DOMAIN}/${PUBLISH_ROOT}/${BUGS_PICKLE_FILENAME}" 65 66 aws s3 cp --quiet ${BUGS_PICKLE_PATH} ${PUBLISH_UPLOAD_URI} 67 echo "Bug pickle is available at: ${PUBLISH_DOWNLOAD_URI}" >> ${GITHUB_STEP_SUMMARY} 68