chore: upload xline logs if validation failed #27
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: PR Checks | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: [master] | |
jobs: | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
env: | |
SCCACHE_GHA_ENABLED: "on" | |
container: ghcr.io/xline-kv/build-env:latest | |
strategy: | |
fail-fast: true | |
matrix: | |
config: | |
- { | |
name: "Normal", | |
args: "", | |
rustflags: "", | |
test: "llvm-cov nextest --all-features --workspace --lcov --output-path lcov.info", | |
} | |
- { | |
name: "Madsim", | |
args: "--package=simulation", | |
rustflags: "--cfg madsim", | |
test: "nextest run --package=simulation", | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Configure sccache | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Trailing spaces check | |
run: ci/scripts/check-trailing-spaces.sh | |
- name: Audit | |
run: cargo audit | |
- name: Format | |
run: cargo fmt --all -- --check | |
- name: Sort crates | |
run: cargo sort --check --workspace | |
- name: Workspace hack check | |
run: cargo hakari generate --diff && cargo hakari manage-deps --dry-run && cargo hakari verify | |
- run: sccache --zero-stats > /dev/null | |
- name: Clippy ${{ matrix.config.name }} | |
env: | |
RUSTFLAGS: ${{ matrix.config.rustflags }} | |
run: cargo clippy ${{ matrix.config.args }} --all-targets --all-features -- -D warnings | |
- name: Sccache stats ${{ matrix.config.name }} | |
run: sccache --show-stats && sccache --zero-stats > /dev/null | |
- name: Test ${{ matrix.config.name }} | |
env: | |
RUSTFLAGS: ${{ matrix.config.rustflags }} | |
run: cargo ${{ matrix.config.test }} | |
- name: Sccache stats ${{ matrix.config.name }} | |
run: sccache --show-stats | |
- name: Upload coverage to Codecov | |
if: matrix.config.name == 'Normal' | |
run: | | |
set -euo pipefail | |
curl -Os https://uploader.codecov.io/latest/linux/codecov && chmod +x codecov | |
max_retry=5 | |
counter=0 | |
until ./codecov -t ${{ secrets.CODECOV_TOKEN }} -f lcov.info 2>&1 | grep -q 'Uploading' | |
do | |
sleep 1 | |
[[ counter -eq $max_retry ]] && echo "Upload failed!" && exit 1 | |
echo "Uploading again. Try #$counter" | |
((counter++)) | |
done | |
commit: | |
name: Commit Message Validation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: git show-ref | |
- uses: actions-rs/[email protected] | |
with: | |
crate: git-cz | |
version: latest | |
- name: Validate commit messages | |
run: git-cz check ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | |
spell-check: | |
name: Spell Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check Spelling | |
uses: crate-ci/typos@master |