Probe #1103
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: Probe | |
| on: | |
| schedule: | |
| - cron: '17 * * * *' | |
| workflow_dispatch: | |
| concurrency: | |
| group: probe | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| probe-us: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: | | |
| probes | |
| requirements.txt | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Run probes | |
| env: | |
| PROXY_HOST: ${{ secrets.PROXY_HOST }} | |
| PROXY_PORT: ${{ secrets.PROXY_PORT }} | |
| PROXY_SECRET: ${{ secrets.PROXY_SECRET }} | |
| PROXY_DOMAIN: ${{ secrets.PROXY_DOMAIN }} | |
| TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} | |
| run: > | |
| python -m probes.runner | |
| --probe-id github-us | |
| --region "🇺🇸 US (GitHub Actions)" | |
| --target "🇸🇬 Singapore VPS" | |
| - name: Upload probe result | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: probe-github-us | |
| path: data/latest/github-us.json | |
| retention-days: 1 | |
| if-no-files-found: ignore | |
| probe-russia: | |
| runs-on: [self-hosted, russia] | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: python3.12 -m pip install --user -r requirements.txt | |
| - name: Run probes | |
| env: | |
| PROXY_HOST: ${{ secrets.PROXY_HOST }} | |
| PROXY_PORT: ${{ secrets.PROXY_PORT }} | |
| PROXY_SECRET: ${{ secrets.PROXY_SECRET }} | |
| PROXY_DOMAIN: ${{ secrets.PROXY_DOMAIN }} | |
| TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} | |
| run: > | |
| python3.12 -m probes.runner | |
| --probe-id russia | |
| --region "🇷🇺 Russia (Moscow VPS)" | |
| --target "🇸🇬 Singapore VPS" | |
| - name: Upload probe result | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: probe-russia | |
| path: data/latest/russia.json | |
| retention-days: 1 | |
| if-no-files-found: ignore | |
| publish: | |
| needs: [probe-us, probe-russia] | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Download probe artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| pattern: probe-* | |
| - name: Merge results | |
| run: python -m probes.merge | |
| - name: Prune old history | |
| run: find data/history -name '*.json' -mtime +90 -delete 2>/dev/null || true | |
| - name: Commit results | |
| run: | | |
| git config user.name "observatory-bot" | |
| git config user.email "[email protected]" | |
| git add data/ | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "probe: $(date -u +%Y-%m-%dT%H:%M)" | |
| git pull --rebase origin main | |
| git push | |
| fi | |
| - name: Deploy dashboard | |
| run: | | |
| mkdir -p _site | |
| cp -r dashboard/* _site/ | |
| cp -r data _site/data | |
| touch _site/.nojekyll | |
| V=$(date +%s) | |
| sed -i "s/app\.js/app.js?v=$V/" _site/index.html | |
| sed -i "s/style\.css/style.css?v=$V/" _site/index.html | |
| - uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./_site | |
| publish_branch: gh-pages |