Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
39 changes: 18 additions & 21 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,7 +35,7 @@ jobs:
arch: x64
- version: '1'
os: macos-latest
arch: x64
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
Expand All @@ -44,21 +44,18 @@ jobs:
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
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 }}
with:
coverage: true
# Upload coverage using the modernized Coverage.jl
- name: Upload coverage
if: matrix.version == '1' && matrix.os == 'ubuntu-latest' && matrix.arch == 'x64'
run: |
julia --color=yes --project=. -e '
using Coverage, Coverage.CIIntegration
try
# Test the modernized upload functionality
process_and_upload(service=:both, folder="src", dry_run=true)
catch e
@warn "Coverage upload test failed" exception=e
end
'
48 changes: 41 additions & 7 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,50 @@
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()'
# This repo uses Documenter, so we can reuse our [Documenter SSH key](https://documenter.juliadocs.org/stable/man/hosting/walkthrough/).
# If we didn't have one of those setup, we could 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)
using Coverage.CIIntegration
process_and_upload(service=:both, folder="src")

# Option 2: Prepare data for manual upload
using Coverage.CodecovExport, Coverage.CoverallsExport
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, Coverage.CIIntegration
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, Coverage.CIIntegration

# 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
```

## New Modules

### Coverage.CodecovExport
- `prepare_for_codecov()` - Export coverage in Codecov-compatible formats
- `download_codecov_uploader()` - Download official Codecov uploader
- `export_codecov_json()` - Export to JSON format

### Coverage.CoverallsExport
- `prepare_for_coveralls()` - Export coverage in Coveralls-compatible formats
- `download_coveralls_reporter()` - Download Universal Coverage Reporter
- `export_coveralls_json()` - Export to JSON format

### Coverage.CIIntegration
- `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
- `detect_ci_platform()` - Detect current CI environment

## Environment Variables

| Variable | Service | Description |
|----------|---------|-------------|
| `CODECOV_TOKEN` | Codecov | Repository token for Codecov |
| `COVERALLS_REPO_TOKEN` | Coveralls | Repository token for Coveralls |
| `CODECOV_FLAGS` | Codecov | Comma-separated flags |
| `CODECOV_NAME` | Codecov | Upload name |

## Supported Formats

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

## 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
using Coverage.CIIntegration
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.
11 changes: 8 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
name = "Coverage"
uuid = "a2441757-f6aa-5fb2-8edb-039e3f45d037"
authors = ["Iain Dunning <[email protected]>", "contributors"]
version = "1.6.1"
version = "1.7.0"

[deps]
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"

[compat]
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"
julia = "1"

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

[targets]
test = ["CoverageTools", "Test"]
test = ["Test"]
65 changes: 55 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,67 @@
Coverage.jl
===========

---

> [!WARNING]
> **WARNING: codecov and coveralls no longer support 3rd party uploaders (such as this one). You must use their official uploaders. You can still use CoverageTools (re-exported by this package) to pre-process the files however.**
>
> * <https://docs.codecov.com/docs/codecov-uploader>
> * <https://docs.coveralls.io/integrations#universal-coverage-reporter>

---

[![Build Status](https://github.com/JuliaCI/Coverage.jl/workflows/CI/badge.svg)](https://github.com/JuliaCI/Coverage.jl/actions/workflows/CI.yml?query=branch%3Amaster)
[![coveralls](https://coveralls.io/repos/github/JuliaCI/Coverage.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaCI/Coverage.jl?branch=master)
[![codecov](https://codecov.io/gh/JuliaCI/Coverage.jl/branch/master/graph/badge.svg?label=codecov)](https://codecov.io/gh/JuliaCI/Coverage.jl)

**"Take Julia code coverage and memory allocation results, do useful things with them"**

**Coverage.jl has been modernized** to work with the official uploaders from Codecov and Coveralls.
The package now provides:
- 🔄 **Coverage data processing** using CoverageTools.jl
- 📤 **Export functionality** for official uploaders
- 🚀 **Automated upload helpers** for CI environments
- 📋 **Helper scripts** for easy integration

> [!IMPORTANT]
> **Codecov and Coveralls have deprecated 3rd party uploaders.** Coverage.jl now integrates with their official uploaders while maintaining the same easy-to-use interface for Julia projects.
>
> **Migration required:** See [MIGRATION.md](MIGRATION.md) for upgrading from the old `Codecov.submit()` and `Coveralls.submit()` functions.

## Quick Start

### Automated Upload (Recommended)

```julia
using Coverage, Coverage.CIIntegration

# Process and upload to both services
process_and_upload(service=:both, folder="src")

# Or just one service
process_and_upload(service=:codecov, folder="src")
```

### Manual Export + Official Uploaders

```julia
using Coverage, Coverage.LCOV

# Process coverage
coverage = process_folder("src")

# Export to LCOV format
LCOV.writefile("coverage.info", coverage)

# Use with official uploaders in CI
# Codecov: Upload via codecov/codecov-action@v3
# Coveralls: Upload via coverallsapp/github-action@v2
```

### Using Helper Scripts

```bash
# Universal upload script
julia scripts/upload_coverage.jl --service both --folder src

# Codecov only
julia scripts/upload_codecov.jl --folder src --flags julia

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

**Code coverage**: Julia can track how many times, if any, each line of your code is run. This is useful for measuring how much of your code base your tests actually test, and can reveal the parts of your code that are not tested and might be hiding a bug. You can use Coverage.jl to summarize the results of this tracking, or to send them to a service like [Coveralls.io](https://coveralls.io) or [Codecov.io](https://codecov.io/github/JuliaCI).

**Memory allocation**: Julia can track how much memory is allocated by each line of your code. This can reveal problems like type instability, or operations that you might have thought were cheap (in terms of memory allocated) but aren't (i.e. accidental copying).
Expand Down
4 changes: 0 additions & 4 deletions etc/travis-coverage.jl

This file was deleted.

Loading
Loading