Skip to content

Commit 3b5e473

Browse files
committed
Modernize SnoopCompile
1 parent e61da2d commit 3b5e473

File tree

8 files changed

+100
-285
lines changed

8 files changed

+100
-285
lines changed

.github/workflows/SnoopCompile.yml

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,86 @@
11
name: SnoopCompile
22

3+
4+
# Edit based on your repository.
35
on:
4-
- push
6+
push:
7+
branches:
8+
# - 'master'
59

10+
defaults:
11+
run:
12+
shell: bash
613

714
jobs:
8-
build:
15+
SnoopCompile:
16+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
917
runs-on: ${{ matrix.os }}
1018
strategy:
19+
fail-fast: false
1120
matrix:
12-
julia-version: ['nightly']
13-
julia-arch: [x64]
14-
os: [ubuntu-latest]
21+
# Uncomment other versions if you want multi-version signatures (should exactly match BotConfig.version):
22+
version:
23+
- '1.4.2'
24+
- '1.3.1'
25+
- '1.2.0'
26+
- '1.0.5'
27+
os:
28+
- ubuntu-latest
29+
- windows-latest
30+
- macos-latest
31+
arch:
32+
- x64
1533
steps:
1634
- uses: actions/checkout@v2
1735
- uses: julia-actions/setup-julia@latest
1836
with:
19-
version: ${{ matrix.julia-version }}
37+
version: ${{ matrix.version }}
2038
- name: Install dependencies
21-
run: julia --project -e 'using Pkg; Pkg.instantiate();'
22-
- name : Add SnoopCompile and current package
23-
run: julia -e 'using Pkg; Pkg.add("SnoopCompile"); Pkg.develop(PackageSpec(; path=pwd()));'
24-
- name: Install Test dependencies
25-
run: julia -e 'using SnoopCompile; SnoopCompile.addtestdep()'
39+
run: |
40+
julia --project -e 'using Pkg; Pkg.instantiate();'
41+
julia -e 'using Pkg; Pkg.add(PackageSpec(url = "https://github.com/timholy/SnoopCompile.jl", rev = "master")); Pkg.develop(PackageSpec(; path=pwd())); using SnoopCompile; SnoopCompile.addtestdep();'
2642
- name: Generating precompile files
27-
run: julia --project=@. -e 'include("deps/SnoopCompile/snoopCompile.jl")'
43+
run: julia --project -e 'include("deps/SnoopCompile/snoop_bot.jl")'
2844
- name: Running Benchmark
29-
run: julia --project=@. -e 'include("deps/SnoopCompile/snoopBenchmark.jl")'
45+
run: julia --project -e 'include("deps/SnoopCompile/snoop_bench.jl")'
46+
- name: Upload all
47+
uses: actions/upload-artifact@v2
48+
with:
49+
path: ./
3050

31-
# https://github.com/marketplace/actions/create-pull-request
51+
Create_PR:
52+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
53+
needs: SnoopCompile
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v2
57+
- name: Download all
58+
uses: actions/download-artifact@v2
59+
- name: Move the content of the directory to the root
60+
run: |
61+
rsync -a artifact/* ./
62+
rm -d -r artifact
63+
- name: Discard unrelated changes
64+
run: |
65+
test -f 'Project.toml' && git checkout -- 'Project.toml'
66+
git ls-files 'Manifest.toml' | grep . && git checkout -- 'Manifest.toml'
67+
(git diff -w --no-color || git apply --cached --ignore-whitespace && git checkout -- . && git reset && git add -p) || echo done
68+
- name: Format precompile_includer.jl
69+
run: julia -e 'using Pkg; Pkg.add("JuliaFormatter"); using JuliaFormatter; format_file("src/precompile_includer.jl")'
3270
- name: Create Pull Request
3371
uses: peter-evans/create-pull-request@v2
3472
with:
3573
token: ${{ secrets.GITHUB_TOKEN }}
3674
commit-message: Update precompile_*.jl file
3775
committer: Amin Yahyaabadi <[email protected]>
38-
title: '[AUTO] Update precompile_*.jl file'
76+
title: "[AUTO] Update precompiles"
3977
labels: SnoopCompile
40-
branch: create-pull-request/SnoopCompile
41-
- name: Check output environment variable
42-
run: echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
78+
branch: "SnoopCompile_AutoPR"
79+
80+
81+
Skip:
82+
if: "contains(github.event.head_commit.message, '[skip ci]')"
83+
runs-on: ubuntu-latest
84+
steps:
85+
- name: Skip CI 🚫
86+
run: echo skip ci

deps/SnoopCompile/example_script.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Run the examples
2+
using MatLang
3+
examplePath = joinpath( dirname(dirname(@__DIR__)), "examples")
4+
include(joinpath(examplePath, "Language_Fundamentals", "usage_Entering_Commands.jl"))
5+
include(joinpath(examplePath, "Language_Fundamentals", "usage_Matrices_and_Arrays.jl"))
6+
include(joinpath(examplePath, "Language_Fundamentals", "Data_Types", "usage_Numeric_Types.jl"))

deps/SnoopCompile/precompile/precompile_MatLang.jl

Lines changed: 0 additions & 233 deletions
This file was deleted.

deps/SnoopCompile/snoopBenchmark.jl

Lines changed: 0 additions & 21 deletions
This file was deleted.

deps/SnoopCompile/snoopCompile.jl

Lines changed: 0 additions & 9 deletions
This file was deleted.

deps/SnoopCompile/snoop_bench.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using SnoopCompile
2+
3+
botconfig = BotConfig(
4+
"MatLang";
5+
yml_path = "SnoopCompile.yml",
6+
blacklist = [],
7+
)
8+
9+
println("Benchmarking the inference time of `using MatLang`")
10+
snoop_bench(
11+
botconfig,
12+
:(using MatLang),
13+
)
14+
15+
16+
println("Benchmarking the inference time of `using MatLang` and runtests")
17+
snoop_bench(
18+
botconfig,
19+
"$(@__DIR__)/example_script.jl",
20+
)

0 commit comments

Comments
 (0)