Run CI on pull_request #6
Workflow file for this run
This file contains 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: Continuous Integration | |
run-name: Run CI on ${{ github.event_name }} | |
on: | |
push: | |
paths: | |
- ".github/workflows/ci.yml" | |
- "Cargo.*" | |
- "src/**" | |
pull_request: | |
paths: | |
- ".github/workflows/ci.yml" | |
- "Cargo.*" | |
- "src/**" | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
ci_code_checks_and_tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
name: Code Checks | |
steps: | |
- name: "Install rust-toolchain stable" | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain : stable | |
components: clippy, rustfmt | |
- name: "Show environment" | |
run: | | |
rustc -vV | |
cargo -vV | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Cargo formatting" | |
id: cargo_fmt | |
if: $${{ always() }} | |
run: cargo fmt --all -- --check | |
- name: "Cargo clippy" | |
id: cargo_clippy | |
if: $${{ always() }} | |
run: cargo clippy --profile=test | |
- name: "Cargo doc" | |
id: cargo_doc | |
env: | |
RUSTDOCFLAGS: "-D warnings" | |
if: $${{ always() }} | |
run: cargo doc | |
- name: Cache Matroska_test_files | |
id: cache-mkv-test-files | |
if: $${{ always() }} | |
uses: actions/cache@v4 | |
with: | |
key: mkv-test-files # static key, no variant needed | |
path: tests/data/test*.mkv | |
- name: Download test files | |
if: ${{ always() && steps.cache-mkv-test-files.outputs.cache-hit != 'true' }} | |
run : | | |
FILE_NAME=matroska_test_w1_1.zip | |
echo "Downloading file ${FILE_NAME}" | |
wget --progress=dot:mega "https://sourceforge.net/projects/matroska/files/test_files/${FILE_NAME}" | |
unzip -o "${FILE_NAME}" -d tests/data *.mkv | |
rm ${FILE_NAME} | |
- name: "Cargo test" | |
id: cargo_test | |
if: $${{ always() }} | |
run: cargo test | |
- name: "Some checks failed" | |
if: ${{ failure() }} | |
run: | | |
echo "### :x: Checks Failed!" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "|Job|Status|" >> $GITHUB_STEP_SUMMARY | |
echo "|---|------|" >> $GITHUB_STEP_SUMMARY | |
echo "|Cargo fmt|${{ steps.cargo_fmt.outcome }}|" >> $GITHUB_STEP_SUMMARY | |
echo "|Cargo clippy|${{ steps.cargo_clippy.outcome }}|" >> $GITHUB_STEP_SUMMARY | |
echo "|Cargo doc|${{ steps.cargo_doc.outcome }}|" >> $GITHUB_STEP_SUMMARY | |
echo "|Cargo test|${{ steps.cargo_test.outcome }}|" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "Please check the failed jobs and fix where needed." >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
- name: "All checks passed" | |
if: ${{ success() }} | |
run: | | |
echo "### :white_check_mark: Checks Passed!" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY |