├── LICENSE ├── README.md └── recipes ├── matrix.md ├── msrv.md ├── nightly-lints.md ├── quickstart.md └── security-audit.md /LICENSE: -------------------------------------------------------------------------------- 1 | CC0 1.0 Universal 2 | 3 | Statement of Purpose 4 | 5 | The laws of most jurisdictions throughout the world automatically confer 6 | exclusive Copyright and Related Rights (defined below) upon the creator and 7 | subsequent owner(s) (each and all, an "owner") of an original work of 8 | authorship and/or a database (each, a "Work"). 9 | 10 | Certain owners wish to permanently relinquish those rights to a Work for the 11 | purpose of contributing to a commons of creative, cultural and scientific 12 | works ("Commons") that the public can reliably and without fear of later 13 | claims of infringement build upon, modify, incorporate in other works, reuse 14 | and redistribute as freely as possible in any form whatsoever and for any 15 | purposes, including without limitation commercial purposes. These owners may 16 | contribute to the Commons to promote the ideal of a free culture and the 17 | further production of creative, cultural and scientific works, or to gain 18 | reputation or greater distribution for their Work in part through the use and 19 | efforts of others. 20 | 21 | For these and/or other purposes and motivations, and without any expectation 22 | of additional consideration or compensation, the person associating CC0 with a 23 | Work (the "Affirmer"), to the extent that he or she is an owner of Copyright 24 | and Related Rights in the Work, voluntarily elects to apply CC0 to the Work 25 | and publicly distribute the Work under its terms, with knowledge of his or her 26 | Copyright and Related Rights in the Work and the meaning and intended legal 27 | effect of CC0 on those rights. 28 | 29 | 1. Copyright and Related Rights. A Work made available under CC0 may be 30 | protected by copyright and related or neighboring rights ("Copyright and 31 | Related Rights"). Copyright and Related Rights include, but are not limited 32 | to, the following: 33 | 34 | i. the right to reproduce, adapt, distribute, perform, display, communicate, 35 | and translate a Work; 36 | 37 | ii. moral rights retained by the original author(s) and/or performer(s); 38 | 39 | iii. publicity and privacy rights pertaining to a person's image or likeness 40 | depicted in a Work; 41 | 42 | iv. rights protecting against unfair competition in regards to a Work, 43 | subject to the limitations in paragraph 4(a), below; 44 | 45 | v. rights protecting the extraction, dissemination, use and reuse of data in 46 | a Work; 47 | 48 | vi. database rights (such as those arising under Directive 96/9/EC of the 49 | European Parliament and of the Council of 11 March 1996 on the legal 50 | protection of databases, and under any national implementation thereof, 51 | including any amended or successor version of such directive); and 52 | 53 | vii. other similar, equivalent or corresponding rights throughout the world 54 | based on applicable law or treaty, and any national implementations thereof. 55 | 56 | 2. Waiver. To the greatest extent permitted by, but not in contravention of, 57 | applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and 58 | unconditionally waives, abandons, and surrenders all of Affirmer's Copyright 59 | and Related Rights and associated claims and causes of action, whether now 60 | known or unknown (including existing as well as future claims and causes of 61 | action), in the Work (i) in all territories worldwide, (ii) for the maximum 62 | duration provided by applicable law or treaty (including future time 63 | extensions), (iii) in any current or future medium and for any number of 64 | copies, and (iv) for any purpose whatsoever, including without limitation 65 | commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes 66 | the Waiver for the benefit of each member of the public at large and to the 67 | detriment of Affirmer's heirs and successors, fully intending that such Waiver 68 | shall not be subject to revocation, rescission, cancellation, termination, or 69 | any other legal or equitable action to disrupt the quiet enjoyment of the Work 70 | by the public as contemplated by Affirmer's express Statement of Purpose. 71 | 72 | 3. Public License Fallback. Should any part of the Waiver for any reason be 73 | judged legally invalid or ineffective under applicable law, then the Waiver 74 | shall be preserved to the maximum extent permitted taking into account 75 | Affirmer's express Statement of Purpose. In addition, to the extent the Waiver 76 | is so judged Affirmer hereby grants to each affected person a royalty-free, 77 | non transferable, non sublicensable, non exclusive, irrevocable and 78 | unconditional license to exercise Affirmer's Copyright and Related Rights in 79 | the Work (i) in all territories worldwide, (ii) for the maximum duration 80 | provided by applicable law or treaty (including future time extensions), (iii) 81 | in any current or future medium and for any number of copies, and (iv) for any 82 | purpose whatsoever, including without limitation commercial, advertising or 83 | promotional purposes (the "License"). The License shall be deemed effective as 84 | of the date CC0 was applied by Affirmer to the Work. Should any part of the 85 | License for any reason be judged legally invalid or ineffective under 86 | applicable law, such partial invalidity or ineffectiveness shall not 87 | invalidate the remainder of the License, and in such case Affirmer hereby 88 | affirms that he or she will not (i) exercise any of his or her remaining 89 | Copyright and Related Rights in the Work or (ii) assert any associated claims 90 | and causes of action with respect to the Work, in either case contrary to 91 | Affirmer's express Statement of Purpose. 92 | 93 | 4. Limitations and Disclaimers. 94 | 95 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 96 | surrendered, licensed or otherwise affected by this document. 97 | 98 | b. Affirmer offers the Work as-is and makes no representations or warranties 99 | of any kind concerning the Work, express, implied, statutory or otherwise, 100 | including without limitation warranties of title, merchantability, fitness 101 | for a particular purpose, non infringement, or the absence of latent or 102 | other defects, accuracy, or the present or absence of errors, whether or not 103 | discoverable, all to the greatest extent permissible under applicable law. 104 | 105 | c. Affirmer disclaims responsibility for clearing rights of other persons 106 | that may apply to the Work or any use thereof, including without limitation 107 | any person's Copyright and Related Rights in the Work. Further, Affirmer 108 | disclaims responsibility for obtaining any necessary consents, permissions 109 | or other rights required for any use of the Work. 110 | 111 | d. Affirmer understands and acknowledges that Creative Commons is not a 112 | party to this document and has no duty or obligation with respect to this 113 | CC0 or use of the Work. 114 | 115 | For more information, please see 116 | 117 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Actions for Rust language 2 | 3 | ![CC0 licensed](https://img.shields.io/github/license/actions-rs/meta) 4 | [![Gitter](https://badges.gitter.im/actions-rs/community.svg)](https://gitter.im/actions-rs/community) 5 | 6 | Repositories in [this organization](https://github.com/actions-rs) are [GitHub Actions](https://github.com/features/actions), which can be used to do the full CI circle for Rust projects. 7 | 8 | ## Recipes 9 | 10 | See the [@actions-rs/example](https://github.com/actions-rs/example) repository 11 | with the live workflows described here. 12 | 13 | ### Quickstart ⚡ 14 | 15 | [Quickstart](./recipes/quickstart.md) recipe can be useful 16 | if you are not familiar with GitHub Actions, never used CI thingies before 17 | or just want to copy-n-paste some scripts into your project for an instant result. 18 | 19 | ### MSRV (Minimal Supported Rust Version) 🔒 20 | 21 | [MSRV](./recipes/msrv.md) recipe does almost the same what "[Quickstart](#quickstart)" do, 22 | but also helps to guarantee the MSRV policy if you have any. 23 | 24 | ### Nightly clippy and rustfmt 📎 25 | 26 | Ever had this problem when your CI build is broken, 27 | because today's `nightly` is missing `clippy` or `rustfmt`?\ 28 | Yeah, I know, everyone hates that. 29 | 30 | [Nightly lints](./recipes/nightly-lints.md) recipe is utilizing `rustup` ability 31 | to find the most recent `nightly` toolchain with the components requested; 32 | no more broken builds for you! 33 | 34 | ### Stable + beta + nightly + MSRV 35 | 36 | [Matrix](./recipes/matrix.md) recipe combines three previous recipes together 37 | in order to make an ultimate quickstart workflow. 38 | 39 | ### Perform security audit for your dependencies 🛡️ 40 | 41 | [Security Audit](./recipes/security-audit.md) recipe is using [RustSec](https://rustsec.org/) 42 | advisories database to audit crate for security vulnerabilities. 43 | 44 | ## License 45 | 46 | All recipes in this repository are published with the [CC0](./LICENSE) license. 47 | -------------------------------------------------------------------------------- /recipes/matrix.md: -------------------------------------------------------------------------------- 1 | # Matrix CI workflow 2 | 3 | This workflow installs multiple different Rust versions in parallel 4 | and invokes these commands for each installed version: 5 | 6 | * `cargo build` 7 | * `cargo test` 8 | * [`cargo fmt`](https://github.com/rust-lang/rustfmt) 9 | * [`cargo clippy`](https://github.com/rust-lang/rust-clippy) 10 | 11 | ## When it can be used? 12 | 13 | 1. You want to guarantee that your crate is compiled on `stable` 14 | 2. You also want to provide the MSRV (Minimal Supported Rust Version) policy 15 | 3. You also want to check if your crate compiles on `beta` and `nightly` 16 | 17 | ## Workflow 18 | 19 | ```yaml 20 | on: push 21 | 22 | name: Continuous integration 23 | 24 | jobs: 25 | ci: 26 | runs-on: ubuntu-latest 27 | strategy: 28 | matrix: 29 | rust: 30 | - stable 31 | - beta 32 | - nightly 33 | - 1.31.0 # MSRV 34 | 35 | steps: 36 | - uses: actions/checkout@v2 37 | 38 | - uses: actions-rs/toolchain@v1 39 | with: 40 | profile: minimal 41 | toolchain: ${{ matrix.rust }} 42 | override: true 43 | components: rustfmt, clippy 44 | 45 | - uses: actions-rs/cargo@v1 46 | with: 47 | command: build 48 | 49 | - uses: actions-rs/cargo@v1 50 | with: 51 | command: test 52 | 53 | - uses: actions-rs/cargo@v1 54 | with: 55 | command: fmt 56 | args: --all -- --check 57 | 58 | - uses: actions-rs/cargo@v1 59 | with: 60 | command: clippy 61 | args: -- -D warnings 62 | ``` 63 | 64 | ## Can I tune it? 65 | 66 | Sure! 67 | 68 | This workflow is using following Actions to execute the pipeline, 69 | see their pages for the available options: 70 | 71 | 1. [`actions-rs/toolchain`](https://github.com/actions-rs/toolchain) 72 | 2. [`actions-rs/cargo`](https://github.com/actions-rs/cargo) 73 | 74 | -------------------------------------------------------------------------------- /recipes/msrv.md: -------------------------------------------------------------------------------- 1 | # Quickstart + MSRV CI workflow 2 | 3 | This workflow is doing almost the same what [Quickstart workflow](../quickstart.md) does, 4 | except all jobs are invoked twice: for latest stable Rust and 5 | for MSRV (Minimal Supported Rust Version) toolchain. 6 | 7 | ## When it can be used? 8 | 9 | 1. You have a simple Rust project 10 | 2. It can be compiled with the `stable` Rust compiler 11 | 3. You also have a policy about minimal supported Rust version (ex. "*this crate can be compiled with Rust 1.31.0 and higher*") 12 | and you want to guarantee that 13 | 14 | ## Workflow 15 | 16 | ```yaml 17 | on: [push, pull_request] 18 | 19 | name: Continuous integration 20 | 21 | jobs: 22 | check: 23 | name: Check 24 | runs-on: ubuntu-latest 25 | strategy: 26 | matrix: 27 | rust: 28 | - stable 29 | - 1.31.0 30 | steps: 31 | - uses: actions/checkout@v2 32 | - uses: actions-rs/toolchain@v1 33 | with: 34 | profile: minimal 35 | toolchain: ${{ matrix.rust }} 36 | override: true 37 | - uses: actions-rs/cargo@v1 38 | with: 39 | command: check 40 | 41 | test: 42 | name: Test Suite 43 | runs-on: ubuntu-latest 44 | strategy: 45 | matrix: 46 | rust: 47 | - stable 48 | - 1.31.0 49 | steps: 50 | - uses: actions/checkout@v2 51 | - uses: actions-rs/toolchain@v1 52 | with: 53 | profile: minimal 54 | toolchain: ${{ matrix.rust }} 55 | override: true 56 | - uses: actions-rs/cargo@v1 57 | with: 58 | command: test 59 | 60 | fmt: 61 | name: Rustfmt 62 | runs-on: ubuntu-latest 63 | strategy: 64 | matrix: 65 | rust: 66 | - stable 67 | - 1.31.0 68 | steps: 69 | - uses: actions/checkout@v2 70 | - uses: actions-rs/toolchain@v1 71 | with: 72 | profile: minimal 73 | toolchain: ${{ matrix.rust }} 74 | override: true 75 | - run: rustup component add rustfmt 76 | - uses: actions-rs/cargo@v1 77 | with: 78 | command: fmt 79 | args: --all -- --check 80 | 81 | clippy: 82 | name: Clippy 83 | runs-on: ubuntu-latest 84 | strategy: 85 | matrix: 86 | rust: 87 | - stable 88 | - 1.31.0 89 | steps: 90 | - uses: actions/checkout@v2 91 | - uses: actions-rs/toolchain@v1 92 | with: 93 | profile: minimal 94 | toolchain: ${{ matrix.rust }} 95 | override: true 96 | - run: rustup component add clippy 97 | - uses: actions-rs/cargo@v1 98 | with: 99 | command: clippy 100 | args: -- -D warnings 101 | ``` 102 | 103 | ## Can I tune it? 104 | 105 | Sure! 106 | 107 | This workflow is using following Actions to execute the pipeline, 108 | see their pages for the available options: 109 | 110 | 1. [`actions-rs/toolchain`](https://github.com/actions-rs/toolchain) 111 | 2. [`actions-rs/cargo`](https://github.com/actions-rs/cargo) 112 | 113 | -------------------------------------------------------------------------------- /recipes/nightly-lints.md: -------------------------------------------------------------------------------- 1 | # Nightly lints CI workflow 2 | 3 | This workflow installs latest nightly Rust version 4 | and invokes these commands in parallel: 5 | 6 | * [`cargo fmt`](https://github.com/rust-lang/rustfmt) 7 | * [`cargo clippy`](https://github.com/rust-lang/rust-clippy) 8 | 9 | ## When it can be used? 10 | 11 | 1. You are living on an edge 12 | 2. You prefer to use `nightly` versions of `clippy` and `rustfmt`, 13 | as they has more options available 14 | 15 | ## Workflow 16 | 17 | ```yaml 18 | on: [push, pull_request] 19 | 20 | name: Lints 21 | 22 | jobs: 23 | clippy: 24 | name: Clippy 25 | runs-on: ubuntu-latest 26 | steps: 27 | - uses: actions/checkout@v2 28 | - uses: actions-rs/toolchain@v1 29 | with: 30 | profile: minimal 31 | toolchain: nightly 32 | override: true 33 | components: rustfmt, clippy 34 | - uses: actions-rs/cargo@v1 35 | with: 36 | command: fmt 37 | args: --all -- --check 38 | - uses: actions-rs/cargo@v1 39 | with: 40 | command: clippy 41 | args: -- -D warnings 42 | ``` 43 | 44 | ## Can I tune it? 45 | 46 | Sure! 47 | 48 | This workflow is using following Actions to execute the pipeline, 49 | see their pages for the available options: 50 | 51 | 1. [`actions-rs/toolchain`](https://github.com/actions-rs/toolchain) 52 | 2. [`actions-rs/cargo`](https://github.com/actions-rs/cargo) 53 | 54 | -------------------------------------------------------------------------------- /recipes/quickstart.md: -------------------------------------------------------------------------------- 1 | # Quickstart CI workflow 2 | 3 | This workflow installs latest stable Rust version 4 | and invokes these commands in parallel: 5 | 6 | * `cargo check` 7 | * `cargo test` 8 | * [`cargo fmt`](https://github.com/rust-lang/rustfmt) 9 | * [`cargo clippy`](https://github.com/rust-lang/rust-clippy) 10 | 11 | ## When it can be used? 12 | 13 | 1. You have a simple Rust project 14 | 2. There is no OS-specific code 15 | 3. It can be compiled with the `stable` Rust compiler 16 | 4. You want a quick start with Rust CI 17 | 18 | ```yaml 19 | on: [push, pull_request] 20 | 21 | name: Continuous integration 22 | 23 | jobs: 24 | check: 25 | name: Check 26 | runs-on: ubuntu-latest 27 | steps: 28 | - uses: actions/checkout@v2 29 | - uses: actions-rs/toolchain@v1 30 | with: 31 | profile: minimal 32 | toolchain: stable 33 | override: true 34 | - uses: actions-rs/cargo@v1 35 | with: 36 | command: check 37 | 38 | test: 39 | name: Test Suite 40 | runs-on: ubuntu-latest 41 | steps: 42 | - uses: actions/checkout@v2 43 | - uses: actions-rs/toolchain@v1 44 | with: 45 | profile: minimal 46 | toolchain: stable 47 | override: true 48 | - uses: actions-rs/cargo@v1 49 | with: 50 | command: test 51 | 52 | fmt: 53 | name: Rustfmt 54 | runs-on: ubuntu-latest 55 | steps: 56 | - uses: actions/checkout@v2 57 | - uses: actions-rs/toolchain@v1 58 | with: 59 | profile: minimal 60 | toolchain: stable 61 | override: true 62 | - run: rustup component add rustfmt 63 | - uses: actions-rs/cargo@v1 64 | with: 65 | command: fmt 66 | args: --all -- --check 67 | 68 | clippy: 69 | name: Clippy 70 | runs-on: ubuntu-latest 71 | steps: 72 | - uses: actions/checkout@v2 73 | - uses: actions-rs/toolchain@v1 74 | with: 75 | profile: minimal 76 | toolchain: stable 77 | override: true 78 | - run: rustup component add clippy 79 | - uses: actions-rs/cargo@v1 80 | with: 81 | command: clippy 82 | args: -- -D warnings 83 | ``` 84 | 85 | ## Can I tune it? 86 | 87 | Sure! 88 | 89 | This workflow is using following Actions to execute the pipeline, 90 | see their pages for the available options: 91 | 92 | 1. [`actions-rs/toolchain`](https://github.com/actions-rs/toolchain) 93 | 2. [`actions-rs/cargo`](https://github.com/actions-rs/cargo) 94 | -------------------------------------------------------------------------------- /recipes/security-audit.md: -------------------------------------------------------------------------------- 1 | # Security audit workflow 2 | 3 | This workflow is executed on schedule and performs an audit 4 | for crates with security vulnerabilities. 5 | 6 | ## When it can be used? 7 | 8 | When you agree that it is important to have no dependencies with security vulnerabilities. 9 | 10 | ```yaml 11 | name: Security audit 12 | on: 13 | schedule: 14 | - cron: '0 0 * * *' 15 | jobs: 16 | audit: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@v2 20 | - uses: actions-rs/audit-check@v1 21 | with: 22 | token: ${{ secrets.GITHUB_TOKEN }} 23 | ``` 24 | 25 | This Action will be executed periodically at midnight of each day 26 | and check if there any new advisories appear for crate dependencies.\ 27 | For each new advisory (including informal) an issue will be created. 28 | 29 | Alternatively, you can use it to audit changes (commits or pull requests), 30 | see an example [here](https://github.com/actions-rs/audit-check#audit-changes). 31 | 32 | ## Can I tune it? 33 | 34 | Sure! 35 | 36 | This workflow is using following Actions to execute the pipeline, 37 | see their pages for the available options: 38 | 39 | 1. [`actions-rs/audit-check`](https://github.com/actions-rs/audit-check) 40 | --------------------------------------------------------------------------------