Skip to content

Commit c74929a

Browse files
committed
moving cron workflows from adabot repo
1 parent edc82dd commit c74929a

File tree

3 files changed

+190
-0
lines changed

3 files changed

+190
-0
lines changed

.github/workflows/bundle_cron.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SPDX-FileCopyrightText: 2019 Michael Schroeder
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Update Bundles
6+
7+
on:
8+
schedule:
9+
- cron: 0 5 * * *
10+
workflow_dispatch:
11+
12+
jobs:
13+
check-repo-owner:
14+
# This job is so the entire workflow will end successfully and give some
15+
# output to explain why it hasn't run on a non-Adafruit fork.
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: repository
19+
env:
20+
OWNER_IS_ADAFRUIT: ${{ startswith(github.repository, 'adafruit/') }}
21+
run: |
22+
echo "This workflow will only run if Adafruit is the repository owner."
23+
echo "Repository owner is Adafruit: $OWNER_IS_ADAFRUIT"
24+
update-bundles:
25+
runs-on: ubuntu-latest
26+
# Only run the build on Adafruit's repository. Forks won't have the secrets.
27+
# Its necessary to do this here, since 'schedule' events cannot (currently)
28+
# be limited (they run on all forks' default branches).
29+
if: startswith(github.repository, 'adafruit/')
30+
steps:
31+
- name: Set up Python 3.12
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: 3.12
35+
- name: Load contributor cache
36+
uses: actions/cache@v4
37+
with:
38+
key: "contributor-cache"
39+
path: "contributors.json"
40+
- name: Versions
41+
run: |
42+
python3 --version
43+
- uses: actions/checkout@v4
44+
with:
45+
repository: 'adafruit/adabot'
46+
submodules: true
47+
- name: Install deps
48+
run: |
49+
pip install -r requirements.txt
50+
- name: Run adabot.circuitpython_bundle
51+
env:
52+
ADABOT_EMAIL: ${{ secrets.ADABOT_EMAIL }}
53+
ADABOT_GITHUB_USER: ${{ secrets.ADABOT_GITHUB_USER }}
54+
ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.ADABOT_GITHUB_ACCESS_TOKEN }}
55+
BIGQUERY_PRIVATE_KEY: ${{ secrets.BIGQUERY_PRIVATE_KEY }}
56+
BIGQUERY_CLIENT_EMAIL: ${{ secrets.BIGQUERY_CLIENT_EMAIL }}
57+
run: |
58+
python3 -u -m adabot.circuitpython_bundle

.github/workflows/learn_cron.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# SPDX-FileCopyrightText: 2021 Jeff Epler for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Tag Learning System Guides
6+
7+
on:
8+
schedule:
9+
- cron: 0 5 * * *
10+
11+
jobs:
12+
check-repo-owner:
13+
# This job is so the entire workflow will end successfully and give some
14+
# output to explain why it hasn't run on a non-Adafruit fork.
15+
runs-on: ubuntu-latest
16+
if: ${{ (github.repository_owner != 'adafruit') }}
17+
steps:
18+
- run: |
19+
echo "This workflow is only intended to run in the adafruit fork"
20+
21+
update-learn:
22+
runs-on: ubuntu-latest
23+
# Only run the build if the access token has been configured. THs will be
24+
# the case on Adafruit's repository. Its necessary to do this here, since
25+
# 'schedule' events cannot (currently) be limited (they run on all forks'
26+
# default branches).
27+
if: ${{ (github.repository_owner == 'adafruit') }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
repository: ${{ github.repository_owner }}/Adafruit_Learning_System_Guides
32+
token: ${{ secrets.ADABOT_GITHUB_ACCESS_TOKEN }}
33+
- name: Tag a release
34+
env:
35+
ADABOT_EMAIL: ${{ secrets.ADABOT_EMAIL }}
36+
run: |
37+
git config --global user.name adabot
38+
git config --global user.email "$ADABOT_EMAIL"
39+
TAG_NAME=`date +%Y%m%d`
40+
git tag $TAG_NAME
41+
git push origin $TAG_NAME

.github/workflows/reports_cron.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# SPDX-FileCopyrightText: 2019 Michael Schroeder
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: Run Daily Reports
6+
7+
on:
8+
schedule:
9+
# The actor (github.actor) that runs the cron job may be the user who created the cron job
10+
# initially. It does not appear to be settable via a secret or environment variable.
11+
- cron: 15 5 * * *
12+
workflow_dispatch:
13+
14+
15+
jobs:
16+
check-repo-owner:
17+
# This job is so the entire workflow will end successfully and give some
18+
# output to explain why it hasn't run on a non-Adafruit fork.
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: repository
22+
env:
23+
OWNER_IS_ADAFRUIT: ${{ startswith(github.repository, 'adafruit/') }}
24+
run: |
25+
echo "This workflow will only run if Adafruit is the repository owner."
26+
echo "Repository owner is Adafruit: $OWNER_IS_ADAFRUIT"
27+
run-reports:
28+
runs-on: ubuntu-latest
29+
# Only run the build on Adafruit's repository. Forks won't have the secrets.
30+
# Its necessary to do this here, since 'schedule' events cannot (currently)
31+
# be limited (they run on all forks' default branches).
32+
if: startswith(github.repository, 'adafruit/')
33+
env:
34+
ADABOT_GITHUB_USER: ${{ secrets.ADABOT_GITHUB_USER }}
35+
ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.ADABOT_GITHUB_ACCESS_TOKEN }}
36+
RTD_TOKEN: ${{ secrets.RTD_TOKEN }}
37+
BIGQUERY_PRIVATE_KEY: ${{ secrets.BIGQUERY_PRIVATE_KEY }}
38+
BIGQUERY_CLIENT_EMAIL: ${{ secrets.BIGQUERY_CLIENT_EMAIL }}
39+
steps:
40+
- name: Set up Python 3.11
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: 3.11
44+
- name: Versions
45+
run: |
46+
python3 --version
47+
- uses: actions/checkout@v4
48+
with:
49+
repository: 'adafruit/adabot'
50+
submodules: true
51+
- name: Install deps
52+
run: |
53+
pip install -r requirements.txt
54+
- name: Make Directory For Report Files
55+
run: mkdir -p bin/adabot
56+
- name: Set Date Variable
57+
id: today
58+
run: |
59+
echo date=$(
60+
date +%Y%m%d
61+
) >> $GITHUB_OUTPUT
62+
- name: Run adabot.circuitpython_libraries
63+
env:
64+
# LIB_CHECK_CP_FILE is for circuitpython_libraries.py output
65+
LIB_CHECK_CP_FILE: bin/adabot/circuitpython_library_report_${{ steps.today.outputs.date }}.txt
66+
run: |
67+
python3 -u -m adabot.circuitpython_libraries -o $LIB_CHECK_CP_FILE
68+
continue-on-error: true
69+
- name: Run adabot.circuitpython_library_download_stats
70+
env:
71+
# LIB_DL_STATS_FILE is for future Bundle and PyPi download stats script
72+
LIB_DL_STATS_FILE: bin/adabot/library_download_stats_${{ steps.today.outputs.date }}.txt
73+
run: |
74+
python3 -u -m adabot.circuitpython_library_download_stats -o $LIB_DL_STATS_FILE
75+
continue-on-error: true
76+
- name: Run adabot.arduino_libraries
77+
env:
78+
# LIB_CHECK_ARD_FILE is for arduino_libraries.py output
79+
LIB_CHECK_ARD_FILE: bin/adabot/arduino_library_report_${{ steps.today.outputs.date }}.txt
80+
run: |
81+
python3 -u -m adabot.arduino_libraries -o $LIB_CHECK_ARD_FILE
82+
continue-on-error: true
83+
- name: Check For Files
84+
run: |
85+
ls bin/adabot
86+
- name: Upload Reports To AWS S3
87+
if: ${{ github.event_name != 'workflow_dispatch' }}
88+
env:
89+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
90+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
91+
run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/adabot/ s3://adafruit-circuit-python/adabot/bin/reports/ --recursive --no-progress --region us-east-1"

0 commit comments

Comments
 (0)