Utilize Merigify's Merge Queue (#1243) #4
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: Rust | |
on: | |
pull_request: | |
types: [ labeled ] | |
push: | |
branches: [ main ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
format: | |
name: Format | |
if: | | |
github.event_name == 'pull_request' && | |
(contains(github.event.pull_request.labels.*.name, 's:review-needed') || | |
contains(github.event.pull_request.labels.*.name, 's:accepted')) || | |
github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install build tools | |
run: ./scripts/init.sh | |
# TODO(#1125): Use actions-rs/install for Taplo once stable | |
# - uses: actions-rs/[email protected] | |
# with: | |
# crate: taplo-cli | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@v1 | |
- name: Format | |
run: ./scripts/tests/format.sh --check | |
copyright: | |
name: Copyright Notices | |
if: | | |
github.event_name == 'pull_request' && | |
(contains(github.event.pull_request.labels.*.name, 's:review-needed') || | |
contains(github.event.pull_request.labels.*.name, 's:accepted')) || | |
github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
- name: Install check-license and dependencies | |
run: | | |
pip install scripts/check-license | |
pip install -r scripts/check-license/requirements.txt | |
- name: Query files changed | |
id: files_changed | |
uses: Ana06/[email protected] | |
with: | |
filter: '*.rs$' | |
- name: Check copyright notices | |
run: check-license ${{ steps.files_changed.outputs.added_modified }} | |
checks: | |
name: Checks | |
if: | | |
github.event_name == 'pull_request' && | |
(contains(github.event.pull_request.labels.*.name, 's:review-needed') || | |
contains(github.event.pull_request.labels.*.name, 's:accepted')) || | |
github.event_name == 'push' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
scripts: [ | |
"clippy", | |
"parachain", | |
"standalone" | |
] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install build tools | |
run: ./scripts/init.sh | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@v2 | |
- name: Checks | |
run: ./scripts/tests/${{ matrix.scripts }}.sh | |
benchmark: | |
name: Quick check benchmarks | |
if: | | |
github.event_name == 'pull_request' && | |
(contains(github.event.pull_request.labels.*.name, 's:review-needed') || | |
contains(github.event.pull_request.labels.*.name, 's:accepted')) || | |
github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install build tools | |
run: ./scripts/init.sh | |
- run: ./scripts/benchmarks/quick_check.sh | |
test_standalone: | |
name: Test standalone build | |
if: | | |
github.event_name == 'pull_request' && | |
(contains(github.event.pull_request.labels.*.name, 's:review-needed') || | |
contains(github.event.pull_request.labels.*.name, 's:accepted')) || | |
github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install build tools | |
run: ./scripts/init.sh | |
# No disk space: https://github.com/zeitgeistpm/zeitgeist/actions/runs/5085081984/jobs/9144298675?pr=1006 | |
# Workaround: https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 | |
- name: Free up disk space on GitHub hosted runners | |
run: | | |
# Ensure context is GitHub hosted runner | |
# https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context | |
if [[ "${{ runner.name }}" == "GitHub Actions"* ]]; then | |
echo "Freeing up space in GitHub hosted runner" | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
fi | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@v1 | |
- name: Tests | |
run: ./scripts/tests/test_standalone.sh | |
test_parachain: | |
name: Test parachain build | |
if: | | |
github.event_name == 'pull_request' && | |
(contains(github.event.pull_request.labels.*.name, 's:review-needed') || | |
contains(github.event.pull_request.labels.*.name, 's:accepted')) || | |
github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install build tools | |
run: ./scripts/init.sh | |
# No disk space: https://github.com/zeitgeistpm/zeitgeist/actions/runs/5085081984/jobs/9144298675?pr=1006 | |
# Workaround: https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 | |
- name: Free up disk space on GitHub hosted runners | |
run: | | |
# Ensure context is GitHub hosted runner | |
# https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context | |
if [[ "${{ runner.name }}" == "GitHub Actions"* ]]; then | |
echo "Freeing up space in GitHub hosted runner" | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
fi | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@v1 | |
- name: Tests | |
run: ./scripts/tests/test_parachain.sh | |
fuzz: | |
name: Fuzz | |
if: | | |
github.event_name == 'pull_request' && | |
(contains(github.event.pull_request.labels.*.name, 's:review-needed') || | |
contains(github.event.pull_request.labels.*.name, 's:accepted')) || | |
github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install build tools | |
run: ./scripts/init.sh | |
- uses: actions-rs/[email protected] | |
with: | |
crate: cargo-fuzz | |
use-tool-cache: true | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@v1 | |
- run: ./scripts/tests/fuzz.sh --verbose |