Skip to content

fix(ci): fix zip package for windows in release workflow #164

fix(ci): fix zip package for windows in release workflow

fix(ci): fix zip package for windows in release workflow #164

## Workflow triggered by pull_request and pushes on master branch
# Due to limitations we are checking compilation but testing everything on the Ubuntu environment only.
name: build-test-and-lint
on:
push:
branches: [ "master", "release/*" ]
pull_request:
branches: [ master ]
types: [opened, reopened, synchronize, ready_for_review]
schedule:
# Run on the 3rd of every month at 2:01
- cron: '1 2 3 * *'
workflow_dispatch:
inputs:
branch_commit_or_ref:
description: 'Run this workflow in what branch/commit?'
required: true
type: string
default: master
jobs:
run_when:
# it succeeds if any of the following conditions are met:
# - when the PR is not a draft and is not labeled 'prevent-ci'
runs-on: ubuntu-latest
if: (!github.event.pull_request.draft) && (!contains( github.event.pull_request.labels.*.name, 'prevent-ci'))
env:
JOB_GITHUB_REF: ${{ github.head_ref || github.ref }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_commit_or_ref || '' }}
- name: Report Workflow Information
id: workflow_report
uses: ./.github/actions/workflow-info
with:
title: '${{ github.ref_name }}'
parameters: '${{ toJson(inputs) }}'
content: |
- Ref: ${{ github.head_ref }}
ci:
needs: run_when
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
channel: [ stable ]
steps:
# region Checkout and Install
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_commit_or_ref || '' }}
- name: Rustup Self Update
if: matrix.os != 'macos-latest'
shell: bash
run: |
rustup self update
- name: Update Rust toolchain from channel ${{ matrix.channel }}
shell: bash
run: |
rustup update ${{ matrix.channel }}
rustup default ${{ matrix.channel }}
rustup component add llvm-tools
- name: Check Rust ${{ matrix.channel }} toolchain versions
shell: bash
run: |
printf '# Rust Information\n\n' >> "${GITHUB_STEP_SUMMARY}";
printf '## Program Versions on Channel ${{ matrix.channel }}\n\n' >> "${GITHUB_STEP_SUMMARY}";
rustup --version >> "${GITHUB_STEP_SUMMARY}";
cargo --version >> "${GITHUB_STEP_SUMMARY}";
rustc --version >> "${GITHUB_STEP_SUMMARY}";
printf '## Toolchain Information\n\n```sh\n$ rustup show\n' >> "${GITHUB_STEP_SUMMARY}";
rustup show >> "${GITHUB_STEP_SUMMARY}";
printf '\n```\n\n' >> "${GITHUB_STEP_SUMMARY}";
printf '\n\n## Cargo Commands\n\n```sh\n$ cargo --list\n' >> "${GITHUB_STEP_SUMMARY}";
cargo --list >> "${GITHUB_STEP_SUMMARY}";
printf '\n```\n\n' >> "${GITHUB_STEP_SUMMARY}";
# endregion
# region Testing
- name: Run cargo check
shell: bash
run: cargo check --all-features
- name: Run Solr for testing
uses: hoverkraft-tech/[email protected]
if: matrix.os == 'ubuntu-latest'
with:
compose-file: "./docker/docker-compose.yml"
up-flags: "-d"
- name: Run cargo test
shell: bash
run: cargo test
# endregion
# region Linting
- name: Run cargo clippy
if: matrix.os == 'ubuntu-latest'
continue-on-error: true # show all errors
shell: bash
run: cargo clippy --all-features
- name: Check source code for future incompatibilities
id: report_future_incompatibilities
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
echo '::group::Checking Future Incompatibilities';
printf '# Future Incompatibilities\n\n' >> "${GITHUB_STEP_SUMMARY}";
printf '<!-- markdownlint-disable-file MD009 MD027 MD028 MD034 -->\n## Compilation\n\n' >> "${GITHUB_STEP_SUMMARY}";
cargo check --future-incompat-report 2>&1 >> "${GITHUB_STEP_SUMMARY}";
echo '::endgroup::';
echo '::group::Reporting Future Incompatibilities';
printf '\n## Future Incompatibilities Report\n\n' >> "${GITHUB_STEP_SUMMARY}";
if cargo report future-incompatibilities --color never >> "${GITHUB_STEP_SUMMARY}"; then
echo "FUTURE_INCOMPATIBILITIES=1" >> "${GITHUB_OUTPUT}";
echo "::warning file=Cargo.toml,line=15,col=2,endColumn=24,title=FUTURE-INCOMPATIBILITIES::Future imcompatibilities found in source code or dependencies.";
false;
else
echo "FUTURE_INCOMPATIBILITIES=0" >> "${GITHUB_OUTPUT}";
printf 'No future incompatibilities found in this build.\n' >> "${GITHUB_STEP_SUMMARY}";
fi
echo '::endgroup::';
- name: Run cargo fmt
if: matrix.os == 'ubuntu-latest'
shell: bash
run: cargo fmt --check
- name: Run cargo doc
if: matrix.os == 'ubuntu-latest'
shell: bash
run: cargo doc --no-deps --document-private-items --all-features
# endregion
# region Test Coverage
- name: Install cargo-llvm-cov
if: matrix.os == 'ubuntu-latest'
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run coverage report
if: matrix.os == 'ubuntu-latest'
shell: bash
run: cargo llvm-cov --all-features --workspace --lcov --no-cfg-coverage-nightly --output-path lcov.info
- name: Coveralls
if: matrix.os == 'ubuntu-latest'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: './lcov.info'
# endregion
deps:
needs: ci
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
channel: [ stable ]
steps:
# region Environment setup
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch_commit_or_ref || '' }}
- name: Update Rust toolchain from channel ${{ matrix.channel }}
shell: bash
run: |
rustup self update
rustup update ${{ matrix.channel }}
rustup update nightly
rustup default ${{ matrix.channel }}
- name: Check Rust ${{ matrix.channel }} toolchain versions
shell: bash
run: |
rustup --version
cargo --version
rustc --version
rustup show
rustup default
# endregion
# region Run security audit
- name: Intall cargo-audit from channel ${{ matrix.channel }}
shell: bash
run: cargo install cargo-auditable cargo-audit cargo-udeps
- name: Build with dependency lists embedded in the binaries
shell: bash
run: cargo auditable build --release
- name: Run security audit
shell: bash
run: cargo audit bin target/release/solrcopy
# endregion
# region Checking unused dependencies
- name: Print dependency tree
shell: bash
run: cargo tree --verbose --color never
- name: Intall cargo-udeps from channel ${{ matrix.channel }}
shell: bash
run: cargo install cargo-udeps
- name: Find unused dependencies in Cargo.toml
shell: bash
run: cargo +nightly udeps --release
# endregion
# end of file