feat(www): add link to rule source on GitHub (#1264) #355
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 | |
on: [push, pull_request] | |
permissions: | |
contents: write | |
jobs: | |
rust: | |
name: deno_lint-${{ matrix.os }} | |
if: | | |
github.event_name == 'push' || | |
!startsWith(github.event.pull_request.head.label, 'denoland:') | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
os: [macOS-latest, ubuntu-latest, windows-2019] | |
env: | |
CARGO_INCREMENTAL: 0 | |
GH_ACTIONS: 1 | |
RUST_BACKTRACE: full | |
RUSTFLAGS: -D warnings | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
persist-credentials: false | |
- uses: dsherret/rust-toolchain-file@v1 | |
- name: Install Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- name: Install Node.js | |
if: contains(matrix.os, 'ubuntu') | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Install npm packages | |
if: contains(matrix.os, 'ubuntu') | |
run: npm install --ci | |
working-directory: benchmarks | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: Format | |
if: contains(matrix.os, 'ubuntu') | |
run: deno run --allow-run ./tools/format.ts --check | |
- name: Build | |
run: cargo build --locked --release --all-targets --all-features | |
- name: Test | |
run: | | |
cargo test --locked --release --all-targets --all-features | |
deno test --unstable --allow-read=. --allow-write=. --allow-run --allow-env ./tools | |
- name: Lint | |
if: contains(matrix.os, 'ubuntu') | |
run: deno run --allow-run --allow-env ./tools/lint.ts --release | |
- name: Check if www/static/docs.json is up-to-date | |
if: contains(matrix.os, 'ubuntu') | |
run: diff <(./target/release/examples/dlint rules --json) www/static/docs.json | |
- name: Benchmarks | |
if: contains(matrix.os, 'ubuntu') | |
run: deno run -A --quiet benchmarks/benchmarks.ts | |
- name: Pre-release (linux) | |
if: | | |
contains(matrix.os, 'ubuntu') | |
run: | | |
cd target/release/examples | |
zip -r dlint-x86_64-unknown-linux-gnu.zip dlint | |
- name: Pre-release (mac) | |
if: | | |
contains(matrix.os, 'macOS') | |
run: | | |
cd target/release/examples | |
zip -r dlint-x86_64-apple-darwin.zip dlint | |
- name: Pre-release (windows) | |
if: | | |
contains(matrix.os, 'windows') | |
run: | | |
Compress-Archive -CompressionLevel Optimal -Force -Path target/release/examples/dlint.exe -DestinationPath target/release/examples/dlint-x86_64-pc-windows-msvc.zip | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: | | |
github.repository == 'denoland/deno_lint' && | |
startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
target/release/examples/dlint-x86_64-pc-windows-msvc.zip | |
target/release/examples/dlint-x86_64-unknown-linux-gnu.zip | |
target/release/examples/dlint-x86_64-apple-darwin.zip | |
draft: true | |
- name: Publish | |
if: | | |
contains(matrix.os, 'ubuntu') && | |
github.repository == 'denoland/deno_lint' && | |
startsWith(github.ref, 'refs/tags/') | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: | | |
cargo publish -vv |