Skip to content

Commit

Permalink
Merge pull request #27 from Humans-of-Julia/lts
Browse files Browse the repository at this point in the history
Release for new Julia LTS. Extended tests: Aqua, Jet, ExplicitImport, TestRunner
  • Loading branch information
Azzaare authored Nov 1, 2024
2 parents 38affbd + 4f22c13 commit cea8645
Show file tree
Hide file tree
Showing 22 changed files with 361 additions and 177 deletions.
1 change: 1 addition & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
style = "sciml"
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
41 changes: 34 additions & 7 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
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@v1
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 }}
COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} # optional
run: julia -e 'using CompatHelper; CompatHelper.main()'
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
15 changes: 15 additions & 0 deletions .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Spell Check

on: [pull_request]

jobs:
typos-check:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/[email protected]
with:
config: ./_typos.toml
18 changes: 17 additions & 1 deletion .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ on:
types:
- created
workflow_dispatch:
inputs:
lookback:
default: "3"
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
Expand All @@ -12,4 +28,4 @@ jobs:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
ssh: ${{ secrets.DOCUMENTER_KEY }}
74 changes: 60 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,81 @@
name: CI
on:
- push
- pull_request
pull_request:
branches:
- master
- dev
paths-ignore:
- "docs/**"
push:
branches:
- master
paths-ignore:
- "docs/**"
jobs:
formatter:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v4
- name: Install JuliaFormatter and format
# This will use the latest version by default but you can set the version like so:
#
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="1.0.50"))'
julia -e 'using JuliaFormatter; format(".", verbose=true)'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.6'
- '1.7'
- 'nightly'
- "lts"
- "1"
- "pre"
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
- x86
exclude:
include:
# test macOS and Windows with latest Julia only
- os: macOS-latest
arch: x64
version: 1
- os: windows-latest
arch: x64
version: 1
- os: windows-latest
arch: x86
version: 1
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
Expand All @@ -42,15 +88,15 @@ jobs:
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v4
with:
file: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: "1"
- run: |
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/register.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Register Package
on:
workflow_dispatch:
inputs:
version:
description: Version to register or component to bump
required: true
jobs:
register:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: julia-actions/RegisterAction@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
18 changes: 16 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
name = "BibInternal"
uuid = "2027ae74-3657-4b95-ae00-e2f7d55c3e64"
authors = ["azzaare"]
version = "0.3.6"
version = "0.3.7"

[deps]
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"

[compat]
julia = "1.6"
TestItems = "1"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"

[targets]
test = ["Aqua", "ExplicitImports", "JET", "Test", "TestItemRunner"]
3 changes: 3 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[default.extend-words]
# Don't correct the surname "Teh"
annote = "annote"
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Documenter, BibInternal
makedocs(
sitename = "BibInternal.jl",
authors = "Jean-François BAFFIER",
repo="https://github.com/Humans-of-Julia/BibInternal.jl/blob/{commit}{path}#L{line}",
repo = "https://github.com/Humans-of-Julia/BibInternal.jl/blob/{commit}{path}#L{line}",
format = Documenter.HTML(
prettyurls = get(ENV, "CI", nothing) == "true"
),
Expand Down
31 changes: 17 additions & 14 deletions src/BibInternal.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
module BibInternal

"""
Abstract entry supertype.
"""
abstract type AbstractEntry end

# Includes
include("constant.jl")
include("utilities.jl")
include("bibtex.jl")
include("entry.jl")

end # module
module BibInternal

"""
Abstract entry supertype.
"""
abstract type AbstractEntry end

# Imports
import TestItems: @testitem

# Includes
include("constant.jl")
include("utilities.jl")
include("bibtex.jl")
include("entry.jl")

end # module
48 changes: 22 additions & 26 deletions src/bibtex.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Required = Union{String,Tuple{String,String}}
const Required = Union{String, Tuple{String, String}}

"""
const rules = Dict([
Expand All @@ -19,24 +19,21 @@ const Required = Union{String,Tuple{String,String}}
])
List of BibTeX rules bases on the entry type. A field value as a singleton represents a required field. A pair of values represents mutually exclusive required fields.
"""
const rules = Dict{String,Vector{Required}}(
[
"article" => ["author", "journal", "title", "year"]
"book" => [("author", "editor"), "publisher", "title", "year"]
"booklet" => ["title"]
"eprint" => ["author", "eprint", "title", "year"]
"inbook" =>
[("author", "editor"), ("chapter", "pages"), "publisher", "title", "year"]
"incollection" => ["author", "booktitle", "publisher", "title", "year"]
"inproceedings" => ["author", "booktitle", "title", "year"]
"manual" => ["title"]
"mastersthesis" => ["author", "school", "title", "year"]
"misc" => []
"phdthesis" => ["author", "school", "title", "year"]
"proceedings" => ["title", "year"]
"techreport" => ["author", "institution", "title", "year"]
"unpublished" => ["author", "note", "title"]
],
const rules = Dict{String, Vector{Required}}(
["article" => ["author", "journal", "title", "year"]
"book" => [("author", "editor"), "publisher", "title", "year"]
"booklet" => ["title"]
"eprint" => ["author", "eprint", "title", "year"]
"inbook" => [("author", "editor"), ("chapter", "pages"), "publisher", "title", "year"]
"incollection" => ["author", "booktitle", "publisher", "title", "year"]
"inproceedings" => ["author", "booktitle", "title", "year"]
"manual" => ["title"]
"mastersthesis" => ["author", "school", "title", "year"]
"misc" => []
"phdthesis" => ["author", "school", "title", "year"]
"proceedings" => ["title", "year"]
"techreport" => ["author", "institution", "title", "year"]
"unpublished" => ["author", "note", "title"]],
)

"""
Expand All @@ -56,15 +53,15 @@ function check_entry(fields, check, id)

for t_field in get(rules, entry_type, Vector{Required}())
at_least_one = false
if typeof(t_field) == Tuple{String,String}
if typeof(t_field) == Tuple{String, String}
for field in t_field
if get(fields, field, "") != ""
at_least_one = true
break
end
end
if !at_least_one
s = foldl((x, y) -> "$x$y", t_field; init="")
s = foldl((x, y) -> "$x$y", t_field; init = "")
# To remove the starting `≡`, we need `nextind` as it is a
# multibyte character
push!(errors, "{" * s[nextind(s, 1):end] * "}")
Expand All @@ -81,15 +78,14 @@ end
make_bibtex_entry(id::String, fields::Fields)
Make an entry if the entry follows the BibTeX guidelines. Throw an error otherwise.
"""
function make_bibtex_entry(id, fields; check=:error)
function make_bibtex_entry(id, fields; check = :error)
# @info id fields
fields = Dict(lowercase(k) => v for (k, v) in fields) # lowercase tag names
errors = check_entry(fields, check, id)
if length(errors) > 0 && check [:error, :warn]
message =
"Entry $id is missing the " *
foldl(((x, y) -> x * ", " * y), errors) *
" field(s)."
message = "Entry $id is missing the " *
foldl(((x, y) -> x * ", " * y), errors) *
" field(s)."
check == :error ? (@error message) : (@warn message)
end
return Entry(id, fields)
Expand Down
Loading

0 comments on commit cea8645

Please sign in to comment.