diff --git a/.travis.yml b/.travis.yml index a9fdc1c..a979400 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,11 +19,7 @@ matrix: - julia: 1.3 - julia: nightly include: - - os: linux - arch: x86 - julia: 1.0 - - os: windows - arch: x86 + - arch: x86 julia: 1.0 - stage: Documentation julia: 1.0 diff --git a/src/plugins/ci.jl b/src/plugins/ci.jl index 2b8dd63..7db08da 100644 --- a/src/plugins/ci.jl +++ b/src/plugins/ci.jl @@ -29,8 +29,9 @@ end linux=true, osx=true, windows=true, + x64=true, x86=false, - arm=false, + arm64=false, coverage=true, 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. - `osx::Bool`: Whether or not to run builds on OSX (MacOS). - `windows::Bool`: Whether or not to run builds on Windows. -- `x86::Bool`: Whether or not to run builds on 32-bit systems, - in addition to the default 64-bit builds. -- `arm::Bool`: Whether or not to run builds on the ARM architecture, in addition to AMD64. +- `x64::Bool`: Whether or not to run builds on 64-bit architecture. +- `x86::Bool`: Whether or not to run builds on 32-bit architecture. +- `arm64::Bool`: Whether or not to run builds on the ARM64 architecture. - `coverage::Bool`: Whether or not to publish code coverage. Another code coverage plugin such as [`Codecov`](@ref) must also be included. $EXTRA_VERSIONS_DOC @@ -54,8 +55,9 @@ $EXTRA_VERSIONS_DOC linux::Bool = true osx::Bool = true windows::Bool = true + x64::Bool = true x86::Bool = false - arm::Bool = false + arm64::Bool = false coverage::Bool = true extra_versions::Vector = DEFAULT_CI_VERSIONS end @@ -70,41 +72,34 @@ badges(::TravisCI) = Badge( ) function view(p::TravisCI, t::Template, pkg::AbstractString) - os = String[] - p.linux && push!(os, "linux") - p.osx && push!(os, "osx") - p.windows && push!(os, "windows") - + os = filter(o -> getfield(p, Symbol(o)), ["linux", "osx", "windows"]) + arch = filter(a -> getfield(p, Symbol(a)), ["x64", "x86", "arm64"]) versions = collect_versions(t, p.extra_versions) allow_failures = filter(in(versions), ALLOWED_FAILURES) - jobs = Dict{String, String}[] - if p.x86 - foreach(versions) do v - p.linux && push!(jobs, Dict("JULIA" => v, "OS" => "linux", "ARCH" => "x86")) - p.windows && push!(jobs, Dict("JULIA" => v, "OS" => "windows", "ARCH" => "x86")) - end - end - if p.arm - foreach(versions) do v - p.linux && push!(jobs, Dict("JULIA" => v, "OS" => "linux", "ARCH" => "arm64")) - end + excludes = Dict{String, String}[] + p.x86 && p.osx && push!(excludes, Dict("E_OS" => "osx", "E_ARCH" => "x86")) + if p.arm64 + p.osx && push!(excludes, Dict("E_OS" => "osx", "E_ARCH" => "arm64")) + p.windows && push!(excludes, Dict("E_OS" => "windows", "E_ARCH" => "arm64")) + "nightly" in versions && push!(excludes, Dict("E_JULIA" => "nightly", "E_ARCH" => "arm64")) end return Dict( "ALLOW_FAILURES" => allow_failures, + "ARCH" => arch, + "EXCLUDES" => excludes, "HAS_ALLOW_FAILURES" => !isempty(allow_failures), "HAS_CODECOV" => hasplugin(t, Codecov), "HAS_COVERAGE" => p.coverage && hasplugin(t, is_coverage), "HAS_COVERALLS" => hasplugin(t, Coveralls), "HAS_DOCUMENTER" => hasplugin(t, Documenter{TravisCI}), - "HAS_JOBS" => !isempty(jobs) || hasplugin(t, Documenter{TravisCI}), + "HAS_EXCLUDES" => !isempty(excludes), "OS" => os, "PKG" => pkg, "USER" => t.user, "VERSION" => format_version(t.julia), "VERSIONS" => versions, - "JOBS" => jobs, ) end diff --git a/templates/travis.yml b/templates/travis.yml index 64837ed..b6a0172 100644 --- a/templates/travis.yml +++ b/templates/travis.yml @@ -10,6 +10,10 @@ os: {{#OS}} - {{{.}}} {{/OS}} +arch: +{{#ARCH}} + - {{{.}}} +{{/ARCH}} jobs: fast_finish: true {{#HAS_ALLOW_FAILURES}} @@ -18,15 +22,20 @@ jobs: {{#ALLOW_FAILURES}} - julia: {{{.}}} {{/ALLOW_FAILURES}} -{{#HAS_JOBS}} - include: -{{/HAS_JOBS}} -{{#JOBS}} - - julia: {{{JULIA}}} - os: {{{OS}}} - arch: {{{ARCH}}} -{{/JOBS}} +{{#HAS_EXCLUDES}} + exclude: +{{/HAS_EXCLUDES}} +{{#EXCLUDES}} + - arch: {{{E_ARCH}}} + {{#E_OS}} + os: {{{E_OS}}} + {{/E_OS}} + {{#E_JULIA}} + julia: {{{E_JULIA}}} + {{/E_JULIA}} +{{/EXCLUDES}} {{#HAS_DOCUMENTER}} + include: - stage: Documentation julia: {{{VERSION}}} script: julia --project=docs -e ' diff --git a/test/fixtures/AllPlugins/.travis.yml b/test/fixtures/AllPlugins/.travis.yml index 91a26e3..9315112 100644 --- a/test/fixtures/AllPlugins/.travis.yml +++ b/test/fixtures/AllPlugins/.travis.yml @@ -10,6 +10,8 @@ os: - linux - osx - windows +arch: + - x64 jobs: fast_finish: true allow_failures: diff --git a/test/fixtures/WackyOptions/.travis.yml b/test/fixtures/WackyOptions/.travis.yml index 23e5a57..1b2d1ee 100644 --- a/test/fixtures/WackyOptions/.travis.yml +++ b/test/fixtures/WackyOptions/.travis.yml @@ -8,18 +8,14 @@ julia: os: - linux - osx +arch: + - x64 + - x86 + - arm64 jobs: fast_finish: true - include: - - julia: 1.1 - os: linux - arch: x86 - - julia: 1.2 - os: linux - arch: x86 - - julia: 1.1 - os: linux - arch: arm64 - - julia: 1.2 - os: linux - arch: arm64 + exclude: + - arch: x86 + os: osx + - arch: arm64 + os: osx diff --git a/test/reference.jl b/test/reference.jl index ac929d9..1aa8ac3 100644 --- a/test/reference.jl +++ b/test/reference.jl @@ -49,7 +49,7 @@ end coverage=false, windows=false, x86=true, - arm=true, + arm64=true, extra_versions=["1.1"], ), ]) diff --git a/test/runtests.jl b/test/runtests.jl index eebc326..aab362f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,7 +2,7 @@ using Base.Filesystem: contractuser, path_separator using LibGit2: LibGit2, GitCommit, GitRemote, GitRepo using Pkg: Pkg -using Random: Random +using Random: Random, randstring using Test: @test, @testset, @test_logs, @test_throws using ReferenceTests: @test_reference @@ -19,10 +19,8 @@ Random.seed!(1) # Creata a template that won't error because of a missing username. tpl(; kwargs...) = Template(; user=USER, kwargs...) -const PKG = Ref("A") - -# Generate an unused package name. -pkgname() = PKG[] *= "a" +# Generate a random package name. +pkgname() = titlecase(randstring('A':'Z', 16)) # Create a randomly named package with a template, and delete it afterwards. function with_pkg(f::Function, t::Template, pkg::AbstractString=pkgname())