Cron #3691
This file contains 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
# eslint-disable yml/no-empty-mapping-value | |
name: Cron | |
on: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: Enable debugging | |
required: false | |
default: false | |
push: | |
branches: | |
- main | |
- 'feature/**' | |
pull_request: | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule | |
schedule: | |
- cron: '5 */6 * * *' | |
jobs: | |
# Job ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
build: | |
name: job β― build & run | |
runs-on: ubuntu-24.04 | |
steps: | |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
- name: Bootstrap β―β― actions/checkout@v3 | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
- name: Bootstrap β―β― denoland/setup-deno@v1 | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
- name: Bootstrap β―β― Set env variables | |
run: | | |
.github/scripts/ciutil set-env-variables | |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
- uses: actions/cache@v4 | |
name: Bootstrap β―β― Restore Lockfile Cache | |
with: | |
path: ${{ env.ACTIONS_CACHE_DIR }} | |
key: ${{ runner.os }}-v1-store-${{ env.CACHE_PREFIX_DAILY }}-${{ hashFiles('**/deno.lock') }} | |
restore-keys: | | |
${{ runner.os }}-v1-store-${{ env.CACHE_PREFIX_DAILY }}-${{ hashFiles('**/deno.lock') }} | |
# ${{ runner.os }}-v1-store-${{ env.CACHE_PREFIX_DAILY }}- | |
# ${{ runner.os }}-v1-store- | |
- uses: actions/cache@v4 | |
name: Bootstrap β―β― Restore TTL Cache | |
if: always() | |
with: | |
path: ${{ env.TTL_CACHE_DIR }} | |
key: ${{ runner.os }}-v1-ttl-cache-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }} | |
restore-keys: | | |
${{ runner.os }}-v1-ttl-cache- | |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
- name: Bootstrap β―β― Preinstall & Prepare Environment | |
run: | | |
. .github/scripts/ciutil | |
β¨ "Setup: Preinstall binaries" && preinstall-binaries | |
β¨ "Debug: System information" && system-info | |
β¨ "Debug: Env variables" && ga-dump-env | |
β¨ "Debug: generic cache ($ACTIONS_CACHE_DIR)" && show-cache-structure-default | |
β¨ "Debug: ttl cache ($TTL_CACHE_DIR)" && show-cache-structure-ttl | |
β¨ "Debug: file cache ($FILES_CACHE_DIR)" && show-cache-structure-files | |
β¨ "Debug: apt cache (/var/cache/apt/archives)" && show-cache-structure-apt | |
β¨ "pnpm install" && install-nodemodules | |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
- name: Cron β―β― Job1 | |
# if: github.event.schedule != '*/5 * * * *' | |
run: | | |
# fd download --threads=2 -tf -tx -x bash -c "echo π {}; timeout 5m {} && echo β {}" || true | |
# fd download -tf -tx -x {} || true | |
cronjobs=($(fd -tf download)); | |
for i in "${cronjobs[@]}"; do | |
echo; | |
echo '--------------------------------' | |
echo | |
echo "π $i" | |
timeout 1m $i || true | |
done | |
fd .ipv6 -tf -te -x rm || true | |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
- name: Post hooks β―β― Commit to repository | |
if: github.ref == 'refs/heads/main' | |
run: | | |
.github/scripts/ciutil git-commit-to-repository | |
git push | |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
- name: Debug β―β― Context Information | |
id: github_context_step | |
env: | |
JSON_GITHUB: ${{ toJSON(github) }} | |
JSON_JOB: ${{ toJSON(job) }} | |
JSON_STEPS: ${{ toJSON(steps) }} | |
JSON_RUNNER: ${{ toJSON(runner) }} | |
JSON_STRATEGY: ${{ toJSON(strategy) }} | |
JSON_MATRIX: ${{ toJSON(MATRIX) }} | |
run: | | |
. .github/scripts/ciutil | |
ip-public | |
β¨ "Debug: generic cache ($ACTIONS_CACHE_DIR)" && show-cache-structure-default | |
β¨ "Debug: ttl cache ($TTL_CACHE_DIR)" && show-cache-structure-ttl | |
β¨ "Debug: file cache ($FILES_CACHE_DIR)" && show-cache-structure-files | |
___ | |
printf "$JSON_GITHUB" >> $DEBUG_DIR/github.json | |
printf "$JSON_JOB" >> $DEBUG_DIR/job.json | |
printf "$JSON_STEPS" >> $DEBUG_DIR/steps.json | |
printf "$JSON_RUNNER" >> $DEBUG_DIR/runner.json | |
printf "$JSON_STRATEGY" >> $DEBUG_DIR/strategy.json | |
printf "$JSON_MATRIX" >> $DEBUG_DIR/matrix.json | |
ga-dump-context | tee /tmp/ga-dump-context.txt &> /dev/null && cat /tmp/ga-dump-context.txt |