Skip to content

Commit

Permalink
CI: migrate from Bors to GitHub Merge Queue; also, refactor some code…
Browse files Browse the repository at this point in the history
…, and add some more unit tests (#477)

* Run the integration tests on the `merge_group` event

* Run the unit tests on the `merge_group` event

* Delete `bors.toml` (the Bors config file)

* CompatHelper's own Project.toml: add compat entries for our own test deps (#478)

* Update .github/workflows/ci_integration.yml

Co-authored-by: mattBrzezinski <matt.brzezinski@invenia.ca>

* Update ci_integration.yml

* Upload code coverage from the unit tests

* Integration tests: immediately error if this is a PR build

* Mark the integration tests as "skipped" on PR builds (#479)

* Simplify the job name of the integration tests job

This is necessary because the `${{ matrix... }}` interpolations are not evaluated for skipped jobs

* Do some debugging

* Revert the debugging commit

* Don't use a matrix for the integration test job

* Do some debugging

* Revert the debugging commit

* Delete some commented-out lines

* Fix a comment

* add codecov threshold (#480)

* add codecov threshold

to help with #477

* Update codecov.yml

* fix indentation

* Update codecov.yml

* Update codecov.yml

* Apply suggestions from code review

Co-authored-by: Dilum Aluthge <dilum@aluthge.com>

* Update codecov.yml

* try to make two settings exclusive

* Refactor some code, and increase the unit test code coverage for `src/main.jl` (#481)

* Revert the changes to `codecov.yml` (#482)

* Lower Codecov threshold to 99% because of GitHub Merge Queue limitations (#484)

---------

Co-authored-by: Eric Hanson <5846501+ericphanson@users.noreply.github.com>
Co-authored-by: mattBrzezinski <matt.brzezinski@invenia.ca>
  • Loading branch information
3 people committed Jan 8, 2024
1 parent 184c654 commit 3190305
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 45 deletions.
27 changes: 10 additions & 17 deletions .github/workflows/ci_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,28 @@ name: CI (integration tests)
# GitHub's abuse rate limits.

on:
merge_group: # GitHub merge queue
pull_request: # but we will skip the integration tests on PR builds, to avoid hitting rate limits
push:
branches:
- master
- staging
- trying
concurrency:
group: integration-tests-global-lock
cancel-in-progress: false
jobs:
integration:
if: github.event_name == 'push'
name: Integration/Julia ${{ matrix.version }}/${{ matrix.os }}/${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
fail-fast: true
matrix:
arch:
- x64
os:
- ubuntu-latest
version:
- '1'
# We don't actually want to run integration tests on pull requests,
# because we want to avoid hitting rate limits.
# So, if this is a PR build, mark the integration tests as "skipped".
if: github.event_name != 'pull_request'
name: Integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
version: '1'
arch: x64
- uses: actions/cache@v3
env:
cache-name: cache-artifacts
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ci_unit.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: CI (unit tests)
on:
merge_group: # GitHub merge queue
pull_request:
push:
branches:
- master
- staging
- trying
tags: '*'
workflow_dispatch:
jobs:
Expand Down Expand Up @@ -44,6 +43,11 @@ jobs:
- uses: julia-actions/julia-runtest@v1
env:
COMPATHELPER_RUN_INTEGRATION_TESTS: "false"
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
file: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
documentation:
name: Documentation
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[compat]
Aqua = "0.8"
Base64 = "1"
Dates = "1"
GitForge = "0.4"
Mocking = "0.7"
MultilineStrings = "0.1"
Pkg = "1"
Random = "<0.0.1, 1"
RegistryInstances = "0.1"
SHA = "0.7, 1"
TOML = "1"
Test = "<0.0.1, 1"
TimeZones = "1"
UUIDs = "1"
julia = "1.6"
Expand Down
20 changes: 0 additions & 20 deletions bors.toml

This file was deleted.

8 changes: 7 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ coverage:
default:
target: auto
minimum:
target: "100%"
# We want to enforce 100%.
# The Unit Tests + Integration Tests hit 100%.
# But the Unit Tests alone only hit 99.49%.
# And so, because of GitHub Merge Queue limitations,
# we need to set this threshold to 99%.
# target: "100%"
target: "99%"
10 changes: 10 additions & 0 deletions src/dependencies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,13 @@ function get_latest_version_from_registries!(

return deps
end

function populate_dep_versions_from_reg!(deps; options)
if options.use_existing_registries
get_existing_registries!(deps, options.depot; options)
else
get_latest_version_from_registries!(deps, options.registries; options)
end

return nothing
end
6 changes: 1 addition & 5 deletions src/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ function main(
project_file = @mock joinpath(local_clone_path, subdir, "Project.toml")
deps = get_project_deps(project_file; include_jll=options.include_jll)

if options.use_existing_registries
get_existing_registries!(deps, options.depot; options)
else
get_latest_version_from_registries!(deps, options.registries; options)
end
populate_dep_versions_from_reg!(deps; options)

for dep in deps
pr = @mock make_pr_for_new_version(
Expand Down
32 changes: 32 additions & 0 deletions test/dependencies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,35 @@ end
end
end
end

@testset "populate_dep_versions_from_reg!" begin
# For this test, we will just use CompatHelper's own `Project.toml` file.
project_file = joinpath(pkgdir(CompatHelper), "Project.toml")

# Just for this test, we hardcode this list
unregistered_stdlibs = [
"Base64",
"Dates",
"Pkg",
"UUIDs",
]

@test ispath(project_file)
@test isfile(project_file)
for use_existing_registries in [true, false]
options = CompatHelper.Options(;
use_existing_registries,
)
deps = CompatHelper.get_project_deps(project_file)
for dep in deps
@test dep.latest_version === nothing
end
CompatHelper.populate_dep_versions_from_reg!(deps; options)
for dep in deps
if !(dep.package.name in unregistered_stdlibs)
@test dep.latest_version isa VersionNumber
@test dep.latest_version > v"0"
end
end
end
end

0 comments on commit 3190305

Please sign in to comment.