mirror of
https://github.com/codecov/codecov-action.git
synced 2026-02-10 21:17:24 +00:00
fix: check reqs
This commit is contained in:
parent
78f372e97e
commit
04ec9fe285
2 changed files with 125 additions and 7 deletions
112
.github/workflows/main.yml
vendored
112
.github/workflows/main.yml
vendored
|
|
@ -14,11 +14,12 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: "true"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pip install -r src/scripts/app/requirements.txt
|
run: pip install -r src/scripts/app/requirements.txt
|
||||||
- name: Run tests and collect coverage
|
- name: Run tests and collect coverage
|
||||||
run: pytest src/scripts/app/ --cov
|
run: pytest src/scripts/app/ --cov
|
||||||
|
|
||||||
- name: Upload coverage to Codecov (script)
|
- name: Upload coverage to Codecov (script)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
|
@ -55,7 +56,7 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: "true"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pip install -r src/scripts/app/requirements.txt
|
run: pip install -r src/scripts/app/requirements.txt
|
||||||
- name: Run tests and collect coverage
|
- name: Run tests and collect coverage
|
||||||
|
|
@ -104,15 +105,16 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: "true"
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
run: |
|
run: |
|
||||||
apt-get install git
|
apt-get update && apt-get install -y git
|
||||||
|
|
||||||
- name: Upload coverage to Codecov (script)
|
- name: Upload coverage to Codecov (script)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
files: ./coverage/script/coverage-final.json
|
files: ./coverage/script/coverage-final.json
|
||||||
flags: script-${{ matrix.os }}
|
flags: script-container
|
||||||
name: codecov-script
|
name: codecov-script
|
||||||
verbose: true
|
verbose: true
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
@ -120,7 +122,7 @@ jobs:
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
||||||
flags: demo-${{ matrix.os }}
|
flags: demo-container
|
||||||
name: codecov-demo
|
name: codecov-demo
|
||||||
verbose: true
|
verbose: true
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
@ -128,8 +130,104 @@ jobs:
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
||||||
flags: version-${{ matrix.os }}
|
flags: version-container
|
||||||
name: codecov-version
|
name: codecov-version
|
||||||
version: v9.1.0
|
version: v9.1.0
|
||||||
verbose: true
|
verbose: true
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
|
run-alpine-missing-deps:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: alpine:latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
submodules: "true"
|
||||||
|
- name: Upload coverage to Codecov (should fail due to missing dependencies)
|
||||||
|
id: codecov-upload
|
||||||
|
continue-on-error: true
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: ./coverage/script/coverage-final.json
|
||||||
|
flags: script-alpine-missing-deps
|
||||||
|
name: codecov-script
|
||||||
|
verbose: true
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
- name: Verify dependency check failed
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.codecov-upload.outcome }}" = "failure" ]; then
|
||||||
|
echo "✓ Action correctly failed due to missing dependencies"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "✗ Action should have failed but didn't"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
run-alpine-success:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: alpine:latest
|
||||||
|
steps:
|
||||||
|
- name: Install all required deps
|
||||||
|
run: |
|
||||||
|
apk add git curl gnupg bash
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
submodules: "true"
|
||||||
|
- name: Upload coverage to Codecov (should succeed)
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: ./coverage/script/coverage-final.json
|
||||||
|
flags: script-alpine-success
|
||||||
|
name: codecov-script
|
||||||
|
verbose: true
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
- name: Upload coverage to Codecov (demo)
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
||||||
|
flags: demo-alpine-success
|
||||||
|
name: codecov-demo
|
||||||
|
verbose: true
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
- name: Upload coverage to Codecov (version)
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
||||||
|
flags: version-alpine-success
|
||||||
|
name: codecov-version
|
||||||
|
version: v9.1.0
|
||||||
|
verbose: true
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
|
run-alpine-partial-deps:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: alpine:latest
|
||||||
|
steps:
|
||||||
|
- name: Install only some deps (missing gpg and bash)
|
||||||
|
run: |
|
||||||
|
apk add git curl
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
submodules: "true"
|
||||||
|
- name: Upload coverage to Codecov (should fail due to missing gpg and bash)
|
||||||
|
id: codecov-upload
|
||||||
|
continue-on-error: true
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: ./coverage/script/coverage-final.json
|
||||||
|
flags: script-alpine-partial-deps
|
||||||
|
name: codecov-script
|
||||||
|
verbose: true
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
- name: Verify dependency check failed
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.codecov-upload.outcome }}" = "failure" ]; then
|
||||||
|
echo "✓ Action correctly failed due to missing dependencies (gpg and bash)"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "✗ Action should have failed but didn't"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
|
||||||
20
action.yml
20
action.yml
|
|
@ -175,6 +175,26 @@ branding:
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
- name: Check system dependencies
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
missing_deps=""
|
||||||
|
|
||||||
|
# Check for required commands
|
||||||
|
for cmd in bash git curl gpg; do
|
||||||
|
if ! command -v "$cmd" >/dev/null 2>&1; then
|
||||||
|
missing_deps="$missing_deps $cmd"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Report missing required dependencies
|
||||||
|
if [ -n "$missing_deps" ]; then
|
||||||
|
echo "Error: The following required dependencies are missing:$missing_deps"
|
||||||
|
echo "Please install these dependencies before using this action."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "All required system dependencies are available."
|
||||||
- name: Action version
|
- name: Action version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue