-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
406 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env julia | ||
# | ||
# This is an adapted version of format.jl from JuliaFormatter with the | ||
# following license: | ||
# | ||
# MIT License | ||
# Copyright (c) 2019 Dominique Luna | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a | ||
# copy of this software and associated documentation files (the | ||
# "Software"), to deal in the Software without restriction, including | ||
# without limitation the rights to use, copy, modify, merge, publish, | ||
# distribute, sublicense, and/or sell copies of the Software, and to permit | ||
# persons to whom the Software is furnished to do so, subject to the | ||
# following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included | ||
# in all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
# USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
using Pkg | ||
Pkg.activate(@__DIR__) | ||
Pkg.instantiate() | ||
|
||
using JuliaFormatter | ||
|
||
include("clima_formatter_options.jl") | ||
|
||
help = """ | ||
Usage: climaformat.jl [flags] [FILE/PATH]... | ||
Formats the given julia files using the CLIMA formatting options. If paths | ||
are given it will format the julia files in the paths. Otherwise, it will | ||
format all changed julia files. | ||
-v, --verbose | ||
Print the name of the files being formatted with relevant details. | ||
-h, --help | ||
Print this message. | ||
""" | ||
|
||
function parse_opts!(args::Vector{String}) | ||
i = 1 | ||
opts = Dict{Symbol, Union{Int, Bool}}() | ||
while i ≤ length(args) | ||
arg = args[i] | ||
if arg[1] != '-' | ||
i += 1 | ||
continue | ||
end | ||
if arg == "-v" || arg == "--verbose" | ||
opt = :verbose | ||
elseif arg == "-h" || arg == "--help" | ||
opt = :help | ||
else | ||
error("invalid option $arg") | ||
end | ||
if opt in (:verbose, :help) | ||
opts[opt] = true | ||
deleteat!(args, i) | ||
end | ||
end | ||
return opts | ||
end | ||
|
||
opts = parse_opts!(ARGS) | ||
if haskey(opts, :help) | ||
write(stdout, help) | ||
exit(0) | ||
end | ||
if isempty(ARGS) | ||
filenames = readlines(`git ls-files "*.jl"`) | ||
else | ||
filenames = ARGS | ||
end | ||
|
||
format(filenames; clima_formatter_options..., opts...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
comment: false | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
target: auto | ||
# this allows a 10% drop from the previous base commit coverage | ||
threshold: 10% | ||
|
||
github_checks: | ||
annotations: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: CompatHelper | ||
on: | ||
schedule: | ||
- cron: 0 14 * * * | ||
workflow_dispatch: | ||
jobs: | ||
CompatHelper: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- 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.DOCUMENTER_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: JuliaFormatter | ||
|
||
on: | ||
push: | ||
tags: '*' | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: dorny/paths-filter@v3 | ||
id: filter | ||
with: | ||
filters: | | ||
julia_file_change: | ||
- added|modified: '**.jl' | ||
- uses: julia-actions/setup-julia@latest | ||
if: steps.filter.outputs.julia_file_change == 'true' | ||
with: | ||
version: '1.10' | ||
|
||
- name: Apply JuliaFormatter | ||
if: steps.filter.outputs.julia_file_change == 'true' | ||
run: | | ||
julia --project=.dev .dev/climaformat.jl . | ||
- name: Check formatting diff | ||
if: steps.filter.outputs.julia_file_change == 'true' | ||
run: | | ||
git diff --color=always --exit-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: TagBot | ||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
workflow_dispatch: | ||
jobs: | ||
TagBot: | ||
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: JuliaRegistries/TagBot@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ssh: ${{ secrets.DOCUMENTER_KEY }} | ||
changelog: | | ||
## {{ package }} {{ version }} | ||
{% if previous_release %} | ||
[Diff since {{ previous_release }}]({{ compare_url }}) | ||
{% endif %} | ||
{% if custom %} | ||
{{ custom }} | ||
{% endif %} | ||
### 📢 API Changes: | ||
{% if issues %} | ||
{% for issue in issues if 'API' in issue.labels or 'breaking change' in issue.labels %} | ||
- {{ issue.title }} (#{{ issue.number }}) | ||
{% endfor %} | ||
{% endif %} | ||
{% if pulls %} | ||
{% for pull in pulls if 'API' in pull.labels or 'breaking change' in pull.labels %} | ||
- {{ pull.title }} (#{{ pull.number }}) (@{{ pull.author.username }}) | ||
{% endfor %} | ||
{% endif %} | ||
### 🚀 Features | ||
{% if issues %} | ||
{% for issue in issues if 'enhancement' in issue.labels or 'feature' in issue.labels %} | ||
- {{ issue.title }} (#{{ issue.number }}) | ||
{% endfor %} | ||
{% endif %} | ||
{% if pulls %} | ||
{% for pull in pulls if 'enhancement' in pull.labels or 'feature' in pull.labels %} | ||
- {{ pull.title }} (#{{ pull.number }}) (@{{ pull.author.username }}) | ||
{% endfor %} | ||
{% endif %} | ||
### 📑 Documentation | ||
{% if issues %} | ||
{% for issue in issues if 'documentation' in issue.labels %} | ||
- {{ issue.title }} (#{{ issue.number }}) | ||
{% endfor %} | ||
{% endif %} | ||
{% if pulls %} | ||
{% for pull in pulls if 'documentation' in pull.labels %} | ||
- {{ pull.title }} (#{{ pull.number }}) (@{{ pull.author.username }}) | ||
{% endfor %} | ||
{% endif %} | ||
### 🐛 Fixes | ||
{% if issues %} | ||
{% for issue in issues if 'bug' in issue.labels or 'bugfix' in issue.labels %} | ||
- {{ issue.title }} (#{{ issue.number }}) | ||
{% endfor %} | ||
{% endif %} | ||
{% if pulls %} | ||
{% for pull in pulls if 'bug' in pull.labels or 'bugfix' in pull.labels %} | ||
- {{ pull.title }} (#{{ pull.number }}) (@{{ pull.author.username }}) | ||
{% endfor %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: ci | ||
on: | ||
push: | ||
tags: '*' | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
name: ci ${{ matrix.version }} - ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
version: | ||
- '1.10' | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
- windows-latest | ||
arch: | ||
- x64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: ${{ matrix.version }} | ||
arch: ${{ matrix.arch }} | ||
- uses: julia-actions/cache@v2 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-runtest@v1 | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
with: | ||
file: lcov.info | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
file: lcov.info | ||
token: ${{secrets.CODECOV_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: '*' | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
docbuild: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@latest | ||
with: | ||
version: '1.10' | ||
- uses: julia-actions/cache@v2 | ||
- name: Install dependencies | ||
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.precompile()' | ||
- name: Build and deploy | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key | ||
run: julia --project=docs/ docs/make.jl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Downgrade | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
tags: '*' | ||
|
||
# Needed to allow julia-actions/cache to delete old caches that it has created | ||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
version: ['1.9', '1.10'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@latest | ||
with: | ||
version: ${{ matrix.version }} | ||
- uses: julia-actions/cache@v2 | ||
- uses: julia-actions/julia-downgrade-compat@v1 | ||
with: | ||
skip: Dates, LazyArtifacts, LinearAlgebra, Test, Statistics | ||
- uses: julia-actions/julia-buildpkg@latest | ||
- uses: julia-actions/julia-runtest@latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name = "ClimaRivers" | ||
uuid = "9363829b-25e6-4e43-a03e-985c67d112e3" | ||
authors = ["Mauricio Lima, Andrew Chiang, Katherine Deck, Ollie Dunbar"] | ||
version = "0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module ClimaRivers | ||
|
||
greet() = print("Hello World!") | ||
|
||
end # module ClimaRivers |
Oops, something went wrong.