Update and publish #40543
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update and publish | |
| on: | |
| schedule: | |
| - cron: '*/5 * * * *' | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| pull_request: | |
| defaults: | |
| run: | |
| shell: bash | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: Install Python dependencies | |
| run: pip3 install -U PyGithub west | |
| - name: Setup the manifest data | |
| run: | | |
| mkdir -p west/submanifests | |
| wget --progress=dot https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/main/west.yml -O west/west.yml | |
| wget --progress=dot https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/main/submanifests/optional.yaml -O west/submanifests/optional.yaml | |
| west init -l west | |
| west config manifest.group-filter -- +ci,+optional | |
| - name: Update | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| mkdir cache | |
| # Set to false for testing with cached data. | |
| if true; then | |
| python -u update_zephyr_pr.py 2>&1 | |
| bzip2 -c cache/data_dump.json > public/data_dump.json.bz2 | |
| else | |
| ./download_cache_data | |
| fi | |
| - name: Crunch | |
| run: | | |
| python -u crunch_data.py 2>&1 | |
| - name: Upload debugging artifacts (debug) | |
| if: failure() || github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| if-no-files-found: ignore | |
| path: | |
| public/ | |
| - name: Setup pages | |
| if: github.event_name != 'pull_request' | |
| uses: actions/configure-pages@v5 | |
| - name: Upload pages artifact | |
| if: github.event_name != 'pull_request' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: public | |
| deploy: | |
| if: github.event_name != 'pull_request' | |
| needs: build | |
| permissions: | |
| pages: write | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| uses: actions/deploy-pages@v4 | |
| screenshot: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Download pages artifact | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: public | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| - name: Start a local web server and take a screenshot | |
| run: | | |
| cd public | |
| python -m http.server 8080 & | |
| cd .. | |
| npm install puppeteer | |
| node screenshot.js | |
| - name: Upload screenshots as artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: screenshots | |
| path: screenshot-*.png |