Skip to content

Commit

Permalink
second commit
Browse files Browse the repository at this point in the history
  • Loading branch information
terasakisatoshi committed Apr 25, 2021
1 parent 4697d11 commit bccabc9
Show file tree
Hide file tree
Showing 13 changed files with 311 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/CI.yml
@@ -0,0 +1,90 @@
name: CI
on:
push:
tags:
- "v*"
branches:
- "main"
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.6'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install dependencies for Python
run: |
pip install jupyter jupytext
pip install nbconvert ipykernel
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: traced_runtests.jl
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('tracecompile.jl') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: traced_nb.jl
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('nb.jl') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Install Packages in default env
run: |
julia setup.jl
- name: Running make command
run: make
- name: Running make test command
run: make test
# Create Release
- name: Upload artifacts
uses: ncipollo/release-action@v1
if: contains(github.ref, 'refs/tags')
with:
allowUpdates: true
omitBodyDuringUpdate: true
artifacts: "sys*"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push to tag named latest
uses: ncipollo/release-action@v1
if: github.ref == 'refs/heads/main'
with:
allowUpdates: true
omitBodyDuringUpdate: true
tag: latest
artifacts: "sys*"
token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .gitignore
@@ -0,0 +1,31 @@
# Files generated by invoking Julia with --code-coverage
*.jl.cov
*.jl.*.cov

# Files generated by invoking Julia with --track-allocation
*.jl.mem

# System-specific files and directories generated by the BinaryProvider and BinDeps packages
# They contain absolute paths specific to the host computer, and so should not be committed
deps/deps.jl
deps/build.log
deps/downloads/
deps/usr/
deps/src/

# Build artifacts for creating documentation generated by the Documenter package
docs/build/
docs/site/

# File generated by Pkg, the package manager, based on a corresponding Project.toml
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml

# ignore files list precompile(...)
traced_*.jl
*.ipynb
*.gif
*.hdf5
sys.*
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Satoshi Terasaki

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.
26 changes: 26 additions & 0 deletions Makefile
@@ -0,0 +1,26 @@
.PHONY: all instantiate trace build test clean

all: instantiate build

instantiate: Project.toml
rm -f Manifest.toml
julia --project=@. -e 'using Pkg; Pkg.instantiate()'

traced_runtests.jl traced_nb.jl: tracecompile.jl nb.jl
julia --project=@. --trace-compile=traced_runtests.jl tracecompile.jl
julia --project=@. installkernel.jl
jupytext --to ipynb --execute nb.jl

build: traced_runtests.jl traced_nb.jl
julia --project=@. build.jl

test:
julia --project=@. benchmark.jl

clean:
rm -f tmp*
rm -f sys*
rm -f traced_nb.jl traced_runtests.jl
rm -f *.ipynb
rm -f Manifest.toml
rm -rf .ipynb_checkpoints
28 changes: 28 additions & 0 deletions Project.toml
@@ -0,0 +1,28 @@
authors = ["Satoshi Terasaki <terasakisatoshi.math@gmail.com>"]
version = "0.1.0"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
GeometryTypes = "4d00f742-c7ba-57c2-abde-4428a4b178cb"
Gtk = "4c0ca9eb-093a-5379-98c5-f87ac0bbbf44"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
OhMyREPL = "5fb14364-9ced-5910-84b2-373655c76a03"
PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92"
WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29"
2 changes: 2 additions & 0 deletions benchmark.jl
@@ -0,0 +1,2 @@
@time run(`jupytext --to ipynb --execute testout_naive.jl`)
@time run(`jupytext --to ipynb --execute testout_sys.jl`)
12 changes: 12 additions & 0 deletions build.jl
@@ -0,0 +1,12 @@
using PackageCompiler
using Libdl: dlext

create_sysimage(
[:StatsPlots, :Plots, :DataFrames, :OhMyREPL],
precompile_statements_file=[
"traced_runtests.jl",
"traced_nb.jl"
],
sysimage_path="sys.$(dlext)",
cpu_target = PackageCompiler.default_app_cpu_target()
)
3 changes: 3 additions & 0 deletions installkernel.jl
@@ -0,0 +1,3 @@
using IJulia
installkernel("Julia-trace", "--project=@.", "--trace-compile=traced_nb.jl")
installkernel("Julia-sys", "--project=@.", "--sysimage=sys")
43 changes: 43 additions & 0 deletions nb.jl
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,jl:light
# text_representation:
# extension: .jl
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.1
# kernelspec:
# display_name: Julia-trace 1.6.0
# language: julia
# name: julia-trace-1.6
# ---

# +
using Distributions

using StatsPlots
using DataFrames
# -

1+1

plot(sin)
plot!(cos)

# +
x = []
y = []

anim = @animate for θ in -π:0.1:π
push!(x, cos(θ))
push!(y, sin(θ))
plot(x, y, xlim=[-1,1], ylim=[-1,1], aspect_ratio=:equal)
end

gif(anim)
# -

mat = DataFrame(rand(10,10), :auto)
@df mat scatter(:x1, :x2)
8 changes: 8 additions & 0 deletions setup.jl
@@ -0,0 +1,8 @@
using Pkg

Pkg.add([
"IJulia",
"PackageCompiler",
])

Pkg.precompile()
20 changes: 20 additions & 0 deletions testout_naive.jl
@@ -0,0 +1,20 @@
# ---
# jupyter:
# jupytext:
# formats: ipynb,jl:light
# text_representation:
# extension: .jl
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.1
# kernelspec:
# display_name: julia 1.6.0
# language: julia
# name: julia-1.6
# ---

using StatsPlots

using Distributions

plot(Laplace())
22 changes: 22 additions & 0 deletions testout_sys.jl
@@ -0,0 +1,22 @@
# ---
# jupyter:
# jupytext:
# formats: ipynb,jl:light
# text_representation:
# extension: .jl
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.1
# kernelspec:
# display_name: Julia-sys 1.6.0
# language: julia
# name: julia-sys-1.6
# ---

using StatsPlots

using Distributions

plot(Laplace())


5 changes: 5 additions & 0 deletions tracecompile.jl
@@ -0,0 +1,5 @@
using StatsPlots
using Plots

include(joinpath(pkgdir(StatsPlots), "test", "runtests.jl"))
try include(joinpath(pkgdir(Plots), "test", "runtests.jl")) catch end

0 comments on commit bccabc9

Please sign in to comment.