-
Notifications
You must be signed in to change notification settings - Fork 65
Modernize #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+2,354
−94
Merged
Modernize #349
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
b613503
modernize
IanButterworth 96f5a84
fix
IanButterworth 85f072e
fix valid copilot suggestions
IanButterworth d1ef9f2
windows fixes
IanButterworth f00e2f4
add back required macos x64 CI
IanButterworth 6796695
Implement feedback: add architecture support, fix compatibility, impr…
IanButterworth 29fc009
fix CompatHelper private key
IanButterworth 6d952e5
Use ArgParse. Simplify module structure
IanButterworth 590ee3d
more DRY
IanButterworth a59cbee
fix
IanButterworth 3de66a9
upload coverage on all runs
IanButterworth b4d0c37
fixes
IanButterworth 2df5507
try setting up PR comments
IanButterworth 0c9c436
actually run upload
IanButterworth 51a9f98
fix error detection
IanButterworth 4b648bd
try adding secrets
IanButterworth a11c464
rm unused stuff
IanButterworth a330636
fix coveralls secret
IanButterworth a3579fc
rm unused. increase coverage
IanButterworth 23c6d12
rm unused
IanButterworth 525ee69
absorb stub files
IanButterworth 0e2090e
support coveralls parallel jobs
IanButterworth 79f05e0
capture some test logs
IanButterworth f5c2661
add build_num because coveralls parallel requires it
IanButterworth 0979d0d
install brew locally
vtjnash 38c64f4
try system homebrew before installing local version
IanButterworth dfd2675
try controlling local homebrew further on limited CI machines
IanButterworth eb14afc
fix
IanButterworth 4a489fb
macOS: move from homebrew to github.com/vtjnash/coveralls-macos-binaries
IanButterworth d321597
set SSL_CERT_FILE and SSL_CA_BUNDLE
IanButterworth b1b46cb
update macos binaries to remove version
IanButterworth 708cada
use withenv instead
IanButterworth a886106
add note about where binaries come from
IanButterworth 18bc1d3
docs tweaks
IanButterworth 719fd82
de-emoji
IanButterworth bdd667b
fix
IanButterworth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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 }} |
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
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. |
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
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"] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.