Skip to content

Commit dd143a3

Browse files
Merge pull request #23 from SchlossLab/gh-actions
Fix GitHub Actions workflows
2 parents 71b781f + 0ff2867 commit dd143a3

File tree

61 files changed

+1237
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1237
-77
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,45 @@ on:
88
jobs:
99
build:
1010
name: build
11-
runs-on: macOS-latest
11+
runs-on: macos-latest
1212
strategy:
1313
matrix:
14-
python-version: [3.8]
14+
python-version: ["3.11"]
1515

1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818
with:
1919
persist-credentials: false
2020
fetch-depth: 0
21-
- uses: r-lib/actions/setup-r@v1
22-
- uses: r-lib/actions/setup-pandoc@v1
23-
- uses: actions/setup-python@v1
21+
- uses: r-lib/actions/setup-r@v2
22+
- uses: r-lib/actions/setup-pandoc@v2
23+
- uses: actions/setup-python@v4
2424
with:
2525
python-version: ${{ matrix.python-version }}
26-
- name: Install build dependencies
26+
- name: git config
2727
run: |
28-
Rscript -e "install.packages(c('styler','usethis'))"
29-
python -m pip install --upgrade pip
30-
pip install black snakefmt
28+
git config --local user.email "noreply@github.com"
29+
git config --local user.name "GitHub"
3130
- name: Style R code
3231
run: |
32+
Rscript -e "install.packages(c('styler','usethis'))"
3333
Rscript -e 'usethis::use_tidy_style()'
3434
git add .
3535
git diff-index --quiet HEAD \
3636
|| git commit \
37-
--author="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" \
3837
-m '🎨 Style R code'
3938
- name: Style Python code
4039
run: |
40+
python -m pip install --upgrade pip
41+
pip install black snakefmt
4142
black workflow/
4243
snakefmt workflow/
4344
git add workflow/
4445
git diff-index --quiet HEAD \
4546
|| git commit \
46-
--author="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" \
4747
-m '🎨 Style Python & Snakemake code 🐍'
4848
- name: Push
4949
uses: ad-m/github-push-action@master
5050
with:
5151
github_token: ${{ secrets.GITHUB_TOKEN }}
52-
branch: ${{ github.head_ref }}
52+
branch: ${{ github.head_ref }}

.github/workflows/release-please.yml

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

.github/workflows/tests.yml

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,44 @@ name: tests
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67
pull_request:
7-
branches: [ main ]
8-
8+
branches:
9+
- main
910

1011
jobs:
11-
# Formatting:
12-
# runs-on: ubuntu-latest
13-
# steps:
14-
# - uses: actions/checkout@v2
15-
# - name: Formatting
16-
# uses: github/super-linter@v4
17-
# env:
18-
# VALIDATE_ALL_CODEBASE: false
19-
# DEFAULT_BRANCH: main
20-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21-
# VALIDATE_SNAKEMAKE_SNAKEFMT: true
22-
23-
Linting:
12+
tests:
13+
name: tests
2414
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v2
27-
- name: Lint workflow
28-
uses: snakemake/snakemake-github-action@v1.24.0
29-
with:
30-
directory: .
31-
snakefile: workflow/Snakefile
32-
args: "--lint"
15+
strategy:
16+
matrix:
17+
python-version: ["3.11"]
3318

34-
# Testing:
35-
# runs-on: ubuntu-latest
36-
# needs:
37-
# - Linting
38-
# - Formatting
39-
# steps:
40-
# - uses: actions/checkout@v2
41-
42-
# - name: Test workflow
43-
# uses: snakemake/snakemake-github-action@v1.24.0
44-
# with:
45-
# directory: .test
46-
# snakefile: workflow/Snakefile
47-
# args: "--use-conda --show-failed-logs --cores 3 --conda-cleanup-pkgs cache --all-temp --configfile config/test.yml"
48-
49-
# - name: Test report
50-
# uses: snakemake/snakemake-github-action@v1.24.0
51-
# with:
52-
# directory: .test
53-
# snakefile: workflow/Snakefile
54-
# args: "--report report.zip"
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
persist-credentials: false
23+
fetch-depth: 0
24+
- uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install pytest pytest-parallel
31+
- name: Lint workflow
32+
uses: snakemake/snakemake-github-action@v1.24.0
33+
with:
34+
directory: .
35+
snakefile: workflow/Snakefile
36+
args: "--lint"
37+
- name: Run test workflow
38+
uses: snakemake/snakemake-github-action@v1.24.0
39+
with:
40+
directory: .
41+
snakefile: workflow/Snakefile
42+
args: "--use-conda --show-failed-logs --cores 2 --conda-cleanup-pkgs cache --all-temp --conda-frontend mamba --configfile config/test.yml"
43+
# - name: Test with pytest
44+
# run: |
45+
# pytest --workers 2 .tests/

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
data/
33
log/
44
benchmarks/
5-
results/
5+
results/*/runs
66
.Rproj.user
77
*KLS*
88
*_test*
9-
.vscode/
9+
.vscode/
10+
!.tests/
11+
__pycache__/

.tests/unit/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# pytest status
2+
3+
| unit test file | status |
4+
|------------------------------|--------|
5+
| test_combine_benchmarks ||
6+
| test_combine_hp_performance ||
7+
| test_combine_results ||
8+
| test_find_feature_importance ||
9+
| test_plot_benchmarks ||
10+
| test_plot_feature_importance ||
11+
| test_plot_hp_performance ||
12+
| test_plot_performance ||
13+
| test_preprocess_data ||
14+
| test_render_report ||
15+
| test_run_ml ||
16+
17+
Need to change how some results files are compared instead of byte-by-byte.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
s h:m:s max_rss max_vms max_uss max_pss io_in io_out mean_load cpu_time
2+
9.3403 0:00:09 0 0 0 0 0.00 0.00 191.90 0
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
s h:m:s max_rss max_vms max_uss max_pss io_in io_out mean_load cpu_time
2+
9.5682 0:00:09 0 0 0 0 0.00 0.00 209.26 0
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
schtools::log_snakemake()
2+
library(tidyverse)
3+
4+
read_bench <- function(filename) {
5+
read_tsv(filename) %>%
6+
mutate(
7+
method = str_replace(filename, "^benchmarks/(.*)/runs/run_ml.(.*)_(.*).txt", "\\2"),
8+
seed = str_replace(filename, "^benchmarks/(.*)/runs/run_ml.(.*)_(.*).txt", "\\3")
9+
)
10+
}
11+
12+
dat <- snakemake@input[["tsv"]] %>%
13+
lapply(read_bench) %>%
14+
bind_rows()
15+
head(dat)
16+
write_csv(dat, snakemake@output[["csv"]])
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
s,h:m:s,max_rss,max_vms,max_uss,max_pss,io_in,io_out,mean_load,cpu_time,method,seed
2+
9.3403,00:00:09,0,0,0,0,0,0,191.9,0,glmnet,100
3+
9.5682,00:00:09,0,0,0,0,0,0,209.26,0,glmnet,101

0 commit comments

Comments
 (0)