From 453b7daa92ee85228a9c3743183ef5d735a62787 Mon Sep 17 00:00:00 2001 From: Timothy John Perisho Eccleston Date: Fri, 13 Jun 2025 10:26:40 -0700 Subject: [PATCH 1/7] suggested python-app.yml from github --- .github/workflows/python-app.yml | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..1168bd9 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python application + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From 0124b37842c69ab80011a86591de5edc7191654a Mon Sep 17 00:00:00 2001 From: Timothy John Perisho Eccleston Date: Fri, 13 Jun 2025 10:34:56 -0700 Subject: [PATCH 2/7] schedule run with poetry install in python-app.yml --- .github/workflows/python-app.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 1168bd9..a08ca9f 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -8,6 +8,8 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + schedule: + - cron: '53 5 * * *' permissions: contents: read @@ -19,21 +21,14 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.13 uses: actions/setup-python@v3 with: - python-version: "3.10" + python-version: "3.13" - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 + pip install poetry + poetry install + - name: Run run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest + poetry run python -m sync.py From c54b0e7ada6a7ccb4f2c46acc336be80a9eecc86 Mon Sep 17 00:00:00 2001 From: Timothy John Perisho Eccleston Date: Fri, 13 Jun 2025 10:44:49 -0700 Subject: [PATCH 3/7] add environment to python-app.yml --- .github/workflows/python-app.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index a08ca9f..5c4997a 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -18,6 +18,7 @@ jobs: build: runs-on: ubuntu-latest + environment: dev steps: - uses: actions/checkout@v4 From 297d30c8bf0cbf0e75ac6350451668cafeac4472 Mon Sep 17 00:00:00 2001 From: Timothy John Perisho Eccleston Date: Fri, 13 Jun 2025 10:48:48 -0700 Subject: [PATCH 4/7] add secret to env for python-app.yml --- .github/workflows/python-app.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 5c4997a..4dd0871 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -33,3 +33,5 @@ jobs: - name: Run run: | poetry run python -m sync.py + env: + AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }} From 3034f9857bd3447b13d79c9e9664e780511db846 Mon Sep 17 00:00:00 2001 From: Tim Eccleston Date: Fri, 13 Jun 2025 10:54:06 -0700 Subject: [PATCH 5/7] turn off airtable cache by default --- sync.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.py b/sync.py index 4efa4b1..c185ba6 100644 --- a/sync.py +++ b/sync.py @@ -18,7 +18,7 @@ def log(message): ctfg = api.table(bases['timCopy'], 'Listings') -def get_ctfg(from_cache=True): +def get_ctfg(from_cache=False): log('Getting airtable records...') cache_fp = 'cache/ctfg.pickle' if from_cache: From 312df7c1e0ee2899ad12be3782011512b0b83adb Mon Sep 17 00:00:00 2001 From: Tim Eccleston Date: Fri, 13 Jun 2025 10:58:35 -0700 Subject: [PATCH 6/7] fix typo in ci --- .github/workflows/python-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 4dd0871..2bc60eb 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -32,6 +32,6 @@ jobs: poetry install - name: Run run: | - poetry run python -m sync.py + poetry run python -m sync env: AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }} From 4e9bb3378a16c230b24fc2158a777ef44085c744 Mon Sep 17 00:00:00 2001 From: Timothy John Perisho Eccleston Date: Fri, 13 Jun 2025 11:03:28 -0700 Subject: [PATCH 7/7] Update and rename python-app.yml to sync.yml --- .github/workflows/{python-app.yml => sync.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{python-app.yml => sync.yml} (93%) diff --git a/.github/workflows/python-app.yml b/.github/workflows/sync.yml similarity index 93% rename from .github/workflows/python-app.yml rename to .github/workflows/sync.yml index 2bc60eb..913b753 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/sync.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python application +name: Sync data on: push: @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.13 + - name: Set up Python 3 uses: actions/setup-python@v3 with: python-version: "3.13"