Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b613503
modernize
IanButterworth Aug 13, 2025
96f5a84
fix
IanButterworth Aug 13, 2025
85f072e
fix valid copilot suggestions
IanButterworth Aug 14, 2025
d1ef9f2
windows fixes
IanButterworth Aug 14, 2025
f00e2f4
add back required macos x64 CI
IanButterworth Aug 14, 2025
6796695
Implement feedback: add architecture support, fix compatibility, impr…
IanButterworth Aug 14, 2025
29fc009
fix CompatHelper private key
IanButterworth Aug 14, 2025
6d952e5
Use ArgParse. Simplify module structure
IanButterworth Aug 14, 2025
590ee3d
more DRY
IanButterworth Aug 14, 2025
a59cbee
fix
IanButterworth Aug 14, 2025
3de66a9
upload coverage on all runs
IanButterworth Aug 14, 2025
b4d0c37
fixes
IanButterworth Aug 14, 2025
2df5507
try setting up PR comments
IanButterworth Aug 14, 2025
0c9c436
actually run upload
IanButterworth Aug 14, 2025
51a9f98
fix error detection
IanButterworth Aug 14, 2025
4b648bd
try adding secrets
IanButterworth Aug 14, 2025
a11c464
rm unused stuff
IanButterworth Aug 14, 2025
a330636
fix coveralls secret
IanButterworth Aug 14, 2025
a3579fc
rm unused. increase coverage
IanButterworth Aug 14, 2025
23c6d12
rm unused
IanButterworth Aug 14, 2025
525ee69
absorb stub files
IanButterworth Aug 14, 2025
0e2090e
support coveralls parallel jobs
IanButterworth Aug 15, 2025
79f05e0
capture some test logs
IanButterworth Aug 15, 2025
f5c2661
add build_num because coveralls parallel requires it
IanButterworth Aug 15, 2025
0979d0d
install brew locally
vtjnash Aug 22, 2025
38c64f4
try system homebrew before installing local version
IanButterworth Aug 26, 2025
dfd2675
try controlling local homebrew further on limited CI machines
IanButterworth Aug 26, 2025
eb14afc
fix
IanButterworth Aug 27, 2025
4a489fb
macOS: move from homebrew to github.com/vtjnash/coveralls-macos-binaries
IanButterworth Aug 28, 2025
d321597
set SSL_CERT_FILE and SSL_CA_BUNDLE
IanButterworth Aug 28, 2025
b1b46cb
update macos binaries to remove version
IanButterworth Aug 28, 2025
708cada
use withenv instead
IanButterworth Aug 28, 2025
a886106
add note about where binaries come from
IanButterworth Aug 28, 2025
18bc1d3
docs tweaks
IanButterworth Aug 29, 2025
719fd82
de-emoji
IanButterworth Aug 29, 2025
bdd667b
fix
IanButterworth Aug 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
fail-fast: false
matrix:
version:
- '1.0'
- '1.6'
- 'lts'
- '1'
- 'pre'
- 'nightly'
os:
- ubuntu-latest
Expand All @@ -35,6 +35,9 @@ jobs:
arch: x64
- version: '1'
os: macos-latest
arch: aarch64
- version: '1'
os: macos-13
arch: x64
steps:
- uses: actions/checkout@v4
Expand All @@ -44,21 +47,15 @@ jobs:
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
coverage: true
# Upload coverage using the modernized Coverage.jl
- name: Upload coverage
env:
JULIA_COVERAGE_BLACK_HOLE_SERVER_URL_PUT: https://httpbingo.julialang.org/put
# submit coverage data to a black hole server, and collect new coverage data on that
- run: julia --color=yes --project=. --code-coverage=user etc/travis-coverage.jl
working-directory: ${{ github.workspace }}
env:
JULIA_COVERAGE_IS_BLACK_HOLE_SERVER: true
COVERALLS_TOKEN: token
COVERALLS_URL: https://httpbingo.julialang.org/post
CODECOV_URL: https://httpbingo.julialang.org
CODECOV_URL_PATH: /post
## submit coverage data *again*, this time without code coverage
- run: julia --color=yes --project=. etc/travis-coverage.jl
working-directory: ${{ github.workspace }}
env:
# COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: |
julia --color=yes --project=. -e '
using Coverage
process_and_upload(service=:both, folder="src")
'
47 changes: 40 additions & 7 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,49 @@
name: CompatHelper

on:
schedule:
- cron: '00 00 * * *'

- cron: 0 0 * * *
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
CompatHelper:
runs-on: ubuntu-latest
steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
- name: Check if Julia is already available in the PATH
id: julia_in_path
run: which julia
continue-on-error: true
- name: Install Julia, but only if it is not already available in the PATH
uses: julia-actions/setup-julia@v2
with:
version: '1'
arch: ${{ runner.arch }}
if: steps.julia_in_path.outcome != 'success'
- name: "Add the General registry via Git"
run: |
import Pkg
ENV["JULIA_PKG_SERVER"] = ""
Pkg.Registry.add("General")
shell: julia --color=yes {0}
- name: "Install CompatHelper"
run: |
import Pkg
name = "CompatHelper"
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
version = "3"
Pkg.add(; name, uuid, version)
shell: julia --color=yes {0}
- name: "Run CompatHelper"
run: |
import CompatHelper
CompatHelper.main()
shell: julia --color=yes {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
# If we don't have a documenter key set up, we should configure a dedicated ssh deploy key `COMPATHELPER_PRIV` following https://juliaregistries.github.io/CompatHelper.jl/dev/#Creating-SSH-Key.
# Either way, we need an SSH key if we want the PRs that CompatHelper creates to be able to trigger CI workflows themselves.
# That is because GITHUB_TOKEN's can't trigger other workflows (see https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow).
# Check if you have a deploy key setup using these docs: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/reviewing-your-deploy-keys.
# COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}
156 changes: 156 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Migration Guide: Coverage.jl Modernization

This guide helps you migrate from the deprecated direct upload functionality to the new official uploader integration.

## What Changed?

Coverage.jl has been modernized to work with the official uploaders from Codecov and Coveralls, as both services have deprecated support for 3rd party uploaders.

### Before (Deprecated)
```julia
using Coverage
fcs = process_folder("src")
Codecov.submit(fcs) # Deprecated
Coveralls.submit(fcs) # Deprecated
```

### After (Modern)
```julia
using Coverage
fcs = process_folder("src")

# Option 1: Use automated upload (recommended)
process_and_upload(service=:both, folder="src")

# Option 2: Prepare data for manual upload
codecov_file = prepare_for_codecov(fcs, format=:lcov)
coveralls_file = prepare_for_coveralls(fcs, format=:lcov)
```

## Migration Steps

### 1. For CI Environments (GitHub Actions, Travis, etc.)

**Option A: Use the automated helper (easiest)**

```julia
using Coverage
process_and_upload(service=:both, folder="src")
```

**Option B: Use official uploaders directly**
```yaml
# GitHub Actions example
- name: Process coverage to LCOV
run: |
julia -e '
using Pkg; Pkg.add("Coverage")
using Coverage, Coverage.LCOV
coverage = process_folder("src")
LCOV.writefile("coverage.info", coverage)
'

- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.info
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload to Coveralls
uses: coverallsapp/github-action@v2
with:
files: ./coverage.info
```

### 2. For Local Development

```julia
using Coverage

# Process and upload
fcs = process_folder("src")
upload_to_codecov(fcs; token="your_token", dry_run=true) # Test first
upload_to_codecov(fcs; token="your_token") # Actual upload
```

### 3. Using Helper Scripts

```bash
# Upload to both services
julia scripts/upload_coverage.jl --folder src

# Upload only to Codecov
julia scripts/upload_coverage.jl --service codecov --flags julia

# Dry run to test
julia scripts/upload_coverage.jl --dry-run
```

## Available Functions

Coverage.jl now provides these functions directly:

### Coverage Processing and Upload
- `process_and_upload()` - One-stop function for processing and uploading
- `upload_to_codecov()` - Upload to Codecov using official uploader
- `upload_to_coveralls()` - Upload to Coveralls using official reporter

### Data Export Functions
- `prepare_for_codecov()` - Export coverage in Codecov-compatible formats
- `prepare_for_coveralls()` - Export coverage in Coveralls-compatible formats
- `export_codecov_json()` - Export to JSON format
- `export_coveralls_json()` - Export to JSON format

### Utility Functions
- `detect_platform()` - Detect current platform

## Environment Variables

The modern upload functions use these environment variables:

| Variable | Service | Description |
|----------|---------|-------------|
| `CODECOV_TOKEN` | Codecov | Repository token for Codecov |
| `COVERALLS_REPO_TOKEN` | Coveralls | Repository token for Coveralls |

**Note**: Legacy environment variables `CODECOV_FLAGS` and `CODECOV_NAME` are only supported by the deprecated `Codecov.submit()` functions, not the modern `upload_to_codecov()` function. Use function parameters instead.

## Supported Formats

- **LCOV** (`.info`) - Recommended, supported by both services
- **JSON** - Native format for each service

## Platform Support

The modernized Coverage.jl automatically downloads the appropriate uploader for your platform:
- **Linux** (x64, ARM64)
- **macOS** (x64, ARM64)
- **Windows** (x64)

## Troubleshooting

### Deprecation Warnings
If you see deprecation warnings, update your code:

```julia
# Old
Codecov.submit(fcs)

# New
upload_to_codecov(fcs)
```

### Missing Tokens
Set environment variables or pass tokens explicitly:
```bash
export CODECOV_TOKEN="your_token"
export COVERALLS_REPO_TOKEN="your_token"
```

### CI Platform Not Detected
The modern uploaders handle CI detection automatically. If needed, you can force CI parameters:
```julia
upload_to_codecov(fcs; token="manual_token")
```

For more examples, see the `examples/ci/` directory.
15 changes: 12 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
name = "Coverage"
uuid = "a2441757-f6aa-5fb2-8edb-039e3f45d037"
version = "1.7.0"
authors = ["Iain Dunning <[email protected]>", "contributors"]
version = "1.6.1"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
CoverageTools = "c36e975a-824b-4404-a568-ef97ca766997"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
MbedTLS = "739be429-bea8-5141-9913-cc70e7f3736d"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"

[compat]
ArgParse = "1"
Artifacts = "1"
CoverageTools = "1"
Downloads = "1.6.0"
HTTP = "0.8, 0.9, 1"
JSON = "0.21"
MbedTLS = "0.6, 0.7, 1"
SHA = "0.7.0"
Scratch = "1"
julia = "1"

[extras]
CoverageTools = "c36e975a-824b-4404-a568-ef97ca766997"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["CoverageTools", "Test"]
test = ["Test"]
Loading
Loading