Skip to content

Commit 99d8edd

Browse files
Initialize project
1 parent 348c747 commit 99d8edd

File tree

13 files changed

+267
-0
lines changed

13 files changed

+267
-0
lines changed

.JuliaFormatter.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
remove_extra_newlines=true
2+
join_lines_based_on_source=true
3+
whitespace_in_kwargs=false
4+
short_to_long_function_def=true
5+
always_for_in=true
6+
verbose=true
7+
margin=92
8+
annotate_untyped_fields_with_any=false

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Location of package manifests
6+
schedule:
7+
interval: "weekly"

.github/workflows/CI.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags: ['*']
7+
pull_request:
8+
workflow_dispatch:
9+
concurrency:
10+
# Skip intermediate builds: always.
11+
# Cancel intermediate builds: only if it is a pull request build.
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
14+
jobs:
15+
test:
16+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
17+
runs-on: ${{ matrix.os }}
18+
timeout-minutes: 60
19+
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
20+
actions: write
21+
contents: read
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
version:
26+
- '1.10'
27+
os:
28+
- ubuntu-latest
29+
arch:
30+
- x64
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: julia-actions/setup-julia@v1
34+
with:
35+
version: ${{ matrix.version }}
36+
arch: ${{ matrix.arch }}
37+
- uses: julia-actions/cache@v1
38+
- uses: julia-actions/julia-buildpkg@v1
39+
- uses: julia-actions/julia-runtest@v1

.github/workflows/CompatHelper.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CompatHelper
2+
on:
3+
schedule:
4+
- cron: 0 0 * * *
5+
workflow_dispatch:
6+
jobs:
7+
CompatHelper:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Pkg.add("CompatHelper")
11+
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
12+
- name: CompatHelper.main()
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
16+
run: julia -e 'using CompatHelper; CompatHelper.main()'

.github/workflows/CreateOmikuji.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CreateOmikuji
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags: ['*']
7+
workflow_dispatch:
8+
concurrency:
9+
# Skip intermediate builds: always.
10+
# Cancel intermediate builds: only if it is a pull request build.
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
13+
jobs:
14+
createomikuji:
15+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
16+
runs-on: ${{ matrix.os }}
17+
timeout-minutes: 60
18+
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
19+
actions: write
20+
contents: read
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
version:
25+
- '1.10'
26+
os:
27+
- ubuntu-latest
28+
arch:
29+
- x64
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: julia-actions/setup-julia@v1
33+
with:
34+
version: ${{ matrix.version }}
35+
arch: ${{ matrix.arch }}
36+
- uses: julia-actions/cache@v1
37+
- uses: julia-actions/julia-buildpkg@v1
38+
- name: Create omikuji
39+
run: julia --project app.jl
40+
- name: upload result to release page
41+
uses: ncipollo/release-action@v1
42+
with:
43+
allowUpdates: true
44+
omitBodyDuringUpdate: true
45+
tag: omikuji/today
46+
artifacts: omikuji.png
47+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/TagBot.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: TagBot
2+
on:
3+
issue_comment:
4+
types:
5+
- created
6+
workflow_dispatch:
7+
inputs:
8+
lookback:
9+
default: 3
10+
permissions:
11+
actions: read
12+
checks: read
13+
contents: write
14+
deployments: read
15+
issues: read
16+
discussions: read
17+
packages: read
18+
pages: read
19+
pull-requests: read
20+
repository-projects: read
21+
security-events: read
22+
statuses: read
23+
jobs:
24+
TagBot:
25+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: JuliaRegistries/TagBot@v1
29+
with:
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
ssh: ${{ secrets.DOCUMENTER_KEY }}

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.gif
2+
.CondaPkg
3+
.DS_Store
4+
/Manifest.toml
5+
/docs/Manifest.toml
6+
/docs/build/
7+
docs/build/
8+
docs/site/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Satoshi Terasaki <[email protected]> and contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.phony : all, build, web, test, test-parallel, clean
2+
3+
DOCKER_IMAGE=omikujiworkflowjl
4+
5+
all: build
6+
7+
build:
8+
-rm -f Manifest.toml docs/Manifest.toml
9+
docker build -t ${DOCKER_IMAGE} . --build-arg NB_UID=`id -u`
10+
docker compose build
11+
docker compose run --rm shell julia --project=@. -e 'using Pkg; Pkg.instantiate()'
12+
docker compose run --rm shell julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
13+
14+
# Excecute in docker container
15+
web: docs
16+
julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); \
17+
include("docs/make.jl"); \
18+
using LiveServer; servedocs(host="0.0.0.0"); \
19+
'
20+
21+
test: build
22+
docker compose run --rm shell julia -e 'using Pkg; Pkg.activate("."); Pkg.test()'
23+
24+
clean:
25+
docker compose down
26+
-find $(CURDIR) -name "*.ipynb" -type f -delete
27+
-find $(CURDIR) -name "*.html" -type f -delete
28+
-find $(CURDIR) -name "*.gif" -type f -delete
29+
-find $(CURDIR) -name "*.ipynb_checkpoints" -type d -exec rm -rf "{}" +
30+
-rm -f Manifest.toml docs/Manifest.toml
31+
-rm -rf docs/build

Project.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name = "OmikujiWorkflow"
2+
uuid = "df06ee32-81ff-4b2d-9249-7fde3b17d823"
3+
authors = ["Satoshi Terasaki <[email protected]> and contributors"]
4+
version = "0.1.0"
5+
6+
[deps]
7+
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
8+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
9+
10+
[compat]
11+
julia = "1.10.4"
12+
13+
[extras]
14+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
15+
16+
[targets]
17+
test = ["Test"]

app.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Plots
2+
3+
using OmikujiWorkflow: get_omikuji
4+
5+
function main()
6+
omikuji = get_omikuji()
7+
@info "Today's omikuji is $omikuji"
8+
9+
p = plot(
10+
xlims=(0, 1), ylims=(0, 1), legend=false,
11+
xticks=false, yticks=false,
12+
axis=false, border=:none,
13+
title="Today's Omikuji(Fortune)",
14+
)
15+
annotate!(p, 0.5, 0.5, text(omikuji, 30, :center))
16+
plot(p)
17+
savefig(p, "omikuji.png")
18+
end
19+
20+
if abspath(PROGRAM_FILE) == @__FILE__
21+
main()
22+
end

src/OmikujiWorkflow.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module OmikujiWorkflow
2+
3+
# Write your package code here.
4+
OMIKUJI_LIST = String["Awesome!", "Good", "Okay", "Meh", "Bad", "Terrible!"]
5+
6+
"""
7+
get_omikuji() -> String
8+
9+
Return a random omikuji(draw a fortune) from `OMIKUJI_LIST`.
10+
"""
11+
get_omikuji() = rand(OMIKUJI_LIST)
12+
13+
end

test/runtests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using OmikujiWorkflow
2+
using Test
3+
4+
@testset "OmikujiWorkflow.jl" begin
5+
f = OmikujiWorkflow.get_omikuji()
6+
@test f in OmikujiWorkflow.OMIKUJI_LIST
7+
end

0 commit comments

Comments
 (0)