Skip to content

dynamically discover smoke tests #267

dynamically discover smoke tests

dynamically discover smoke tests #267

Workflow file for this run

# Runs all ecosystems cached and concurrently.
name: Smoke
on:
workflow_dispatch:
pull_request:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
suites:
runs-on: ubuntu-latest
steps:
- name: Get suites
run: |
URL="https://api.github.com/repos/dependabot/smoke-tests/contents/tests"
DATA=$(gh api $URL | jq -r '.[].name' | sed 's/smoke-//' | sed 's/.yaml$//' | jq -R | jq -sc)"
echo "Data is $DATA"
echo "::set-output name=suite::$DATA"
outputs:
suites: ${{ steps.suites.outputs.suite }}
debug:
runs-on: ubuntu-latest
needs: suites
steps:
- name: Debug
run: |
echo ${{ toJSON(needs.suites.outputs) }}
smoke:
runs-on: ubuntu-latest
needs: suites
strategy:
fail-fast: false
matrix:
suite: ${{ fromJSON(needs.suites.outputs.suite) }}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.5
# Download the Proxy cache. The job is ideally 100% cached so no real calls are made.
- name: Download cache
run: |
gh run download --repo dependabot/smoke-tests --name cache-${{ matrix.suite }} --dir cache
- name: ${{ matrix.suite }}
env:
LOCAL_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -o pipefail
URL=https://api.github.com/repos/dependabot/smoke-tests/contents/tests/smoke-${{ matrix.suite }}.yaml
curl $(gh api $URL --jq .download_url) -o smoke.yaml
go run cmd/dependabot/dependabot.go test \
-f=smoke.yaml \
-o=result.yaml \
--cache=cache \
--timeout 20m \
2>&1 | tee -a log.txt
- name: Diff
if: always()
continue-on-error: true
run: diff --ignore-space-change smoke.yaml result.yaml && echo "Contents are identical" || exit 0
- name: Create summary
run: tail -n100 log.txt | grep -P '\d+/\d+ calls cached \(\d+%\)' >> $GITHUB_STEP_SUMMARY