From feacd72d6eba31f04c7f23aeaea8d4186be4700d Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Mon, 24 Feb 2020 19:00:51 +0100 Subject: [PATCH 01/19] Add Github workflows These should do the checks for us. Not an expert though so it may need a bit of tweaking before they do what we want them to do. --- .github/workflows/mdlint.yml | 18 ++++++++ .github/workflows/pylint.yml | 27 ++++++++++++ .github/workflows/rust.yml | 79 ++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 .github/workflows/mdlint.yml create mode 100644 .github/workflows/pylint.yml create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/mdlint.yml b/.github/workflows/mdlint.yml new file mode 100644 index 0000000..5c2db7b --- /dev/null +++ b/.github/workflows/mdlint.yml @@ -0,0 +1,18 @@ +name: markdownlint +on: + push: + paths: + - '**/*.md' + - '.markdownlint.json' + - '!third_party/**' + +jobs: + pylint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: markdownlint-cli + uses: nosborn/github-action-markdown-cli@v1.1.1 + with: + files: **/*.md + config_file: ".markdownlint.json" diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000..929a051 --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,27 @@ +name: pylint +on: + push: + paths: + - '**/*.py' + - '.pylintrc' + - '!third_party/**' +jobs: + pylint: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + pip install tockloader + - name: Test code with pylint + run: | + pip install pylint + pylint --rcfile=.pylintrc diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..0611f1f --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,79 @@ +on: + push: + paths: + - 'examples/*.rs' + - 'libraries/**/*.rs' + - 'src/**/*.rs' + - 'patches/**' + - '**/Cargo.toml' + - '.cargo/config' + - '!third_party/**' + +jobs: + initial_setup: + name: Set up project + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + target: thumbv7em-none-eabi + override: true + - run: ./setup.sh + + cargo_format_src: + name: Cargo format src/ + needs: initial_setup + steps: + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + cargo_format_cbor: + name: Cargo format libraries/cbor + needs: initial_setup + steps: + - uses: actions-rs/cargo@v1 + working-directory: libraries/cbor + with: + command: fmt + args: --all -- --check + cargo_format_crypto: + name: Cargo format libraries/crypto + needs: initial_setup + steps: + - uses: actions-rs/cargo@v1 + working-directory: libraries/crypto + with: + command: fmt + args: --all -- --check + cargo_check: + name: Cargo Check + needs: initial_setup + steps: + - name: Check OpenSK w/o features + uses: actions-rs/cargo@v1 + with: + command: check + args: --target thumbv7em-none-eabi --release + - name: Check OpenSK with_ctap1 + uses: actions-rs/cargo@v1 + with: + command: check + args: --target thumbv7em-none-eabi --release --features with_ctap1 + - name: Check OpenSK debug_ctap + uses: actions-rs/cargo@v1 + with: + command: check + args: --target thumbv7em-none-eabi --release --features debug_ctap + - name: Check OpenSK debug_ctap,with_ctap1 + uses: actions-rs/cargo@v1 + with: + command: check + args: --target thumbv7em-none-eabi --release --features debug_ctap,with_ctap1 + - name: Check examples + uses: actions-rs/cargo@v1 + with: + command: check + args: --target thumbv7em-none-eabi --release --examples From 80096529ad2f76a86862cb46b5941f517ba9b2d7 Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Mon, 24 Feb 2020 19:04:09 +0100 Subject: [PATCH 02/19] Fix YAML syntax --- .github/workflows/mdlint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mdlint.yml b/.github/workflows/mdlint.yml index 5c2db7b..901286b 100644 --- a/.github/workflows/mdlint.yml +++ b/.github/workflows/mdlint.yml @@ -14,5 +14,5 @@ jobs: - name: markdownlint-cli uses: nosborn/github-action-markdown-cli@v1.1.1 with: - files: **/*.md + files: '**/*.md' config_file: ".markdownlint.json" From 40d5121d0bc9dee19904218b0bb31bf0a7630adc Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Mon, 24 Feb 2020 19:11:15 +0100 Subject: [PATCH 03/19] Remove paths to check workflows. --- .github/workflows/mdlint.yml | 12 ++++++------ .github/workflows/pylint.yml | 12 ++++++------ .github/workflows/rust.yml | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/mdlint.yml b/.github/workflows/mdlint.yml index 901286b..fad84c8 100644 --- a/.github/workflows/mdlint.yml +++ b/.github/workflows/mdlint.yml @@ -1,10 +1,10 @@ name: markdownlint -on: - push: - paths: - - '**/*.md' - - '.markdownlint.json' - - '!third_party/**' +on: [push] +# push: +# paths: +# - '**/*.md' +# - '.markdownlint.json' +# - '!third_party/**' jobs: pylint: diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 929a051..431d93c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -1,10 +1,10 @@ name: pylint -on: - push: - paths: - - '**/*.py' - - '.pylintrc' - - '!third_party/**' +on: [push] +# push: +# paths: +# - '**/*.py' +# - '.pylintrc' +# - '!third_party/**' jobs: pylint: runs-on: ubuntu-latest diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0611f1f..a3727a2 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,13 +1,13 @@ -on: - push: - paths: - - 'examples/*.rs' - - 'libraries/**/*.rs' - - 'src/**/*.rs' - - 'patches/**' - - '**/Cargo.toml' - - '.cargo/config' - - '!third_party/**' +on: [push] +# push: +# paths: +# - 'examples/*.rs' +# - 'libraries/**/*.rs' +# - 'src/**/*.rs' +# - 'patches/**' +# - '**/Cargo.toml' +# - '.cargo/config' +# - '!third_party/**' jobs: initial_setup: From ca40818eb6f9a1c0be8df5610f5068a7ae94515f Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Mon, 24 Feb 2020 19:21:12 +0100 Subject: [PATCH 04/19] Fix markdownlint warnings --- docs/install.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/install.md b/docs/install.md index 9eff4fd..59bb7c4 100644 --- a/docs/install.md +++ b/docs/install.md @@ -43,7 +43,7 @@ This guide **does not** cover how to setup the JTAG probe on your system. In order to compile and flash a working OpenSK firmware, you will need the following: -* rustup (can be installed with https://rustup.rs/) +* rustup (can be installed with [Rustup](https://rustup.rs/)) * python3 and pip * the OpenSSL command line tool @@ -329,14 +329,16 @@ If you have issues with the demo website, the following commands should help you understand whether OpenSK was installed properly. When plugging in the USB key, the following line should appear in `lsusb`. -``` + +```shell $ lsusb ... Bus XXX Device YYY: ID 1915:521f Nordic Semiconductor ASA OpenSK ``` You should also see lines similar to the following in `dmesg`. -``` + +```shell $ dmesg ... [XXX] usb A-BB: new full-speed USB device number 00 using xhci_hcd From 949e06ce511282bd9e74577d92f8478b8ca4d9af Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Mon, 24 Feb 2020 19:22:04 +0100 Subject: [PATCH 05/19] Rename workflows --- .github/workflows/mdlint.yml | 2 +- .github/workflows/rust.yml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mdlint.yml b/.github/workflows/mdlint.yml index fad84c8..1925812 100644 --- a/.github/workflows/mdlint.yml +++ b/.github/workflows/mdlint.yml @@ -7,7 +7,7 @@ on: [push] # - '!third_party/**' jobs: - pylint: + mdlint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a3727a2..92a12ed 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,3 +1,4 @@ +name: Cargo check on: [push] # push: # paths: @@ -34,8 +35,8 @@ jobs: name: Cargo format libraries/cbor needs: initial_setup steps: + - runs: cd libraries/crypto - uses: actions-rs/cargo@v1 - working-directory: libraries/cbor with: command: fmt args: --all -- --check @@ -43,8 +44,8 @@ jobs: name: Cargo format libraries/crypto needs: initial_setup steps: + - runs: cd libraries/crypto - uses: actions-rs/cargo@v1 - working-directory: libraries/crypto with: command: fmt args: --all -- --check From ac800aa5d2aefbb5ec3080a0d0f97e72e79970af Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Mon, 24 Feb 2020 19:25:57 +0100 Subject: [PATCH 06/19] Fix typo and pylint --- .github/workflows/pylint.yml | 2 +- .github/workflows/rust.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 431d93c..754f852 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -24,4 +24,4 @@ jobs: - name: Test code with pylint run: | pip install pylint - pylint --rcfile=.pylintrc + pylint --rcfile=.pylintrc `find . -maxdepth 1 -type f -name '*.py'` diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 92a12ed..21738c7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -35,7 +35,7 @@ jobs: name: Cargo format libraries/cbor needs: initial_setup steps: - - runs: cd libraries/crypto + - run: cd libraries/crypto - uses: actions-rs/cargo@v1 with: command: fmt @@ -44,7 +44,7 @@ jobs: name: Cargo format libraries/crypto needs: initial_setup steps: - - runs: cd libraries/crypto + - run: cd libraries/crypto - uses: actions-rs/cargo@v1 with: command: fmt From b18d3097a341a2f289cc0658555bf79c03e31c22 Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Mon, 24 Feb 2020 19:28:14 +0100 Subject: [PATCH 07/19] Fix cargo workflow --- .github/workflows/rust.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 21738c7..1b38e1c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,6 +25,7 @@ jobs: cargo_format_src: name: Cargo format src/ + runs-on: ubuntu-latest needs: initial_setup steps: - uses: actions-rs/cargo@v1 @@ -33,6 +34,7 @@ jobs: args: --all -- --check cargo_format_cbor: name: Cargo format libraries/cbor + runs-on: ubuntu-latest needs: initial_setup steps: - run: cd libraries/crypto @@ -42,6 +44,7 @@ jobs: args: --all -- --check cargo_format_crypto: name: Cargo format libraries/crypto + runs-on: ubuntu-latest needs: initial_setup steps: - run: cd libraries/crypto @@ -51,6 +54,7 @@ jobs: args: --all -- --check cargo_check: name: Cargo Check + runs-on: ubuntu-latest needs: initial_setup steps: - name: Check OpenSK w/o features From a73837cb5983ef139da023667c48aca5dbd7344c Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Mon, 24 Feb 2020 19:31:37 +0100 Subject: [PATCH 08/19] Fix undefined term in Github workflows --- setup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.sh b/setup.sh index ae0fd0c..c4ff228 100755 --- a/setup.sh +++ b/setup.sh @@ -15,6 +15,9 @@ set -e +# Ensure the script doesn't fail on Github workflows +TERM=${TERM:-vt100} + # Check that rustup and pip3 are installed check_command () { if ! which "$1" >/dev/null From dbde04df45de738c335dd7080c180d384ddb5e64 Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Mon, 24 Feb 2020 19:34:39 +0100 Subject: [PATCH 09/19] Fix setup script for Github --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index c4ff228..45b5138 100755 --- a/setup.sh +++ b/setup.sh @@ -16,7 +16,7 @@ set -e # Ensure the script doesn't fail on Github workflows -TERM=${TERM:-vt100} +export TERM=${TERM:-vt100} # Check that rustup and pip3 are installed check_command () { From 111341019555dfe38546318d63025c0086830e2d Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 25 Feb 2020 09:27:57 +0100 Subject: [PATCH 10/19] Debug why Github workflow is failing here --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 45b5138..25dae22 100755 --- a/setup.sh +++ b/setup.sh @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -e +set -ex # Ensure the script doesn't fail on Github workflows export TERM=${TERM:-vt100} From 89d15f5759bc98a36fdba5271c411a7d526547aa Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 25 Feb 2020 09:36:20 +0100 Subject: [PATCH 11/19] Fix tput stopping the workflow --- setup.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/setup.sh b/setup.sh index 25dae22..6f73a5b 100755 --- a/setup.sh +++ b/setup.sh @@ -13,10 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -ex - # Ensure the script doesn't fail on Github workflows export TERM=${TERM:-vt100} +done_text="$(tput bold)DONE.$(tput sgr0)" + +set -ex # Check that rustup and pip3 are installed check_command () { @@ -32,8 +33,6 @@ check_command pip3 # Ensure the submodules are pulled and up-to-date git submodule update --init -done_text="$(tput bold)DONE.$(tput sgr0)" - patch_conflict_detected () { cat < Date: Tue, 25 Feb 2020 09:41:48 +0100 Subject: [PATCH 12/19] Fix missing python dependencies --- .github/workflows/rust.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1b38e1c..1163e41 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -21,6 +21,11 @@ jobs: toolchain: nightly target: thumbv7em-none-eabi override: true + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - run: python -m pip install --upgrade pip setuptools wheel - run: ./setup.sh cargo_format_src: From 51b0e0f48a9ed29a14c49474f52e912e1e9ce23e Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 25 Feb 2020 09:58:52 +0100 Subject: [PATCH 13/19] Revert debug mode --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 6f73a5b..5f9e638 100755 --- a/setup.sh +++ b/setup.sh @@ -17,7 +17,7 @@ export TERM=${TERM:-vt100} done_text="$(tput bold)DONE.$(tput sgr0)" -set -ex +set -e # Check that rustup and pip3 are installed check_command () { From b152bf98d0e55c1795987254b4c721e30e4400dc Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 25 Feb 2020 09:59:10 +0100 Subject: [PATCH 14/19] Remove jobs breakdown/dependencies as it seems to not work? --- .github/workflows/rust.yml | 54 +++++++++++++++----------------------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1163e41..ac3ed4a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,8 +11,7 @@ on: [push] # - '!third_party/**' jobs: - initial_setup: - name: Set up project + cargo: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -21,67 +20,56 @@ jobs: toolchain: nightly target: thumbv7em-none-eabi override: true - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - uses: actions/setup-python@v1 with: python-version: 3.7 - - run: python -m pip install --upgrade pip setuptools wheel - - run: ./setup.sh + - name: Install Python dependencies + run: python -m pip install --upgrade pip setuptools wheel + - name: Set up OpenSK + run: ./setup.sh - cargo_format_src: - name: Cargo format src/ - runs-on: ubuntu-latest - needs: initial_setup - steps: - - uses: actions-rs/cargo@v1 + - name: Cargo format src/ + uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check - cargo_format_cbor: - name: Cargo format libraries/cbor - runs-on: ubuntu-latest - needs: initial_setup - steps: - - run: cd libraries/crypto - - uses: actions-rs/cargo@v1 + + - name: Cargo format libraries/cbor + uses: actions-rs/cargo@v1 with: command: fmt - args: --all -- --check - cargo_format_crypto: - name: Cargo format libraries/crypto - runs-on: ubuntu-latest - needs: initial_setup - steps: - - run: cd libraries/crypto - - uses: actions-rs/cargo@v1 + args: --manifest-path libraries/cbor/Cargo.toml --all -- --check + + - name: Cargo format libraries/crypto + uses: actions-rs/cargo@v1 with: command: fmt - args: --all -- --check - cargo_check: - name: Cargo Check - runs-on: ubuntu-latest - needs: initial_setup - steps: + args: --manifest-path libraries/crypto/Cargo.toml --all -- --check + - name: Check OpenSK w/o features uses: actions-rs/cargo@v1 with: command: check args: --target thumbv7em-none-eabi --release + - name: Check OpenSK with_ctap1 uses: actions-rs/cargo@v1 with: command: check args: --target thumbv7em-none-eabi --release --features with_ctap1 + - name: Check OpenSK debug_ctap uses: actions-rs/cargo@v1 with: command: check args: --target thumbv7em-none-eabi --release --features debug_ctap + - name: Check OpenSK debug_ctap,with_ctap1 uses: actions-rs/cargo@v1 with: command: check args: --target thumbv7em-none-eabi --release --features debug_ctap,with_ctap1 + - name: Check examples uses: actions-rs/cargo@v1 with: From 6c96c639cac44d7ccbd2a08044f1310c2a226ce6 Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 25 Feb 2020 10:06:36 +0100 Subject: [PATCH 15/19] Split cargo fmt and cargo check into 2 workflows --- .../workflows/{rust.yml => cargo_check.yml} | 20 +------- .github/workflows/cargo_fmt.yml | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 19 deletions(-) rename .github/workflows/{rust.yml => cargo_check.yml} (75%) create mode 100644 .github/workflows/cargo_fmt.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/cargo_check.yml similarity index 75% rename from .github/workflows/rust.yml rename to .github/workflows/cargo_check.yml index ac3ed4a..8638a76 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/cargo_check.yml @@ -11,7 +11,7 @@ on: [push] # - '!third_party/**' jobs: - cargo: + cargo_check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -28,24 +28,6 @@ jobs: - name: Set up OpenSK run: ./setup.sh - - name: Cargo format src/ - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - - name: Cargo format libraries/cbor - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --manifest-path libraries/cbor/Cargo.toml --all -- --check - - - name: Cargo format libraries/crypto - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --manifest-path libraries/crypto/Cargo.toml --all -- --check - - name: Check OpenSK w/o features uses: actions-rs/cargo@v1 with: diff --git a/.github/workflows/cargo_fmt.yml b/.github/workflows/cargo_fmt.yml new file mode 100644 index 0000000..f077628 --- /dev/null +++ b/.github/workflows/cargo_fmt.yml @@ -0,0 +1,47 @@ +name: Cargo format +on: [push] +# push: +# paths: +# - 'examples/*.rs' +# - 'libraries/**/*.rs' +# - 'src/**/*.rs' +# - 'patches/**' +# - '**/Cargo.toml' +# - '.cargo/config' +# - '!third_party/**' + +jobs: + cargo_format: + runs-on: ubuntu-latest + 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 + - name: Install Python dependencies + run: python -m pip install --upgrade pip setuptools wheel + - name: Set up OpenSK + run: ./setup.sh + + - name: Cargo format src/ + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Cargo format libraries/cbor + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --manifest-path libraries/cbor/Cargo.toml --all -- --check + + - name: Cargo format libraries/crypto + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --manifest-path libraries/crypto/Cargo.toml --all -- --check From a13f9cf8bc9d9a12a622d268b30323a0f3e5585d Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 25 Feb 2020 10:07:03 +0100 Subject: [PATCH 16/19] Restore path restriction This avoids running workflows when it's not needed --- .github/workflows/mdlint.yml | 12 ++++++------ .github/workflows/pylint.yml | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/mdlint.yml b/.github/workflows/mdlint.yml index 1925812..e57ce7c 100644 --- a/.github/workflows/mdlint.yml +++ b/.github/workflows/mdlint.yml @@ -1,10 +1,10 @@ name: markdownlint -on: [push] -# push: -# paths: -# - '**/*.md' -# - '.markdownlint.json' -# - '!third_party/**' +on: + push: + paths: + - '**/*.md' + - '.markdownlint.json' + - '!third_party/**' jobs: mdlint: diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 754f852..311f945 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -1,10 +1,10 @@ name: pylint -on: [push] -# push: -# paths: -# - '**/*.py' -# - '.pylintrc' -# - '!third_party/**' +on: + push: + paths: + - '**/*.py' + - '.pylintrc' + - '!third_party/**' jobs: pylint: runs-on: ubuntu-latest From 53964b1d61a1d855edf30b3cb62e9d0bcc9884ef Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 25 Feb 2020 10:25:55 +0100 Subject: [PATCH 17/19] Also run checks on pull requests --- .github/workflows/cargo_check.yml | 22 ++++++++++++---------- .github/workflows/cargo_fmt.yml | 22 ++++++++++++---------- .github/workflows/mdlint.yml | 2 ++ .github/workflows/pylint.yml | 2 ++ 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cargo_check.yml b/.github/workflows/cargo_check.yml index 8638a76..e509a42 100644 --- a/.github/workflows/cargo_check.yml +++ b/.github/workflows/cargo_check.yml @@ -1,14 +1,16 @@ name: Cargo check -on: [push] -# push: -# paths: -# - 'examples/*.rs' -# - 'libraries/**/*.rs' -# - 'src/**/*.rs' -# - 'patches/**' -# - '**/Cargo.toml' -# - '.cargo/config' -# - '!third_party/**' +on: + push: + paths: + - 'examples/*.rs' + - 'libraries/**/*.rs' + - 'src/**/*.rs' + - 'patches/**' + - '**/Cargo.toml' + - '.cargo/config' + - '!third_party/**' + pull_request: + types: [opened, synchronize, reopened] jobs: cargo_check: diff --git a/.github/workflows/cargo_fmt.yml b/.github/workflows/cargo_fmt.yml index f077628..177989f 100644 --- a/.github/workflows/cargo_fmt.yml +++ b/.github/workflows/cargo_fmt.yml @@ -1,14 +1,16 @@ name: Cargo format -on: [push] -# push: -# paths: -# - 'examples/*.rs' -# - 'libraries/**/*.rs' -# - 'src/**/*.rs' -# - 'patches/**' -# - '**/Cargo.toml' -# - '.cargo/config' -# - '!third_party/**' +on: + push: + paths: + - 'examples/*.rs' + - 'libraries/**/*.rs' + - 'src/**/*.rs' + - 'patches/**' + - '**/Cargo.toml' + - '.cargo/config' + - '!third_party/**' + pull_request: + types: [opened, synchronize, reopened] jobs: cargo_format: diff --git a/.github/workflows/mdlint.yml b/.github/workflows/mdlint.yml index e57ce7c..1c8a4d5 100644 --- a/.github/workflows/mdlint.yml +++ b/.github/workflows/mdlint.yml @@ -5,6 +5,8 @@ on: - '**/*.md' - '.markdownlint.json' - '!third_party/**' + pull_request: + types: [opened, synchronize, reopened] jobs: mdlint: diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 311f945..08c1f04 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -5,6 +5,8 @@ on: - '**/*.py' - '.pylintrc' - '!third_party/**' + pull_request: + types: [opened, synchronize, reopened] jobs: pylint: runs-on: ubuntu-latest From 59f381c920a10c3cf1d68aceb51a8d60d7d54c29 Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 25 Feb 2020 10:26:12 +0100 Subject: [PATCH 18/19] Add badges --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e288de0..34d7a9b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # OpenSK logo [![Build Status](https://travis-ci.org/google/OpenSK.svg?branch=master)](https://travis-ci.org/google/OpenSK) +![markdownlint](https://github.com/google/OpenSK/workflows/markdownlint/badge.svg?branch=master) +![pylint](https://github.com/google/OpenSK/workflows/pylint/badge.svg?branch=master) +![Cargo check](https://github.com/google/OpenSK/workflows/Cargo%20check/badge.svg?branch=master) +![Cargo format](https://github.com/google/OpenSK/workflows/Cargo%20format/badge.svg?branch=master) ## OpenSK From 9de4662deed4af45be2dcf597d02aaff1eaad4c8 Mon Sep 17 00:00:00 2001 From: Jean-Michel Picod Date: Tue, 25 Feb 2020 14:12:37 +0100 Subject: [PATCH 19/19] Add more checks - python code formatting is tested with yapf - cron workflow to run cargo audit - Don't run on latest --- .github/workflows/cargo_audit.yml | 24 ++++++++++++++++++++ .github/workflows/cargo_check.yml | 2 +- .github/workflows/cargo_fmt.yml | 2 +- .github/workflows/mdlint.yml | 3 ++- .github/workflows/{pylint.yml => python.yml} | 19 ++++++++++++++-- 5 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/cargo_audit.yml rename .github/workflows/{pylint.yml => python.yml} (53%) diff --git a/.github/workflows/cargo_audit.yml b/.github/workflows/cargo_audit.yml new file mode 100644 index 0000000..94b00f6 --- /dev/null +++ b/.github/workflows/cargo_audit.yml @@ -0,0 +1,24 @@ +name: Security audit +on: + schedule: + - cron: '0 0 * * *' +jobs: + audit: + runs-on: ubuntu-18.04 + 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 + - name: Install Python dependencies + run: python -m pip install --upgrade pip setuptools wheel + - name: Set up OpenSK + run: ./setup.sh + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cargo_check.yml b/.github/workflows/cargo_check.yml index e509a42..9697b37 100644 --- a/.github/workflows/cargo_check.yml +++ b/.github/workflows/cargo_check.yml @@ -14,7 +14,7 @@ on: jobs: cargo_check: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/cargo_fmt.yml b/.github/workflows/cargo_fmt.yml index 177989f..324b475 100644 --- a/.github/workflows/cargo_fmt.yml +++ b/.github/workflows/cargo_fmt.yml @@ -14,7 +14,7 @@ on: jobs: cargo_format: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/mdlint.yml b/.github/workflows/mdlint.yml index 1c8a4d5..c697e0c 100644 --- a/.github/workflows/mdlint.yml +++ b/.github/workflows/mdlint.yml @@ -10,11 +10,12 @@ on: jobs: mdlint: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - name: markdownlint-cli uses: nosborn/github-action-markdown-cli@v1.1.1 with: files: '**/*.md' + ignore_files: "third_party/*" config_file: ".markdownlint.json" diff --git a/.github/workflows/pylint.yml b/.github/workflows/python.yml similarity index 53% rename from .github/workflows/pylint.yml rename to .github/workflows/python.yml index 08c1f04..dc739b8 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/python.yml @@ -9,7 +9,7 @@ on: types: [opened, synchronize, reopened] jobs: pylint: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 strategy: matrix: python-version: [3.6, 3.7, 3.8] @@ -26,4 +26,19 @@ jobs: - name: Test code with pylint run: | pip install pylint - pylint --rcfile=.pylintrc `find . -maxdepth 1 -type f -name '*.py'` + pylint --rcfile=.pylintrc --score=n `find . ! -path "./third_party/*" -type f -name '*.py'` + + yapf: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + pip install yapf + - name: Test code formatting with yapf + run: yapf --style=chromium --recursive --exclude third_party --diff .