Skip to content
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

New lts update. Format. Fix tests. #55

Merged
merged 3 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 59 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,37 +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.9'
- '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: x86
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 @@ -44,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 }}
23 changes: 19 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
name = "Bibliography"
uuid = "f1be7e48-bf82-45af-a471-ae754a193061"
authors = ["azzaare <[email protected]>"]
version = "0.2.20"
version = "0.2.21"

[deps]
BibInternal = "2027ae74-3657-4b95-ae00-e2f7d55c3e64"
BibParser = "13533e5b-e1c2-4e57-8cef-cac5e52f6474"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"

[compat]
BibInternal = "0.3.3"
BibParser = "0.2.1"
BibInternal = "0.3.7"
BibParser = "0.2.2"
DataStructures = "0.18"
Dates = "1"
FileIO = "1"
TestItems = "1"
YAML = "0.4"
julia = "1.6"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"

[targets]
test = ["Aqua", "ExplicitImports", "FileIO", "JET", "ReferenceTests", "Test", "TestItemRunner"]
27 changes: 27 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[default]
extend-ignore-re = [
"iMatix"
]

[files]
extend-exclude = ["*.bib"]

[default.extend-words]
annote = "annote"
inbrace = "inbrace"
BA = "BA"
FO = "FO"
ND = "ND"

[default.extend-identifiers]
"CC-BY-NC-ND-1.0" = "CC-BY-NC-ND-1.0"
"CC-BY-NC-ND-2.0" = "CC-BY-NC-ND-2.0"
"CC-BY-NC-ND-2.5" = "CC-BY-NC-ND-2.5"
"CC-BY-NC-ND-3.0" = "CC-BY-NC-ND-3.0"
"CC-BY-NC-ND-3.0-IGO" = "CC-BY-NC-ND-3.0-IGO"
"CC-BY-NC-ND-4.0" = "CC-BY-NC-ND-4.0"
"CC-BY-ND-1.0" = "CC-BY-ND-1.0"
"CC-BY-ND-2.0" = "CC-BY-ND-2.0"
"CC-BY-ND-2.5" = "CC-BY-ND-2.5"
"CC-BY-ND-3.0" = "CC-BY-ND-3.0"
"CC-BY-ND-4.0" = "CC-BY-ND-4.0"
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, Bibliography, BibParser, BibInternal
makedocs(
sitename = "Bibliography.jl",
authors = "Jean-François BAFFIER",
repo="https://github.com/Humans-of-Julia/Bibliography.jl/blob/{commit}{path}#L{line}",
repo = "https://github.com/Humans-of-Julia/Bibliography.jl/blob/{commit}{path}#L{line}",
format = Documenter.HTML(
prettyurls = get(ENV, "CI", nothing) == "true"
),
Expand Down
6 changes: 4 additions & 2 deletions src/bibtex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Import a BibTeX file or parse a BibTeX string and convert it to the internal bib
The `check` keyword argument can be set to `:none` (or `nothing`), `:warn`, or `:error` to raise appropriate logs.
"""
function import_bibtex(input; check = :error)
return isfile(input) ? BibParser.parse_file(input; check) : BibParser.parse_entry(input; check)
return isfile(input) ? BibParser.parse_file(input; check) :
BibParser.parse_entry(input; check)
end

"""
Expand All @@ -14,7 +15,7 @@ Make a string of `n` spaces.
"""
int_to_spaces(n) = repeat(" ", n)

const spaces = Dict{String,String}(
const spaces = Dict{String, String}(
map(s -> (string(s) => int_to_spaces(BibInternal.space(s))), BibInternal.fields)
)

Expand Down Expand Up @@ -126,6 +127,7 @@ function export_bibtex(e::Entry)
e.fields["editor"] = names_to_strings(e.editors)
eprint_to_bibtex!(e.fields, e.eprint)
in_to_bibtex!(e.fields, e.in)
e.fields["note"] = e.note
e.fields["title"] = e.title

str = "@$(e.type == "eprint" ? "misc" : e.type){$(e.id),\n"
Expand Down
Loading
Loading