version: "2.1" executors: stable: docker: - image: liuchong/rustup:stable nightly: docker: - image: liuchong/rustup:nightly beta: docker: - image: liuchong/rustup:beta commands: cargo_test: description: "Run `cargo test`" steps: - run: name: "Clean out rust-toolchain" command: "rm -f rust-toolchain" - run: name: "Toolchain debug info" command: "rustc --version" - run: name: Test command: {{conf.test_commandline.as_str()}} jobs: test: parameters: version: type: executor version_name: type: string executor: << parameters.version >> environment: CI_RUST_VERSION: << parameters.version_name >> steps: - checkout - cargo_test rustfmt: parameters: version: type: executor executor: << parameters.version >> steps: - checkout {%- if conf.rustfmt.install_commandline().is_some() %} - run: name: Install command: {{conf.rustfmt.install_commandline().unwrap()}} {%- endif %} - run: name: Rustfmt command: {{conf.rustfmt.commandline()}} clippy: parameters: version: type: executor executor: << parameters.version >> steps: - checkout {%- if conf.clippy.install_commandline().is_some() %} - run: name: Install command: {{conf.clippy.install_commandline().unwrap()}} {%- endif %} - run: name: Clippy command: {{conf.clippy.commandline()}} bench: parameters: version: type: executor executor: << parameters.version >> steps: - checkout {%- if conf.bench.install_commandline().is_some() %} - run: name: Install command: {{conf.bench.install_commandline().unwrap()}} {%- endif %} - run: name: Bench command: {{conf.bench.commandline()}} {%- for custom in conf.additional_matrix_entries %} {{custom.0}}: parameters: version: type: executor version_name: type: string executor: << parameters.version >> environment: CI_RUST_VERSION: << parameters.version_name >> steps: - checkout {%- if custom.1.install_commandline().is_some() %} - run: name: Install command: {{custom.1.install_commandline().unwrap()}} {%- endif %} - run: name: {{custom.1.commandline()}} command: {{custom.1.commandline()}} {%- endfor %} ci_success: docker: - image: alpine:latest steps: - run: name: Success command: "echo yay" workflows: continuous_integration: jobs: {%- for version in conf.versions %} - test: name: test-{{version}} version: {{version}} version_name: {{version}} filters: {{filters|json}} {%- endfor %} {%- if conf.rustfmt.run() %} - rustfmt: version: {{conf.rustfmt.version()}} filters: {{filters|json}} {%- endif %} {%- if conf.clippy.run() %} - clippy: version: {{conf.clippy.version()}} filters: {{filters|json}} {%- endif %} {%- if conf.bench.run() %} - bench: version: {{conf.bench.version()}} filters: {{filters|json}} {%- endif %} {%- for custom in conf.additional_matrix_entries %} - {{custom.0}}: name: "{{custom.0}}" version: {{custom.1.version()}} version_name: {{custom.1.version()}} {%- endfor %} - ci_success: requires: {%- for version in conf.versions %} - test-{{version}} {%- endfor %} {%- if conf.rustfmt.run() %} - rustfmt {%- endif %} {%- if conf.clippy.run() %} - clippy {%- endif %} {%- if conf.bench.run() %} - bench {%- endif %} {%- for custom in conf.additional_matrix_entries %} {%- if custom.1.run() %} - {{custom.0}} {%- endif %} {%- endfor %} {%- if !conf.scheduled_test_branches.is_empty() %} scheduled_tests: jobs: {%- for version in conf.versions %} - test: name: test-{{version}} version: {{version}} version_name: {{version}} {%- endfor %} {%- for custom in conf.additional_matrix_entries %} {%- if custom.1.run_cron() %} - {{custom.0}}: name: "{{custom.0}}" version: "{{custom.1.version()}}" version_name: "{{custom.1.version()}}" {%- endif %} {%- endfor %} triggers: - schedule: cron: {{conf.test_schedule.as_str()}} filters: branches: only: {{conf.scheduled_test_branches|json}} {%- endif %}