Skip to content

Commit

Permalink
prod: stop all jobs when bot is down
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Jan 25, 2025
1 parent 83c44b0 commit 1262e80
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/keepalive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: mamba-org/setup-micromamba@4b9113af4fba0e9e1124b252dd6497a419e7396d # v1.11.0
with:
environment-file: conda-lock.yml
environment-name: cf-scripts
condarc-file: autotick-bot/condarc

- name: stop me if needed
run: |
python autotick-bot/stop_me_if_needed.py
- uses: gautamkrishnar/keepalive-workflow@995aec69bb3f2b45b20f4e107907992c8715086d # v2.0.8
if: ${{ ! env.CI_SKIP }}
with:
commit_message: "Ah ah ah, stayin' alive"
committer_username: conda-forge-bot
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ jobs:
environment-name: cf-scripts
condarc-file: autotick-bot/condarc

- name: stop me if needed
run: |
python autotick-bot/stop_me_if_needed.py
- name: compute next version
id: version
if: ${{ ! env.CI_SKIP }}
run: |
echo "current version: "$(git tag --sort=committerdate | tail -1)
NEXT=$(python autotick-bot/compute_next_version.py)
Expand All @@ -44,6 +49,7 @@ jobs:
- name: log into ghcr.io
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
if: ${{ ! env.CI_SKIP }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -52,6 +58,7 @@ jobs:
- name: build docker metadata
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
if: ${{ ! env.CI_SKIP }}
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
Expand All @@ -62,13 +69,15 @@ jobs:
- name: build and push image
uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc # v6.11.0
if: ${{ ! env.CI_SKIP }}
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: tag and release
if: ${{ ! env.CI_SKIP }}
run: |
python autotick-bot/release.py "${{ steps.version.outputs.NEXT }}"
env:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/relock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: mamba-org/setup-micromamba@4b9113af4fba0e9e1124b252dd6497a419e7396d # v1.11.0
with:
environment-file: conda-lock.yml
environment-name: cf-scripts
condarc-file: autotick-bot/condarc

- name: stop me if needed
run: |
python autotick-bot/stop_me_if_needed.py
- uses: conda-incubator/relock-conda@b99e8465ac98aff5f3624060b351bb537de0cb4f # v19
if: ${{ ! env.CI_SKIP }}
with:
github-token: ${{ secrets.AUTOTICK_BOT_TOKEN }}
automerge: true
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/test-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ jobs:
environment-name: cf-scripts
condarc-file: autotick-bot/condarc

- name: stop me if needed
run: |
python autotick-bot/stop_me_if_needed.py
- name: configure conda, install code, and clone cf-graph
if: ${{ ! env.CI_SKIP }}
run: |
pip install --no-deps --no-build-isolation -e .
git clone --depth=1 https://github.com/regro/cf-graph-countyfair.git cf-graph
- name: conda info and env
if: ${{ ! env.CI_SKIP }}
run: |
echo "=================================================================="
echo "=================================================================="
Expand All @@ -47,6 +53,7 @@ jobs:
conda list
- name: run pytest (model)
if: ${{ ! env.CI_SKIP }}
run: |
cd cf-graph
# for pull requests, a failed model test should not be a failed check
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/tests-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,24 @@ jobs:
environment-name: cf-scripts
condarc-file: autotick-bot/condarc

- name: stop me if needed
run: |
python autotick-bot/stop_me_if_needed.py
- name: configure conda and install code
if: ${{ ! env.CI_SKIP }}
run: |
pip install --no-deps --no-build-isolation -e .
- name: Set up git
if: ${{ ! env.CI_SKIP }}
run: |
git config --global user.name regro-cf-autotick-bot
git config --global user.email [email protected]
git config --global pull.rebase false
- name: test versions
if: ${{ ! env.CI_SKIP }}
run: |
cd ..
python -c "import conda_forge_tick; assert conda_forge_tick.__version__ != '0.0.0'"
Expand All @@ -98,20 +105,24 @@ jobs:
- name: start MongoDB
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # v1.12.0
if: ${{ ! env.CI_SKIP }}
with:
mongodb-version: "latest"

- name: test mongodb is OK
if: ${{ ! env.CI_SKIP }}
run: |
python -c "from pymongo import MongoClient; import os; print(MongoClient(os.environ['MONGODB_CONNECTION_STRING']))"
env:
MONGODB_CONNECTION_STRING: "mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000"

- name: set up docker buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
if: ${{ ! env.CI_SKIP }}

- name: build docker image
uses: docker/build-push-action@b32b51a8eda65d6793cd0494a773d4f6bcef32dc # v6.11.0
if: ${{ ! env.CI_SKIP }}
with:
context: .
push: false
Expand All @@ -120,6 +131,7 @@ jobs:

- name: restore test durations
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
if: ${{ ! env.CI_SKIP }}
with:
path: .test_durations
key: test-durations-${{ github.ref }}-${{ github.sha }}
Expand All @@ -128,6 +140,7 @@ jobs:
test-durations-
- name: run pytest
if: ${{ ! env.CI_SKIP }}
run: |
export TEST_BOT_TOKEN_VAL=unpassword
# note: we do not use pytest-xdist (-n auto) here for now because they interfere with hiding the
Expand Down Expand Up @@ -157,13 +170,15 @@ jobs:

- name: upload test durations
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: ${{ ! env.CI_SKIP }}
with:
name: test-durations-${{ matrix.group }}
path: .test_durations.${{ matrix.group }}
include-hidden-files: true

- name: upload coverage
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: ${{ ! env.CI_SKIP }}
with:
name: coverage-${{ matrix.group }}
path: .coverage
Expand Down Expand Up @@ -205,23 +220,31 @@ jobs:
environment-name: cf-scripts
condarc-file: autotick-bot/condarc

- name: stop me if needed
run: |
python autotick-bot/stop_me_if_needed.py
- name: download coverage artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
if: ${{ ! env.CI_SKIP }}
with:
pattern: coverage-*

- name: combine coverage
if: ${{ ! env.CI_SKIP }}
run: |
coverage combine coverage-*/.coverage*
coverage xml
- name: upload codecov
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.8
if: ${{ ! env.CI_SKIP }}
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: cache test durations
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
if: ${{ ! env.CI_SKIP }}
with:
path: .test_durations
key: test-durations-${{ github.ref }}-${{ github.sha }}
Expand All @@ -231,15 +254,18 @@ jobs:
- name: download test duration artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
if: ${{ ! env.CI_SKIP }}
with:
pattern: test-durations-*

- name: combine test durations
if: ${{ ! env.CI_SKIP }}
run: |
jq '. + input' test-durations-*/.test_durations.* > .test_durations
- name: upload test durations
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: ${{ ! env.CI_SKIP }}
with:
name: test-durations
path: .test_durations
Expand Down

0 comments on commit 1262e80

Please sign in to comment.