Skip to content

Commit

Permalink
Merge pull request google#61 from jmichelp/master
Browse files Browse the repository at this point in the history
Run everything that Travis-CI is running as Github workflows
  • Loading branch information
jmichelp authored Mar 2, 2020
2 parents d6661a0 + 433103c commit e61e478
Show file tree
Hide file tree
Showing 10 changed files with 241 additions and 12 deletions.
42 changes: 42 additions & 0 deletions .github/python_matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"problemMatcher": [
{
"owner": "yapf-diff",
"pattern": [
{
"regexp": "^[+-]{3}\\s*([^\\s]*)\\s*\\((original|reformatted)\\)$",
"file": 1
},
{
"regexp": "^@@\\s*-(\\d+),(\\d+)\\s*\\+(\\d+),(\\d+)\\s*@@$",
"line": 1,
"column": 2
},
{
"regexp": "^(\\s|\\+[^+]|\\-[^-]).*$",
"loop": true,
"message": 1
}
]
},
{
"owner": "pylint",
"pattern": [
{
"regexp": "^PYLINT:(.*)/.*$",
"fromPath": 1
},
{
"regexp": "^\\*{13}\\s*Module\\s+(.*)$",
"file": 1
},
{
"regexp": "^([CEFIRW]\\d{4}):\\s*(\\d+)\\s*:\\s*(.*)$",
"code": 1,
"line": 2,
"message": 3
}
]
}
]
}
4 changes: 2 additions & 2 deletions .github/workflows/cargo_audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: Security audit
on:
schedule:
- cron: '0 0 * * *'

jobs:
audit:
runs-on: ubuntu-18.04
if: env.GITHUB_HEAD_REF == 0
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: thumbv7em-none-eabi
override: true
- uses: actions/setup-python@v1
with:
python-version: 3.7
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/cargo_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: thumbv7em-none-eabi
override: true
- uses: actions/setup-python@v1
with:
python-version: 3.7
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/cargo_fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: thumbv7em-none-eabi
override: true
- uses: actions/setup-python@v1
with:
python-version: 3.7
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/cbor_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: CBOR tests
on:
push:
paths:
- 'libraries/cbor/**/*'
pull_request:
types: [opened, synchronize, reopened]

jobs:
cbor_test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
target: thumbv7em-none-eabi
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: Set up OpenSK
run: ./setup.sh

- name: Unit testing of CBOR library (release mode)
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path libraries/cbor/Cargo.toml --release --features std

- name: Unit testing of CBOR library (debug mode)
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path libraries/cbor/Cargo.toml --features std
40 changes: 40 additions & 0 deletions .github/workflows/crypto_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Crypto library tests
on:
push:
paths:
- 'libraries/crypto/**/*'
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'libraries/crypto/**/*'

jobs:
crypto_test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
target: thumbv7em-none-eabi
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: Set up OpenSK
run: ./setup.sh

- run: echo "::set-env name=RUSTFLAGS::-C target-feature=+aes"

- name: Unit testing of crypto library (release mode)
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path libraries/crypto/Cargo.toml --release --features std,derive_debug

- name: Unit testing of crypto library (debug mode)
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path libraries/crypto/Cargo.toml --features std,derive_debug
31 changes: 31 additions & 0 deletions .github/workflows/opensk_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: OpenSK build
on:
push:
pull_request:
types: [opened, synchronize, reopened]

jobs:
build_ctap2:
strategy:
matrix:
os: [ubuntu-18.04, macos-10.15]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
target: thumbv7em-none-eabi
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: Set up OpenSK
run: ./setup.sh

- name: Building OpenSK
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=thumbv7em-none-eabi --features with_ctap1
51 changes: 51 additions & 0 deletions .github/workflows/opensk_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: OpenSK tests
on:
push:
paths:
- 'src/**/*.rs'
pull_request:
types: [opened, synchronize, reopened]

jobs:
ctap2_test:
name: CTAP2 unit tests
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
target: thumbv7em-none-eabi
- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install Python dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: Set up OpenSK
run: ./setup.sh

- name: Unit testing of CTAP2 (release mode)
uses: actions-rs/cargo@v1
with:
command: test
args: --release --features std

- name: Unit testing of CTAP2 (debug mode)
uses: actions-rs/cargo@v1
with:
command: test
args: --features std

- name: Unit testing of CTAP2 (release mode + CTAP1)
uses: actions-rs/cargo@v1
with:
command: test
args: --release --features std,with_ctap1

- name: Unit testing of CTAP2 (debug mode + CTAP1)
uses: actions-rs/cargo@v1
with:
command: test
args: --features std,with_ctap1

14 changes: 8 additions & 6 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install tockloader
pip install tockloader pylint
- name: Register matcher
run: echo ::add-matcher::./.github/python_matcher.json
- name: Test code with pylint
run: |
pip install pylint
pylint --rcfile=.pylintrc --score=n `find . ! -path "./third_party/*" -type f -name '*.py'`
run: ./tools/run_pylint.sh

yapf:
runs-on: ubuntu-18.04
Expand All @@ -39,6 +39,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install yapf
pip install yapf tockloader
- name: Test code formatting with yapf
run: yapf --style=chromium --recursive --exclude third_party --diff .
run: |
echo ::add-matcher::./.github/python_matcher.json
yapf --style=chromium --recursive --exclude third_party --diff .
31 changes: 31 additions & 0 deletions tools/run_pylint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

SUCCESS=0

# Ensure we are at the project root directory
cd $(readlink -f $(dirname $0))/..

for file in `find . ! -path "./third_party/*" -type f -name '*.py'`
do
# Output header for our custom matcher on Github workflow
echo "PYLINT:${file}"
if ! pylint --rcfile=.pylintrc --score=n "$file"
then
SUCCESS=1
fi
done

exit $SUCCESS

0 comments on commit e61e478

Please sign in to comment.