Skip to content

Commit

Permalink
Add astyle test to Github Workflow (#24)
Browse files Browse the repository at this point in the history
* Add astyle test to Github Workflow

Signed-off-by: Duc Tri Nguyen <[email protected]>

* Sync with mlkem-c-embedded build.yml

Signed-off-by: Duc Tri Nguyen <[email protected]>

* Removed Nix packages

Signed-off-by: Duc Tri Nguyen <[email protected]>

* Add sudo

Signed-off-by: Duc Tri Nguyen <[email protected]>

* Add falke and use nix package to have stable astyle version

Signed-off-by: Duc Tri Nguyen <[email protected]>

* remove unused dependency

Signed-off-by: Duc Tri Nguyen <[email protected]>

* Add test (#22)

* Add test

Signed-off-by: Duc Tri Nguyen <[email protected]>

* Remove test_vector, because it's not important

Signed-off-by: Duc Tri Nguyen <[email protected]>

* Add MLKEM C reference code (#19)

Signed-off-by: Duc Tri Nguyen <[email protected]>

* Add randombytes (#20)

Signed-off-by: Duc Tri Nguyen <[email protected]>

* Add fips202 (#21)

Signed-off-by: Duc Tri Nguyen <[email protected]>

---------

Signed-off-by: Duc Tri Nguyen <[email protected]>

* refactor build.yml

Signed-off-by: Duc Tri Nguyen <[email protected]>

* move to inner folder

Signed-off-by: Duc Tri Nguyen <[email protected]>

---------

Signed-off-by: Duc Tri Nguyen <[email protected]>
  • Loading branch information
cothan authored Apr 1, 2024
1 parent a53a27a commit 1d7577b
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/actions/setup-nix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-License-Identifier: Apache-2.0

name: Setup nix
description: Setup nix

runs:
using: composite
steps:
- uses: nixbuild/nix-quick-install-action@v27
with: {load_nixConfig: false}
- name: Prepare nix dev shell
shell: nix develop .#ci -c bash -e {0}
run: |
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-License-Identifier: Apache-2.0

name: Build
on:
push:
branches: [ '*' ]
pull_request:
branches: [ "main" ]
jobs:
build_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup nix
uses: ./.github/actions/setup-nix
- name: Astyle
shell: nix develop .#ci -c bash -e {0}
run: |
err=$(astyle $(git ls-files "*.c" "*.h") --options=.astylerc --dry-run --formatted | awk '{print $2}')
if [[ ${#err} != 0 ]]; then
echo "$err" | while IFS= read -r file; do
echo "::error file={"$file"},title={checking}::Formatted $file"
done
exit 1
fi
- name: Build targets
shell: nix develop .#ci -c bash -e {0}
run: |
make
48 changes: 48 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-License-Identifier: Apache-2.0

{
description = "mlkem-c-aarch64";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";

flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};

outputs = inputs@{ flake-parts, nixpkgs, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ ];
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { pkgs, system, inputs', ... }:
let
core = with pkgs; [
# formatter & linters
astyle # 3.4.10
];
in
{
devShells.default = with pkgs; mkShellNoCC {
packages = core ++ [
direnv
nix-direnv

# formatter & linters
nixpkgs-fmt
shfmt
codespell
];

shellHook = ''
export PATH=$PWD/dev-support/bin:$PATH
'';
};

devShells.ci = with pkgs; mkShellNoCC {
packages = core;
};

};
flake = {
# The usual flake attributes can be defined here, including system-
# agnostic ones like nixosModule and system-enumerating ones, although
# those are more easily expressed in perSystem.

};
};
}

0 comments on commit 1d7577b

Please sign in to comment.