Merge pull request #875 from bbannier/dependabot/npm_and_yarn/vscode/… #2345
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
env: | |
CARGO_INCREMENTAL: 0 | |
RUSTFLAGS: -D warnings | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
name: | |
- linux-x86-64-gnu | |
- mac-x86-64 | |
include: | |
- name: linux-x86-64-gnu | |
os: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
- name: mac-x86-64 | |
os: macos-latest | |
target: x86_64-apple-darwin | |
name: Binaries for ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.os }}-cargo-${{ hashFiles('Cargo.lock') }} | |
- name: Install Zeek | |
run: | | |
# shellcheck disable=SC2193 | |
if [[ ${{ matrix.name }} == *linux* ]]; then | |
echo 'deb http://download.opensuse.org/repositories/security:/zeek/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/security:zeek.list | |
curl -fsSL https://download.opensuse.org/repositories/security:zeek/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/security_zeek.gpg > /dev/null | |
sudo apt-get update | |
sudo apt-get install -y zeek | |
echo /opt/zeek/bin >> "${GITHUB_PATH}" | |
elif [[ ${{ matrix.name }} == *mac* ]]; then | |
brew install zeek | |
fi | |
- name: Test | |
run: cargo test --workspace | |
- name: Test all features | |
run: cargo test --all-features --workspace | |
- name: Build | |
run: cargo build --release --locked --target ${{ matrix.target }} | |
env: | |
RUSTFLAGS: -C target-feature=+crt-static | |
- name: Upload artifacts | |
uses: actions/[email protected] | |
with: | |
name: zeek-language-server-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/zeek-language-server | |
pre-commit: | |
name: Run pre-commit hooks | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: pre-commit-cargo-${{ hashFiles('Cargo.lock') }} | |
- uses: actions/setup-python@v5 | |
- uses: pre-commit/[email protected] | |
vscode: | |
name: Build vscode extension | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
- run: | | |
cd vscode | |
npm install | |
npm install -g @vscode/vsce | |
- name: Lint | |
run: | | |
cd vscode | |
npm run lint | |
- run: | | |
cd vscode | |
vsce package | |
- name: Upload artifacts | |
uses: actions/[email protected] | |
with: | |
path: vscode/*.vsix | |
name: vscode_extension.zip | |
benchmarks: | |
name: Run benchmarks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install Zeek | |
run: | | |
echo 'deb http://download.opensuse.org/repositories/security:/zeek/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/security:zeek.list | |
curl -fsSL https://download.opensuse.org/repositories/security:zeek/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/security_zeek.gpg > /dev/null | |
sudo apt-get update | |
sudo apt-get install -y zeek | |
echo /opt/zeek/bin >> "${GITHUB_PATH}" | |
- name: Setup rust toolchain, cache and cargo-codspeed binary | |
uses: moonrepo/setup-rust@v1 | |
with: | |
channel: stable | |
cache-target: release | |
bins: cargo-codspeed | |
- name: Build the benchmark target(s) | |
run: cargo codspeed build | |
- name: Run the benchmarks | |
uses: CodSpeedHQ/action@v3 | |
with: | |
run: cargo codspeed run | |
token: ${{ secrets.CODSPEED_TOKEN }} |