feat: retry CLI download on transient GitHub failures #11
Workflow file for this run
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: Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: {} | |
| workflow_dispatch: {} | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest, ubuntu-latest] | |
| version: [2.11.27, latest] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install deps and build | |
| run: npm ci && npm run build | |
| - name: Run unit tests | |
| run: npm test | |
| - name: Setup kosli CLI | |
| id: setup | |
| uses: ./ | |
| with: | |
| version: ${{ matrix.version }} | |
| - name: Capture kosli version installed | |
| run: | | |
| export KOSLI_VERSION=$( kosli version --short) | |
| echo 'KOSLI_VERSION_INSTALLED<<EOF' >> $GITHUB_ENV | |
| kosli version --short >> $GITHUB_ENV | |
| echo "\n" >> $GITHUB_ENV | |
| echo 'EOF' >> $GITHUB_ENV | |
| - name: Verify pinned version | |
| if: matrix.version != 'latest' | |
| shell: python | |
| env: | |
| KOSLI_VERSION_EXPECTED: ${{ matrix.version }} | |
| run: | | |
| import sys, os | |
| sys.exit( | |
| int(not os.environ["KOSLI_VERSION_EXPECTED"] in os.environ["KOSLI_VERSION_INSTALLED"]) | |
| ) | |
| - name: Verify latest resolved to a semver | |
| if: matrix.version == 'latest' | |
| shell: python | |
| env: | |
| KOSLI_VERSION_RESOLVED: ${{ steps.setup.outputs.version }} | |
| run: | | |
| import os, re, sys | |
| installed = os.environ["KOSLI_VERSION_INSTALLED"].strip() | |
| resolved = os.environ["KOSLI_VERSION_RESOLVED"].strip() | |
| if not re.match(r"^\d+\.\d+\.\d+", resolved): | |
| print(f"resolved version {resolved!r} does not look like semver") | |
| sys.exit(1) | |
| if resolved not in installed: | |
| print(f"resolved {resolved!r} not found in installed {installed!r}") | |
| sys.exit(1) |