diff --git a/.github/workflows/bors-commit-lint.yml b/.github/workflows/bors-commit-lint.yml deleted file mode 100644 index 604694f350..0000000000 --- a/.github/workflows/bors-commit-lint.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Lint commit message -on: - push: - branches: - - staging - - trying - -jobs: - commitlint: - name: Lint commit message - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - uses: wagoid/commitlint-github-action@v5 - with: - commitDepth: 1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bca22c9a14..8c5893ffba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,110 +1,132 @@ -name: CI +name: ๐Ÿ” Continuous Integration on: push: branches: - main - - staging - - trying pull_request: + merge_group: jobs: check_formatting: runs-on: ubuntu-latest - name: Check Rust formatting + name: ๐Ÿ—’ Check Rust formatting steps: - - uses: actions/checkout@v3 - - name: Install Rustfmt + - name: โฌ‡๏ธ Checkout Source + uses: actions/checkout@v3 + + - name: ๐Ÿฆ€ Install Rustfmt uses: actions-rs/toolchain@v1 with: components: rustfmt - - uses: actions-rs/cargo@v1 + + - name: ๐Ÿ”ง Check + uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check clippy_correctness_checks: runs-on: ubuntu-latest - name: Clippy correctness checks + name: ๐Ÿ”ง Clippy correctness checks strategy: fail-fast: false matrix: config: - { target: "x86_64-unknown-linux-gnu", target_dir: "target" } - # Disable WASM Target until we fix WASM compile - # - { target: 'wasm32-unknown-unknown', target_dir: 'web-target' } + - { target: "wasm32-unknown-unknown", target_dir: "web-target" } steps: - - name: Install dependencies + - name: โฌ‡๏ธ Checkout Source + uses: actions/checkout@v3 + + - name: ๐Ÿงฐ Install dependencies run: | sudo apt-get update sudo apt-get install -y -q \ libasound2-dev \ libudev-dev - - uses: actions/checkout@v3 - - name: Install WASM Target + + - name: ๐Ÿงฐ Install WASM Target if: matrix.config.target == 'wasm32-unknown-unknown' uses: actions-rs/toolchain@v1 with: target: ${{ matrix.config.target }} components: clippy - - name: Install Clippy + + - name: ๐Ÿงฐ Install Clippy if: matrix.config.target != 'wasm32-unknown-unknown' uses: actions-rs/toolchain@v1 with: components: clippy - - uses: actions/cache@v3 - name: Cache cargo registry + + - name: โ™ป๏ธ Cache Cargo + uses: actions/cache@v3 with: path: | ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: cargo-registry - - uses: actions/cache@v3 - name: Cache cargo target - with: - path: | target/ web-target/ - key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }} - - uses: actions-rs/cargo@v1 + key: ci-${{ matrix.config.target }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ci-${{ matrix.config.target }}- + + - name: ๐Ÿ”ง Check + uses: actions-rs/cargo@v1 env: CARGO_TARGET_DIR: ${{ matrix.config.target_dir }} with: command: clippy args: --target ${{ matrix.config.target }} -- -W clippy::correctness -D warnings + cargo-deny: + name: ยฉ๏ธ License and advisories check + runs-on: ubuntu-latest + strategy: + matrix: + checks: + - advisories + - bans licenses sources + + # Prevent sudden announcement of a new advisory from failing ci: + continue-on-error: ${{ matrix.checks == 'advisories' }} + + steps: + - uses: actions/checkout@v3 + - uses: EmbarkStudios/cargo-deny-action@v1 + with: + command: check ${{ matrix.checks }} + miri_tests: runs-on: ubuntu-latest - name: Miri tests + name: ๐Ÿ“ก Miri tests steps: - - name: Install dependencies + - uses: actions/checkout@v3 + - name: ๐Ÿงฐ Install dependencies run: | sudo apt-get update sudo apt-get install -y -q \ libasound2-dev \ libudev-dev - - uses: actions/checkout@v3 - - name: Install Miri + - name: ๐Ÿงฐ Install Miri run: | rustup toolchain install nightly --component miri rustup override set nightly cargo miri setup - - uses: actions/cache@v3 - name: Cache cargo registry + - name: โ™ป๏ธ Cache Cargo + uses: actions/cache@v3 with: path: | ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: cargo-registry - - uses: actions/cache@v3 - name: Cache miri target - with: - path: | target/ - key: miri-target - - name: Test with Miri + web-target/ + key: ci-miri-${{ matrix.config.target }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ci-miri-${{ matrix.config.target }}- + - name: ๐Ÿ“ก Test with Miri run: | # Try multiple seeds to catch possible alignment issues for SEED in $(seq 0 10); do diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7a7b7992a7..efbb861ee8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,71 +1,57 @@ -name: Documentation +name: ๐Ÿ—’ Documentation on: push: branches: - main - - staging - - trying pull_request: + merge_group: jobs: book: - name: Build Docs + name: ๐Ÿ”จ Build Docs runs-on: ubuntu-latest steps: - - name: Checkout Source + - name: โฌ‡ ๏ธCheckout Source uses: actions/checkout@v2 - - name: Install dependencies + - name: ๐Ÿงฐ Install dependencies run: | sudo apt-get update sudo apt-get install -y -q \ libasound2-dev \ libudev-dev - - name: Install Rust + - name: ๐Ÿฆ€ Install Rust uses: actions-rs/toolchain@v1 - - name: Install mdbook + - name: ๐Ÿ“– Install mdbook uses: peaceiris/actions-mdbook@v1 with: mdbook-version: "0.4.22" - uses: actions/cache@v3 - name: Cache cargo registry + name: โ™ป๏ธ Cache Cargo with: path: | ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: cargo-registry - - uses: actions/cache@v3 - name: Cache cargo target - with: - path: | target/ web-target/ - key: Linux-cargo-target-${{ hashFiles('**/Cargo.lock') }} - - - name: Test Book Rust Examples - run: | - cargo b -p bones_ecs - mdbook test book -L target/debug/deps + key: docs-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + docs- - - name: Build Rustdoc + - name: ๐Ÿ”จ Build Rustdoc run: | cargo doc --workspace --no-deps mv target/doc book/src/rustdoc - - - name: Build MDBook - run: | - cd book - mdbook build - - - name: Deploy ๐Ÿš€ - uses: peaceiris/actions-gh-pages@v3 + - name: ๐Ÿš€ Deploy + uses: JamesIves/github-pages-deploy-action@4.1.3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./book/dist + branch: gh-pages + folder: ./book/dist + target-folder: book diff --git a/.github/workflows/merge-group-commit-lint.yml b/.github/workflows/merge-group-commit-lint.yml new file mode 100644 index 0000000000..a58e88e56e --- /dev/null +++ b/.github/workflows/merge-group-commit-lint.yml @@ -0,0 +1,20 @@ +name: ๐Ÿ•ต Lint Merge Group Commit Message +on: + pull_request: + merge_group: + +jobs: + commitlint: + name: ๐Ÿ”Ž Lint Commit Message + runs-on: ubuntu-latest + steps: + - name: โฌ‡๏ธ Checkout Source + uses: actions/checkout@v3 + if: github.event_name == 'merge_group' + with: + fetch-depth: 2 + - name: ๐Ÿ”Ž Lint Commit Message + uses: wagoid/commitlint-github-action@v5 + if: github.event_name == 'merge_group' + with: + commitDepth: 1 diff --git a/.github/workflows/pul-requests.yml b/.github/workflows/pul-requests.yml index 77ea8f261b..97e8015da3 100644 --- a/.github/workflows/pul-requests.yml +++ b/.github/workflows/pul-requests.yml @@ -1,4 +1,4 @@ -name: Pull Requests +name: โฎ๏ธ Pull Requests on: pull_request_target: @@ -6,12 +6,15 @@ on: - opened - edited - synchronize + merge_group: jobs: main: - name: Validate conventional PR title + name: ๐Ÿ•ต Validate Conventional PR Title runs-on: ubuntu-latest steps: - uses: amannn/action-semantic-pull-request@v5 + name: ๐Ÿ”Ž Validate Conventional PR Title + if: github.event_name == 'pull_request_target' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000000..b9e5099f64 --- /dev/null +++ b/deny.toml @@ -0,0 +1,29 @@ +# This section is considered when running `cargo deny check licenses` +# More documentation for the licenses section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html +[licenses] +unlicensed = "deny" +allow = [ + "MIT", + "Apache-2.0", + "Unlicense", + "Zlib", + "Apache-2.0 WITH LLVM-exception", + "Unicode-DFS-2016", + "BSD-3-Clause", + "BSL-1.0", + "MIT-0", + "OFL-1.1", + "LicenseRef-UFL-1.0", + "CC0-1.0", + "ISC", + "BSD-2-Clause", + "MPL-2.0", # TODO(zicklag): I believe MPL is fine for us, but maybe double-check this. + "OpenSSL", +] +default = "deny" + +[sources.allow-org] +github = [ + "fishfolk", +]