MeteoritesAPI Full integration & Health check #12
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: MeteoritesAPI Full integration & Health check | |
| on: | |
| # Trigger on push to the main branch | |
| push: | |
| branches: | |
| - main | |
| # Plan a monthly check to ensure proper integrity. | |
| schedule: | |
| - cron: '42 3 22 * *' | |
| # Provide the option to run it manually if required. | |
| workflow_dispatch: | |
| jobs: | |
| api-testing: | |
| # Use ubuntu-latest as required for compatibility. | |
| runs-on: ubuntu-latest | |
| # Define read-only permission. | |
| permissions: | |
| contents: read | |
| steps: | |
| # 0. Init project sources. | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| # 1. Install Node.js and npm for Wrangler. | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| # 2. Set up Python for the test script. | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| # 3. Install Python dependencies. | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests | |
| # 4. Create .dev.vars: | |
| # Here, we only have one variable: HASH_KEY. | |
| - name: Create .dev.vars file | |
| run: | | |
| echo "HASH_KEY=\"${{ secrets.HASH_KEY }}\"" > .dev.vars | |
| # 5. Generate Wrangler types for the TypeScript project. | |
| - name: Generate Wrangler types | |
| run: npx wrangler types | |
| # 6. Start Wrangler Dev in the background. | |
| - name: Start Wrangler Dev (Background) | |
| run: | | |
| npx wrangler dev --show-interactive-dev-session=false --port 8787 & | |
| sleep 15 | |
| # 7. Execute the health check script against the local worker. | |
| - name: Run full API test suite | |
| run: | | |
| curl -sL "${{ secrets.GIST_SECRET_URL }}" -o meteorites-api.py && \ | |
| python meteorites-api.py \ | |
| --remote "http://localhost:8787" \ | |
| --timeout 25 \ | |
| --delay 10 \ | |
| --max-radius 2500 \ | |
| --max-random 1000 \ | |
| --max-search 500 |