Skip to content

Commit

Permalink
Enable extensions for Windows release artifacts (#1498)
Browse files Browse the repository at this point in the history
This change enables the extensions feature when building Windows release artifacts. Doing so will enable the `phylum-ci` tool to continue to operate with its extension-based analysis for the coming Windows standalone binary. Additional changes include:

* Consolidate `windows` job in `Test` workflow with `test-matrix` job
* Add Windows runner to `clippy` and `oldstable` `Test` workflow jobs
  * Fix Windows clippy findings
* Remove extraneous `cmake` installs on macOS runners
* Fix `shellcheck` and `actionlint` findings
* Format throughout
  • Loading branch information
maxrake authored Sep 19, 2024
1 parent 4214a09 commit 48325b6
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 33 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- target: x86_64-pc-windows-msvc
os: windows-latest
extension: .exe
flags: --no-default-features
flags: --no-default-features -F extensions
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
Expand All @@ -72,6 +72,10 @@ jobs:
name: Install protoc
run: sudo apt update && sudo apt install -y protobuf-compiler

- if: ${{ runner.os == 'Windows' }}
name: Install protoc
run: choco install protoc

- if: ${{ runner.os == 'Windows' }}
name: Install Rust toolchain
run: rustup toolchain install stable --profile minimal --target ${{ matrix.target }}
Expand Down
77 changes: 48 additions & 29 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ on:
- cron: '30 5 * * 1'

jobs:
windows:
runs-on: windows-latest
steps:
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Install Rust toolchain
run: rustup toolchain install --no-self-update stable --profile minimal

- name: Test
run: cargo +stable test --locked --no-default-features

rustfmt:
if: github.event_name != 'schedule'
runs-on: ubuntu-20.04
Expand All @@ -43,72 +31,95 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-14]
include:
- os: ubuntu-20.04
flags: --all-features
- os: macos-14
flags: --all-features
- os: windows-latest
flags: --no-default-features -F extensions
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- if: ${{ runner.os == 'macOS' }}
name: Install protoc
run: brew install cmake protobuf
run: brew install protobuf

- if: ${{ runner.os == 'Linux' }}
name: Install protoc
run: sudo apt install -y protobuf-compiler

- if: ${{ runner.os == 'Windows' }}
name: Install protoc
run: choco install protoc

- name: Install Rust toolchain
run: rustup toolchain install --no-self-update stable --profile minimal -c clippy

- name: Clippy
run: cargo +stable clippy --locked --all-features --all-targets -- -D warnings
run: cargo +stable clippy --locked ${{ matrix.flags }} --all-targets -- -D warnings

test-matrix:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-14]
include:
- os: windows-latest
flags: --no-default-features -F extensions
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- if: ${{ runner.os == 'macOS' }}
name: Install protoc
run: brew install cmake protobuf
run: brew install protobuf

- if: ${{ runner.os == 'Linux' }}
name: Install protoc
run: sudo apt install -y protobuf-compiler

- if: ${{ runner.os == 'Windows' }}
name: Install protoc
run: choco install protoc

- name: Install Rust toolchain
run: rustup toolchain install --no-self-update stable --profile minimal

- name: Test
run: cargo +stable test --locked
run: cargo +stable test --locked ${{ matrix.flags }}

oldstable:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-14]
os: [ubuntu-20.04, macos-14, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- if: ${{ runner.os == 'macOS' }}
name: Install protoc
run: brew install cmake protobuf
run: brew install protobuf

- if: ${{ runner.os == 'Linux' }}
name: Install protoc
run: sudo apt install -y protobuf-compiler

- if: ${{ runner.os == 'Windows' }}
name: Install protoc
run: choco install protoc

- name: Oldstable
shell: bash
run: |
oldstable=$(cat "./cli/Cargo.toml" | grep "rust-version" | sed 's/.*"\(.*\)".*/\1/')
rustup toolchain install --profile minimal "$oldstable"
cargo "+$oldstable" check
oldstable=$(grep rust-version ./cli/Cargo.toml | sed 's/.*"\(.*\)".*/\1/')
rustup toolchain install --profile minimal "${oldstable}"
cargo "+${oldstable}" check
all-features:
# Skip this job when the secret is unavailable
Expand All @@ -123,7 +134,7 @@ jobs:

- if: ${{ runner.os == 'macOS' }}
name: Install protoc
run: brew install cmake protobuf
run: brew install protobuf

- if: ${{ runner.os == 'Linux' }}
name: Install protoc
Expand All @@ -142,26 +153,34 @@ jobs:
runs-on: ubuntu-latest
container: denoland/deno
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: deno fmt
run: deno fmt --check

- name: deno lint
run: deno lint

- name: deno check
run: deno check --no-lock extensions/**/*.ts

shellcheck:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Checkout the repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Script Style Check
if: github.event_name != 'schedule'
run: shellcheck -o all -S style -s sh $(find . -iname "*.sh")
run: find . -iname "*.sh" -print0 | xargs -0 shellcheck -o all -S style -s sh

# This job reports the results of the matrixes above
# This job reports the results of the test jobs above and is used
# to enforce status checks in the repo settings without needing
# to update those settings every time the test jobs are updated.
test:
if: always()
needs: [windows, clippy, test-matrix, all-features, oldstable]
needs: [clippy, test-matrix, oldstable, all-features]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Added

- Extensions for Windows release artifacts

## 7.0.0 - 2024-09-17

### Added
Expand Down
2 changes: 1 addition & 1 deletion bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ printf "\nFiles to be added and committed with message: \"%s\"\n\n" "${commit_me
git status

printf "Press enter to proceed with the commit..."
read -r
read -r _

git commit -F - <<EOF
${commit_message}
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/extensions/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn correct_sandbox_run_permission_fail_on_windows() {
.success();

test_cli
.run(&["correct-run-perms"])
.run(["correct-run-perms"])
.failure()
.stderr(predicate::str::contains("Extension sandboxing is not supported on this platform"));
}
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/gendocs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ fn pages() -> Result<Vec<(PathBuf, String)>> {
Ok(pages)
}

#[cfg(feature = "full-docs")]
#[cfg(test)]
mod tests {
use std::env;

use super::*;

/// Ensure the generate CLI docs are always up-to-date.
#[cfg(feature = "full-docs")]
#[test]
fn docs_up_to_date() {
// Move to project root.
Expand Down

0 comments on commit 48325b6

Please sign in to comment.