Truss Examples CI #496
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
name: Truss Examples CI | |
on: | |
schedule: | |
# Runs daily at 6am UTC | |
- cron: '0 6 * * *' | |
workflow_dispatch: | |
jobs: | |
generate_tests: | |
runs-on: ubuntu-latest | |
outputs: | |
tests: ${{ steps.generate-matrix.outputs.tests }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: yq - portable yaml processor | |
uses: mikefarah/[email protected] | |
- name: Generate all tests that need to be run | |
id: generate-matrix | |
run: | | |
TESTS=$(cat ci.yaml | yq e ".tests" | yq eval -o=json | jq -c .) | |
echo "tests=$TESTS" >> $GITHUB_OUTPUT | |
ci: | |
runs-on: ubuntu-latest | |
needs: | |
- generate_tests | |
strategy: | |
fail-fast: false | |
max-parallel: 3 | |
matrix: | |
test: ${{ fromJSON(needs.generate_tests.outputs.tests) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python environment | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11.4' | |
- name: Install dependencies (if any) | |
run: | | |
python -m pip install --upgrade pip | |
pip install git+https://github.com/basetenlabs/truss.git requests tenacity --upgrade | |
- name: Test => (${{ matrix.test }} | |
run: | | |
python ./bin/test_example.py ${{secrets.BASETEN_API_KEY}} ${{matrix.test}} | |
report_to_slack: | |
runs-on: ubuntu-latest | |
if: always() && github.ref == 'refs/heads/main' | |
needs: | |
- ci | |
steps: | |
- name: get-branch | |
run: echo ${{ github.ref }} | |
- name: show-slack-status | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: custom | |
fields: author, job, commit, repo | |
custom_payload: | | |
{ | |
attachments: [{ | |
color: "${{ needs.ci.result == 'failure' && 'danger' || 'good' }}", | |
text: `Truss Examples CI Result: ${{ needs.ci.result }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`, | |
}] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |