1name: Footprint Tracking
2
3# Run every 12 hours and on tags
4on:
5  schedule:
6    - cron: '50 1/12 * * *'
7  push:
8    paths:
9      - 'VERSION'
10      - '.github/workflows/footprint-tracking.yml'
11    branches:
12      - main
13      - v*-branch
14    tags:
15      # only publish v* tags, do not care about zephyr-v* which point to the
16      # same commit
17      - 'v*'
18
19concurrency:
20  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
21  cancel-in-progress: true
22
23jobs:
24  footprint-tracking:
25    runs-on: ubuntu-22.04
26    if: github.repository_owner == 'zephyrproject-rtos'
27    container:
28      image: ghcr.io/zephyrproject-rtos/ci:v0.26.4
29      options: '--entrypoint /bin/bash'
30    strategy:
31      fail-fast: false
32    env:
33      ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1
34      ZEPHYR_TOOLCHAIN_VARIANT: zephyr
35    steps:
36      - name: Apply container owner mismatch workaround
37        run: |
38          # FIXME: The owner UID of the GITHUB_WORKSPACE directory may not
39          #        match the container user UID because of the way GitHub
40          #        Actions runner is implemented. Remove this workaround when
41          #        GitHub comes up with a fundamental fix for this problem.
42          git config --global --add safe.directory ${GITHUB_WORKSPACE}
43
44      - name: Update PATH for west
45        run: |
46          echo "$HOME/.local/bin" >> $GITHUB_PATH
47
48      - name: Install packages
49        run: |
50          sudo apt-get update
51          sudo apt-get install -y python3-venv
52          sudo pip3 install -U setuptools wheel pip gitpython
53
54      - name: checkout
55        uses: actions/checkout@v3
56        with:
57          ref: ${{ github.event.pull_request.head.sha }}
58          fetch-depth: 0
59
60      - name: west setup
61        run: |
62          west init -l . || true
63          west config --global update.narrow true
64          west update 2>&1 1> west.update.log || west update 2>&1 1> west.update2.log
65
66      - name: Configure AWS Credentials
67        uses: aws-actions/configure-aws-credentials@v2
68        with:
69          aws-access-key-id: ${{ vars.AWS_TESTING_ACCESS_KEY_ID }}
70          aws-secret-access-key: ${{ secrets.AWS_TESTING_SECRET_ACCESS_KEY }}
71          aws-region: us-east-1
72
73      - name: Record Footprint
74        env:
75          BASE_REF: ${{ github.base_ref }}
76        run: |
77          export ZEPHYR_BASE=${PWD}
78          ./scripts/footprint/track.py  -p scripts/footprint/plan.txt
79
80      - name: Upload footprint data
81        run: |
82          python3 -m venv .venv
83          . .venv/bin/activate
84          pip3 install awscli
85          aws s3 sync  --quiet footprint_data/ s3://testing.zephyrproject.org/footprint_data/
86