forked from facebookresearch/fairseq2
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (86 loc) · 2.72 KB
/
_lint_py.yaml
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
94
95
96
97
98
99
100
101
102
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
on:
workflow_call:
inputs:
torch:
type: string
default: '2.1.1'
py:
type: string
default: '3.11'
jobs:
lint:
name: Lint
runs-on:
labels: 4-core-ubuntu
container:
image: ghcr.io/facebookresearch/fairseq2-ci-manylinux_x86_64:2-cpu
defaults:
run:
shell: bash
steps:
- name: Check-out the repository
uses: actions/checkout@v3
- name: Create the Python virtual environment
run: |
python${{ inputs.py }} -m venv ~/venv
echo ~/venv/bin >> "$GITHUB_PATH"
- name: Install PyTorch
run: |
pip install --extra-index-url https://download.pytorch.org/whl/cpu\
torch==${{ inputs.torch }}
- name: Install requirements
run: |
pip install --requirement fairseq2n/python/requirements-build.txt
pip install --requirement requirements-devel.txt
- name: Install fairseq2n
run: |
pip install --editable fairseq2n/python
- name: Install fairseq2
id: install_fairseq2
run: |
pip install --editable .
- name: Run isort
if: success() || (failure() && steps.install_fairseq2.outcome == 'success')
run: |
echo "::add-matcher::./ci/problem-matchers/isort.json"
function remove_matcher
{
echo "::remove-matcher owner=isort::"
}
trap remove_matcher EXIT
isort --check .
- name: Run black
if: success() || (failure() && steps.install_fairseq2.outcome == 'success')
run: |
echo "::add-matcher::./ci/problem-matchers/black.json"
function remove_matcher
{
echo "::remove-matcher owner=black::"
}
trap remove_matcher EXIT
black --check .
- name: Run flake8
if: success() || (failure() && steps.install_fairseq2.outcome == 'success')
run: |
echo "::add-matcher::./ci/problem-matchers/flake8.json"
function remove_matcher
{
echo "::remove-matcher owner=flake8::"
}
trap remove_matcher EXIT
flake8 .
- name: Run mypy
if: success() || (failure() && steps.install_fairseq2.outcome == 'success')
run: |
echo "::add-matcher::./ci/problem-matchers/mypy.json"
function remove_matcher
{
echo "::remove-matcher owner=mypy::"
}
trap remove_matcher EXIT
mypy .