-
Notifications
You must be signed in to change notification settings - Fork 17
93 lines (82 loc) · 3.38 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Linting
on:
pull_request:
paths_ignore:
- "docs/**"
defaults:
run:
# This is needed for miniconda, see:
# https://github.com/marketplace/actions/setup-miniconda#important
shell: bash -l {0}
jobs:
lint:
runs-on: ubuntu-latest
name: Linting checks
steps:
- uses: actions/[email protected]
with:
submodules: recursive
- name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Cache conda environment
# Use an always upload cache to prevent solving conda environment again and again on failing linting.
uses: pat-s/[email protected]
env:
# Increase this value to manually invalidate the cache
CACHE_NUMBER: 0
with:
path: /usr/share/miniconda/envs/biowdl-lint
key:
${{runner.os}}-biowdl-lint-${{ env.CACHE_NUMBER }}-${{env.DATE}}-${{ hashFiles('.github/lint-environment.yml') }}
id: env_cache
# Use the builtin conda. This is the fastest installation. It may not be
# the fastest for resolving, but the package cache mitigates that problem.
# Since this installs fastest, it is fastest for all runs where a cache
# hit occurs.
- name: install miniconda
uses: conda-incubator/[email protected]
with:
channels: conda-forge,bioconda,defaults
channel-priority: strict
auto-activate-base: false
use-only-tar-bz2: true # Needed for proper caching according to the documentation.
# activate-environment is broken! This always seems to create a new environment.
# Activation is therefore done separately.
- name: Create test environment if no cache is present
run: conda env create -n biowdl-lint -f .github/lint-environment.yml
if: steps.env_cache.outputs.cache-hit != 'true'
- name: Activate test environment
# The new PATH should be passed to the environment, otherwise it won't register.
run: |
conda activate biowdl-lint
echo "PATH=$PATH" >> $GITHUB_ENV
- name: Fetch develop branch for comparisons
run: git fetch --depth=1 origin develop
- name: run womtool validate
# Only check files that have changed from the base reference.
# Womtool validate checks very slowly, so this saves a lot of time.
run: |
set -x
for WDL_FILE in $(git diff --name-only origin/${{github.base_ref}} | grep -E '*.wdl$'); do
womtool validate $WDL_FILE
done
- name: run miniwdl check
run: |
set -x
bash -c 'miniwdl check $(git ls-files *.wdl)'
- name: Check copyright headers
run: |
set -x
for WDL_FILE in $(git diff --name-only origin/${{github.base_ref}} | grep -E '*.wdl$'); do
grep Copyright $WDL_FILE || bash -c "echo No copyright header in $WDL_FILE && exit 1"
done
- name: Check parameter_meta for inputs
run: |
set -x
for WDL_FILE in $(git diff --name-only origin/${{github.base_ref}} | grep -E '*.wdl$'); do
wdl-aid --strict $WDL_FILE > /dev/null 2> wdl-aid_stderr ||
if grep -z 'ValueError: Missing parameter_meta for inputs:' wdl-aid_stderr
then
exit 1
fi
done