Clean up Travis configs and temp name generation

This commit is contained in:
Chris de Graaf 2019-11-01 11:45:55 +07:00
parent 5a8934350c
commit aaa1f5280c
No known key found for this signature in database
GPG Key ID: 150FFDD9B0073C7B
7 changed files with 51 additions and 55 deletions

View File

@ -19,11 +19,7 @@ matrix:
- julia: 1.3 - julia: 1.3
- julia: nightly - julia: nightly
include: include:
- os: linux - arch: x86
arch: x86
julia: 1.0
- os: windows
arch: x86
julia: 1.0 julia: 1.0
- stage: Documentation - stage: Documentation
julia: 1.0 julia: 1.0

View File

@ -29,8 +29,9 @@ end
linux=true, linux=true,
osx=true, osx=true,
windows=true, windows=true,
x64=true,
x86=false, x86=false,
arm=false, arm64=false,
coverage=true, coverage=true,
extra_versions=$DEFAULT_CI_VERSIONS, extra_versions=$DEFAULT_CI_VERSIONS,
) )
@ -42,9 +43,9 @@ Integrates your packages with [Travis CI](https://travis-ci.com).
- `linux::Bool`: Whether or not to run builds on Linux. - `linux::Bool`: Whether or not to run builds on Linux.
- `osx::Bool`: Whether or not to run builds on OSX (MacOS). - `osx::Bool`: Whether or not to run builds on OSX (MacOS).
- `windows::Bool`: Whether or not to run builds on Windows. - `windows::Bool`: Whether or not to run builds on Windows.
- `x86::Bool`: Whether or not to run builds on 32-bit systems, - `x64::Bool`: Whether or not to run builds on 64-bit architecture.
in addition to the default 64-bit builds. - `x86::Bool`: Whether or not to run builds on 32-bit architecture.
- `arm::Bool`: Whether or not to run builds on the ARM architecture, in addition to AMD64. - `arm64::Bool`: Whether or not to run builds on the ARM64 architecture.
- `coverage::Bool`: Whether or not to publish code coverage. - `coverage::Bool`: Whether or not to publish code coverage.
Another code coverage plugin such as [`Codecov`](@ref) must also be included. Another code coverage plugin such as [`Codecov`](@ref) must also be included.
$EXTRA_VERSIONS_DOC $EXTRA_VERSIONS_DOC
@ -54,8 +55,9 @@ $EXTRA_VERSIONS_DOC
linux::Bool = true linux::Bool = true
osx::Bool = true osx::Bool = true
windows::Bool = true windows::Bool = true
x64::Bool = true
x86::Bool = false x86::Bool = false
arm::Bool = false arm64::Bool = false
coverage::Bool = true coverage::Bool = true
extra_versions::Vector = DEFAULT_CI_VERSIONS extra_versions::Vector = DEFAULT_CI_VERSIONS
end end
@ -70,41 +72,34 @@ badges(::TravisCI) = Badge(
) )
function view(p::TravisCI, t::Template, pkg::AbstractString) function view(p::TravisCI, t::Template, pkg::AbstractString)
os = String[] os = filter(o -> getfield(p, Symbol(o)), ["linux", "osx", "windows"])
p.linux && push!(os, "linux") arch = filter(a -> getfield(p, Symbol(a)), ["x64", "x86", "arm64"])
p.osx && push!(os, "osx")
p.windows && push!(os, "windows")
versions = collect_versions(t, p.extra_versions) versions = collect_versions(t, p.extra_versions)
allow_failures = filter(in(versions), ALLOWED_FAILURES) allow_failures = filter(in(versions), ALLOWED_FAILURES)
jobs = Dict{String, String}[] excludes = Dict{String, String}[]
if p.x86 p.x86 && p.osx && push!(excludes, Dict("E_OS" => "osx", "E_ARCH" => "x86"))
foreach(versions) do v if p.arm64
p.linux && push!(jobs, Dict("JULIA" => v, "OS" => "linux", "ARCH" => "x86")) p.osx && push!(excludes, Dict("E_OS" => "osx", "E_ARCH" => "arm64"))
p.windows && push!(jobs, Dict("JULIA" => v, "OS" => "windows", "ARCH" => "x86")) p.windows && push!(excludes, Dict("E_OS" => "windows", "E_ARCH" => "arm64"))
end "nightly" in versions && push!(excludes, Dict("E_JULIA" => "nightly", "E_ARCH" => "arm64"))
end
if p.arm
foreach(versions) do v
p.linux && push!(jobs, Dict("JULIA" => v, "OS" => "linux", "ARCH" => "arm64"))
end
end end
return Dict( return Dict(
"ALLOW_FAILURES" => allow_failures, "ALLOW_FAILURES" => allow_failures,
"ARCH" => arch,
"EXCLUDES" => excludes,
"HAS_ALLOW_FAILURES" => !isempty(allow_failures), "HAS_ALLOW_FAILURES" => !isempty(allow_failures),
"HAS_CODECOV" => hasplugin(t, Codecov), "HAS_CODECOV" => hasplugin(t, Codecov),
"HAS_COVERAGE" => p.coverage && hasplugin(t, is_coverage), "HAS_COVERAGE" => p.coverage && hasplugin(t, is_coverage),
"HAS_COVERALLS" => hasplugin(t, Coveralls), "HAS_COVERALLS" => hasplugin(t, Coveralls),
"HAS_DOCUMENTER" => hasplugin(t, Documenter{TravisCI}), "HAS_DOCUMENTER" => hasplugin(t, Documenter{TravisCI}),
"HAS_JOBS" => !isempty(jobs) || hasplugin(t, Documenter{TravisCI}), "HAS_EXCLUDES" => !isempty(excludes),
"OS" => os, "OS" => os,
"PKG" => pkg, "PKG" => pkg,
"USER" => t.user, "USER" => t.user,
"VERSION" => format_version(t.julia), "VERSION" => format_version(t.julia),
"VERSIONS" => versions, "VERSIONS" => versions,
"JOBS" => jobs,
) )
end end

View File

@ -10,6 +10,10 @@ os:
{{#OS}} {{#OS}}
- {{{.}}} - {{{.}}}
{{/OS}} {{/OS}}
arch:
{{#ARCH}}
- {{{.}}}
{{/ARCH}}
jobs: jobs:
fast_finish: true fast_finish: true
{{#HAS_ALLOW_FAILURES}} {{#HAS_ALLOW_FAILURES}}
@ -18,15 +22,20 @@ jobs:
{{#ALLOW_FAILURES}} {{#ALLOW_FAILURES}}
- julia: {{{.}}} - julia: {{{.}}}
{{/ALLOW_FAILURES}} {{/ALLOW_FAILURES}}
{{#HAS_JOBS}} {{#HAS_EXCLUDES}}
include: exclude:
{{/HAS_JOBS}} {{/HAS_EXCLUDES}}
{{#JOBS}} {{#EXCLUDES}}
- julia: {{{JULIA}}} - arch: {{{E_ARCH}}}
os: {{{OS}}} {{#E_OS}}
arch: {{{ARCH}}} os: {{{E_OS}}}
{{/JOBS}} {{/E_OS}}
{{#E_JULIA}}
julia: {{{E_JULIA}}}
{{/E_JULIA}}
{{/EXCLUDES}}
{{#HAS_DOCUMENTER}} {{#HAS_DOCUMENTER}}
include:
- stage: Documentation - stage: Documentation
julia: {{{VERSION}}} julia: {{{VERSION}}}
script: julia --project=docs -e ' script: julia --project=docs -e '

View File

@ -10,6 +10,8 @@ os:
- linux - linux
- osx - osx
- windows - windows
arch:
- x64
jobs: jobs:
fast_finish: true fast_finish: true
allow_failures: allow_failures:

View File

@ -8,18 +8,14 @@ julia:
os: os:
- linux - linux
- osx - osx
arch:
- x64
- x86
- arm64
jobs: jobs:
fast_finish: true fast_finish: true
include: exclude:
- julia: 1.1 - arch: x86
os: linux os: osx
arch: x86 - arch: arm64
- julia: 1.2 os: osx
os: linux
arch: x86
- julia: 1.1
os: linux
arch: arm64
- julia: 1.2
os: linux
arch: arm64

View File

@ -49,7 +49,7 @@ end
coverage=false, coverage=false,
windows=false, windows=false,
x86=true, x86=true,
arm=true, arm64=true,
extra_versions=["1.1"], extra_versions=["1.1"],
), ),
]) ])

View File

@ -2,7 +2,7 @@ using Base.Filesystem: contractuser, path_separator
using LibGit2: LibGit2, GitCommit, GitRemote, GitRepo using LibGit2: LibGit2, GitCommit, GitRemote, GitRepo
using Pkg: Pkg using Pkg: Pkg
using Random: Random using Random: Random, randstring
using Test: @test, @testset, @test_logs, @test_throws using Test: @test, @testset, @test_logs, @test_throws
using ReferenceTests: @test_reference using ReferenceTests: @test_reference
@ -19,10 +19,8 @@ Random.seed!(1)
# Creata a template that won't error because of a missing username. # Creata a template that won't error because of a missing username.
tpl(; kwargs...) = Template(; user=USER, kwargs...) tpl(; kwargs...) = Template(; user=USER, kwargs...)
const PKG = Ref("A") # Generate a random package name.
pkgname() = titlecase(randstring('A':'Z', 16))
# Generate an unused package name.
pkgname() = PKG[] *= "a"
# Create a randomly named package with a template, and delete it afterwards. # Create a randomly named package with a template, and delete it afterwards.
function with_pkg(f::Function, t::Template, pkg::AbstractString=pkgname()) function with_pkg(f::Function, t::Template, pkg::AbstractString=pkgname())