Pin dependencies - autoclosed #860
Workflow file for this run
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: CI | |
# TODO: run some of these jobs conditionally based on what's been changed | |
# https://github.com/dorny/paths-filter (there's an example for conditional _job_ execution) | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
push: | |
branches: | |
- main | |
jobs: | |
check: | |
name: cargo check 🕵️ | |
needs: [not-draft] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Rust 🦀 | |
uses: ./.github/actions/setup-rust | |
with: | |
cache-key: check | |
- name: Run cargo check | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
test: | |
name: cargo test 🧪 | |
needs: [not-draft, check] | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
ninja-platform: linux | |
- os: macos-latest | |
ninja-platform: mac | |
- os: windows-latest | |
ninja-platform: win | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
# https://github.com/actions/cache/blob/5c79b3fd6c0e87c9444fe7b18edafe7d9ba61531/workarounds.md#improving-cache-restore-performance-on-windowsusing-cross-os-caching | |
- name: Use GNU tar | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: | | |
echo "Adding GNU tar to PATH" | |
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" | |
- name: Setup Rust 🦀 | |
uses: ./.github/actions/setup-rust | |
with: | |
cache-key: test | |
components: llvm-tools-preview | |
- name: Install cargo-nextest | |
uses: taiki-e/install-action@nextest | |
# Some tests depend on Nodejs + npm dependencies | |
- name: Setup Nodejs | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: "npm" | |
# Some tests depend on a Haskell toolchain | |
- name: Setup Haskell λ | |
uses: ./.github/actions/setup-haskell | |
- name: Install required NPM packages | |
run: npm install --omit optional --ignore-scripts | |
- name: Install Ninja 🥷 | |
id: install-ninja | |
uses: ditto-lang/actions/install-ninja@main | |
with: | |
release-version: v1.10.2 | |
platform: ${{matrix.ninja-platform}} | |
# Build the Haskell lsp-test in its own step so the stdout isn't swallowed by nextest. | |
# | |
# We don't currently run this test on Windows because I've not been able to | |
# get GitHub actions to properly cache Haskell stuff there and it takes | |
# about 20 minutes on the first run... | |
- name: Build ditto-lsp-test λ | |
if: matrix.os != 'windows-latest' | |
run: stack build ditto-lsp-test | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: nextest | |
args: run --workspace | |
env: | |
DITTO_BUILD_GIT_DESCRIBE: "0.0.0-test" | |
DITTO_NINJA: ${{steps.install-ninja.outputs.which}} | |
treefmt: | |
name: treefmt 💅 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Rust 🦀 | |
uses: ./.github/actions/setup-rust | |
with: | |
components: rustfmt | |
- name: Setup Nodejs | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
cache: "npm" | |
- name: Install required NPM packages | |
run: npm install --omit optional --ignore-scripts | |
- name: Setup Nix | |
uses: cachix/install-nix-action@v18 | |
- name: treefmt --fail-on-change | |
run: nix-shell --arg ci-treefmt true --run 'treefmt --clear-cache --fail-on-change' | |
clippy: | |
name: clippy 📎 | |
needs: [not-draft] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Rust 🦀 | |
uses: ./.github/actions/setup-rust | |
with: | |
cache-key: clippy | |
components: clippy | |
- name: Run clippy | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features | |
not-draft: | |
# https://knowyourmeme.com/memes/you-shall-not-pass | |
name: Shall pass? 🧙 | |
runs-on: ubuntu-latest | |
steps: | |
- name: PR not ready 🙅 | |
if: github.event_name == 'pull_request' && github.event.pull_request.draft == true | |
run: exit 1 |