From 31c39ebe99a76da389267689312044b6a739feb9 Mon Sep 17 00:00:00 2001 From: "Thing-han, Lim" <15379156+potsrevennil@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:19:35 +0800 Subject: [PATCH] refactor use-nix -> nix-shell Signed-off-by: Thing-han, Lim <15379156+potsrevennil@users.noreply.github.com> --- .github/actions/bench/action.yml | 14 +++++++------- .github/actions/cbmc/action.yml | 12 ++++++------ .github/actions/functest/action.yml | 15 +++++++++------ .github/actions/lint/action.yml | 14 +++++++------- .github/workflows/bench_ec2_reusable.yml | 2 +- .github/workflows/ci.yml | 8 ++++---- .github/workflows/ci_ec2_reusable.yml | 6 +++--- 7 files changed, 37 insertions(+), 34 deletions(-) diff --git a/.github/actions/bench/action.yml b/.github/actions/bench/action.yml index 6ef1d5be8..bdd270e97 100644 --- a/.github/actions/bench/action.yml +++ b/.github/actions/bench/action.yml @@ -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" @@ -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 @@ -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: | diff --git a/.github/actions/cbmc/action.yml b/.github/actions/cbmc/action.yml index 73318c1f9..5faf3773f 100644 --- a/.github/actions/cbmc/action.yml +++ b/.github/actions/cbmc/action.yml @@ -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" @@ -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 @@ -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: | diff --git a/.github/actions/functest/action.yml b/.github/actions/functest/action.yml index 4aa259f4c..9d8933a90 100644 --- a/.github/actions/functest/action.yml +++ b/.github/actions/functest/action.yml @@ -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: "" @@ -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 @@ -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 }} diff --git a/.github/actions/lint/action.yml b/.github/actions/lint/action.yml index aa1f95ddf..972cc7662 100644 --- a/.github/actions/lint/action.yml +++ b/.github/actions/lint/action.yml @@ -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 @@ -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 @@ -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: | diff --git a/.github/workflows/bench_ec2_reusable.yml b/.github/workflows/bench_ec2_reusable.yml index 97685a3d0..d63b5f59e 100644 --- a/.github/workflows/bench_ec2_reusable.yml +++ b/.github/workflows/bench_ec2_reusable.yml @@ -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 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c381c17c..5e6013142 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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: @@ -82,4 +82,4 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/cbmc with: - use-nix: true + nix-shell: ci-cbmc diff --git a/.github/workflows/ci_ec2_reusable.yml b/.github/workflows/ci_ec2_reusable.yml index c703606b2..311b4039b 100644 --- a/.github/workflows/ci_ec2_reusable.yml +++ b/.github/workflows/ci_ec2_reusable.yml @@ -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 }} @@ -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 }} @@ -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 }})