From 659b8211adeba9cde0b01cf5c152943c6dd0da12 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Wed, 2 Nov 2022 17:57:38 -0700 Subject: [PATCH] Split up CI workflow (#1399) --- .github/workflows/ci.yaml | 107 --------------------------------- .github/workflows/lint.yaml | 52 ++++++++++++++++ .github/workflows/pages.yaml | 59 ++++++++++++++++++ .github/workflows/release.yaml | 6 +- .github/workflows/test.yaml | 50 +++++++++++++++ 5 files changed, 163 insertions(+), 111 deletions(-) delete mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/pages.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index ee7331e..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,107 +0,0 @@ -name: CI - -on: - pull_request: - branches: - - '*' - push: - branches: - - master - -defaults: - run: - shell: bash - -jobs: - all: - name: All - - strategy: - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest - - runs-on: ${{matrix.os}} - - env: - RUSTFLAGS: --deny warnings - - steps: - - uses: actions/checkout@v2 - - - name: Remove Broken WSL bash executable - if: ${{ matrix.os == 'windows-latest' }} - shell: cmd - run: | - takeown /F C:\Windows\System32\bash.exe - icacls C:\Windows\System32\bash.exe /grant administrators:F - del C:\Windows\System32\bash.exe - - - name: Install Rust Toolchain Components - uses: actions-rs/toolchain@v1 - with: - components: clippy, rustfmt - override: true - toolchain: 1.56.0 - - - uses: Swatinem/rust-cache@v1 - - - name: Check Lockfile - run: | - cargo update --locked --package just - - - name: Test - run: cargo test --all - - - name: Clippy - run: cargo clippy --all --all-targets - - - name: Format - run: cargo fmt --all -- --check - - - name: Completion Scripts - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - ./bin/generate-completions - git diff --no-ext-diff --quiet --exit-code - ./tests/completions/just.bash - - - name: Check for Forbidden Words - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - sudo apt-get update - sudo apt-get install ripgrep - ./bin/forbid - - - name: Install `mdbook` - if: ${{ matrix.os == 'ubuntu-latest' }} - uses: peaceiris/actions-mdbook@v1 - with: - mdbook-version: latest - - - name: Install `mdbook-linkcheck` - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - mkdir -p mdbook-linkcheck - cd mdbook-linkcheck - wget https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip - unzip mdbook-linkcheck.x86_64-unknown-linux-gnu.zip - chmod +x mdbook-linkcheck - pwd >> $GITHUB_PATH - - - name: Build book - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - cargo run --package generate-book - mdbook build book/en - mdbook build book/zh - - - name: Deploy Pages - uses: peaceiris/actions-gh-pages@v3 - if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-latest' - with: - github_token: ${{secrets.GITHUB_TOKEN}} - publish_branch: gh-pages - publish_dir: www diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..3560ec7 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,52 @@ +name: Lint + +on: + pull_request: + branches: + - '*' + push: + branches: + - master + +defaults: + run: + shell: bash + +jobs: + lint: + runs-on: ubuntu-latest + + env: + RUSTFLAGS: --deny warnings + + steps: + - uses: actions/checkout@v2 + + - name: Install Rust Toolchain Components + uses: actions-rs/toolchain@v1 + with: + components: clippy, rustfmt + toolchain: 1.56.0 + + - uses: Swatinem/rust-cache@v1 + + - name: Check Lockfile + run: cargo update --locked --package just + + - name: Clippy + run: cargo clippy --all --all-targets + + - name: Format + run: cargo fmt --all -- --check + + - name: Completion Scripts + run: | + ./bin/generate-completions + git diff --no-ext-diff --quiet --exit-code + ./tests/completions/just.bash + + - name: Check for Forbidden Words + run: | + sudo apt-get update + sudo apt-get install ripgrep + ./bin/forbid diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml new file mode 100644 index 0000000..7ffb1dd --- /dev/null +++ b/.github/workflows/pages.yaml @@ -0,0 +1,59 @@ +name: Pages + +on: + pull_request: + branches: + - '*' + push: + branches: + - master + +defaults: + run: + shell: bash + +jobs: + pages: + runs-on: ubuntu-latest + + env: + RUSTFLAGS: --deny warnings + + steps: + - uses: actions/checkout@v2 + + - name: Install Rust Toolchain Components + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.56.0 + + - uses: Swatinem/rust-cache@v1 + + - name: Install `mdbook` + uses: peaceiris/actions-mdbook@v1 + with: + mdbook-version: latest + + - name: Install `mdbook-linkcheck` + run: | + mkdir -p mdbook-linkcheck + cd mdbook-linkcheck + wget https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip + unzip mdbook-linkcheck.x86_64-unknown-linux-gnu.zip + chmod +x mdbook-linkcheck + pwd >> $GITHUB_PATH + + - name: Build book + run: | + cargo run --package generate-book + mdbook build book/en + mdbook build book/zh + + - name: Deploy Pages + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/master' + with: + github_token: ${{secrets.GITHUB_TOKEN}} + publish_branch: gh-pages + publish_dir: www diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 91f49bc..66244c5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,9 +10,7 @@ defaults: shell: bash jobs: - all: - name: All - + release: strategy: matrix: target: @@ -50,7 +48,7 @@ jobs: - name: Install Rust Toolchain Components uses: actions-rs/toolchain@v1 with: - override: true + profile: minimal target: ${{ matrix.target }} toolchain: stable diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..b719eb1 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,50 @@ +name: Test + +on: + pull_request: + branches: + - '*' + push: + branches: + - master + +defaults: + run: + shell: bash + +jobs: + test: + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + + runs-on: ${{matrix.os}} + + env: + RUSTFLAGS: --deny warnings + + steps: + - uses: actions/checkout@v2 + + - name: Remove Broken WSL bash executable + if: ${{ matrix.os == 'windows-latest' }} + shell: cmd + run: | + takeown /F C:\Windows\System32\bash.exe + icacls C:\Windows\System32\bash.exe /grant administrators:F + del C:\Windows\System32\bash.exe + + - name: Install Rust Toolchain Components + uses: actions-rs/toolchain@v1 + with: + components: clippy, rustfmt + override: true + toolchain: 1.56.0 + + - uses: Swatinem/rust-cache@v1 + + - name: Test + run: cargo test --all