Skip to content

Commit

Permalink
refactor use-nix -> nix-shell
Browse files Browse the repository at this point in the history
Signed-off-by: Thing-han, Lim <[email protected]>
  • Loading branch information
potsrevennil committed Sep 13, 2024
1 parent 68d322b commit 31c39eb
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 34 deletions.
14 changes: 7 additions & 7 deletions .github/actions/bench/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ inputs:
gh_token:
description: GitHub access token
required: true
use-nix:
description: Whether to run in the default Nix environment
default: "true"
nix-shell:
description: Run in the specified Nix environment if exists
default: "ci"
custom_shell:
description: The shell to use. Only relevant if use-nix is "false"
description: The shell to use. Only relevant if no nix-shell specified
default: "bash"
cross_prefix:
description: "Binary prefix for cross-compilation builds"
Expand All @@ -42,10 +42,10 @@ runs:
using: composite
steps:
- name: Setup nix
if: ${{ inputs.use-nix }}
if: ${{ inputs.nix-shell != '' }}
uses: ./.github/actions/setup-nix
with:
devShell: ci
devShell: ${{ inputs.nix-shell }}
script: |
ARCH=$(uname -m)
cat >> $GITHUB_STEP_SUMMARY <<-EOF
Expand All @@ -61,7 +61,7 @@ runs:
EOF
- name: Set shell
shell: bash
run: echo SHELL="${{ inputs.use-nix && 'nix develop .#ci -c bash -e {0}' || inputs.custom_shell }}" >> $GITHUB_ENV
run: echo SHELL="${{ inputs.nix-shell != '' && 'nix develop .#${{ inputs.nix-shell }} -c bash -e {0}' || inputs.custom_shell }}" >> $GITHUB_ENV
- name: Run benchmark
shell: ${{ env.SHELL }}
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/actions/cbmc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name: CBMC
description: Run CBMC proofs for MLKEM-C_AArch64

inputs:
use-nix:
description: Whether to run in the default Nix environment
default: "true"
nix-shell:
description: Run in the specified Nix environment if exists
default: "ci-cbmc"
custom_shell:
description: The shell to use. Only relevant if use-nix is 'false'
default: "bash"
Expand All @@ -18,10 +18,10 @@ runs:
steps:
- uses: actions/checkout@v4
- name: Setup nix
if: ${{ inputs.use-nix }}
if: ${{ inputs.nix-shell != '' }}
uses: ./.github/actions/setup-nix
with:
devShell: ci-cbmc
devShell: ${{ inputs.nix-shell }}
script: |
cat >> $GITHUB_STEP_SUMMARY << EOF
## Setup
Expand All @@ -35,7 +35,7 @@ runs:
EOF
- name: Set shell
shell: bash
run: echo SHELL="${{ inputs.use-nix && 'nix develop .#ci-cbmc -c bash -e {0}' || inputs.custom_shell }}" >> $GITHUB_ENV
run: echo SHELL="${{ inputs.nix-shell != '' && 'nix develop .#${{ inputs.nix-shell }} -c bash -e {0}' || inputs.custom_shell }}" >> $GITHUB_ENV
- name: Run CBMC proofs
shell: ${{ env.SHELL }}
run: |
Expand Down
15 changes: 9 additions & 6 deletions .github/actions/functest/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ name: Functional tests
description: Run functional tests for MLKEM-C_AArch64

inputs:
use-nix:
description: Whether to run in the default Nix environment
default: "true"
nix-shell:
description: Run in the specified Nix environment if exists
default: "ci"
custom_shell:
description: The shell to use. Only relevant if no nix-shell specified
default: "bash"
cflags:
description: CFLAGS to pass to compilation
default: ""
Expand All @@ -21,9 +24,9 @@ runs:
steps:
- name: Setup nix
uses: ./.github/actions/setup-nix
if: ${{ inputs.use-nix }}
if: ${{ inputs.nix-shell != '' }}
with:
devShell: ci
devShell: ${{ inputs.nix-shell }}
script: |
ARCH=$(uname -m)
cat >> $GITHUB_STEP_SUMMARY <<-EOF
Expand All @@ -36,7 +39,7 @@ runs:
EOF
- name: Set shell
shell: bash
run: echo SHELL="${{ inputs.use-nix && 'nix develop .#ci -c bash -e {0}' || inputs.custom_shell }}" >> $GITHUB_ENV
run: echo SHELL="${{ inputs.nix-shell != '' && 'nix develop .#${{ inputs.nix-shell }} -c bash -e {0}' || inputs.custom_shell }}" >> $GITHUB_ENV
- name: Run functional tests
id: func_test
shell: ${{ env.SHELL }}
Expand Down
14 changes: 7 additions & 7 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ name: Lint
description: Lint MLKEM-C_AArch64

inputs:
use-nix:
description: Whether to run in the default Nix environment
default: "true"
nix-shell:
description: Run in the specified Nix environment if exists
default: "ci-linter"
custom_shell:
description: The shell to use. Only relevant if use-nix is 'false'
description: The shell to use. Only relevant if no nix-shell specified
default: "bash"
cross-prefix:
description: Binary prefix for cross compilation
Expand All @@ -17,10 +17,10 @@ runs:
using: composite
steps:
- name: Setup nix
if: ${{ inputs.use-nix }}
if: ${{ inputs.nix-shell != '' }}
uses: ./.github/actions/setup-nix
with:
devShell: ci-linter
devShell: ${{ inputs.nix-shell }}
script: |
cat >> $GITHUB_STEP_SUMMARY << EOF
## Setup
Expand All @@ -33,7 +33,7 @@ runs:
EOF
- name: Set shell
shell: bash
run: echo SHELL="${{ inputs.use-nix && 'nix develop .#ci-linter -c bash -e {0}' || inputs.custom_shell }}" >> $GITHUB_ENV
run: echo SHELL="${{ inputs.nix-shell != '' && 'nix develop .#${{ inputs.nix-shell }} -c bash -e {0}' || inputs.custom_shell }}" >> $GITHUB_ENV
- name: Run linter
shell: ${{ env.SHELL }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bench_ec2_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/bench
with:
use-nix: true
nix-shell: ci
name: ${{ inputs.name }}
cflags: ${{ inputs.cflags }}
archflags: ${{ inputs.archflags }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ jobs:
- name: functest opt
uses: ./.github/actions/functest
with:
use-nix: true
nix-shell: ci
cflags: ${{ matrix.target.cflags }}
cross-prefix: ${{ matrix.target.cross-prefix }}
opt: true
- name: functest non-opt
uses: ./.github/actions/functest
with:
use-nix: true
nix-shell: ci
cflags: ${{ matrix.target.cflags }}
cross-prefix: ${{ matrix.target.cross-prefix }}
opt: false
Expand All @@ -70,7 +70,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/lint
with:
use-nix: true
nix-shell: ci-linter
cross-prefix: "aarch64-unknown-linux-gnu-"
cbmc:
strategy:
Expand All @@ -82,4 +82,4 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/cbmc
with:
use-nix: true
nix-shell: ci-cbmc
6 changes: 3 additions & 3 deletions .github/workflows/ci_ec2_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/functest
with:
use-nix: true
nix-shell: ci
cflags: ${{ inputs.cflags }}
cross-prefix: ${{ inputs.cross-prefix }}
opt: ${{ inputs.opt }}
Expand All @@ -117,7 +117,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/lint
with:
use-nix: true
nix-shell: ci-linter
cross-prefix: ${{ inputs.cross-prefix }}
cbmc:
name: CBMC ${{ inputs.name }}
Expand All @@ -128,7 +128,7 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/cbmc
with:
use-nix: true
nix-shell: ci-cbmc
cross-prefix: ${{ inputs.cross-prefix }}
stop-ec2-runner:
name: Stop ${{ inputs.name }} (${{ inputs.ec2_instance_type }})
Expand Down

0 comments on commit 31c39eb

Please sign in to comment.