mirror of
https://github.com/Hopiu/lychee.git
synced 2026-03-18 21:50:25 +00:00
See https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662 for more info
95 lines
2.3 KiB
YAML
95 lines
2.3 KiB
YAML
name: CI
|
|
on:
|
|
repository_dispatch:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
- name: Run cargo test
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
components: clippy
|
|
- name: Run cargo fmt (check if all code is rustfmt-ed)
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
- name: Run cargo clippy (deny warnings)
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
# --all-targets makes it lint tests too
|
|
args: --all-targets -- --deny warnings
|
|
|
|
publish-check:
|
|
name: publish check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: cargo fetch
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fetch
|
|
- uses: actions-rs/install@v0.1
|
|
with:
|
|
crate: cargo-publish-all
|
|
version: latest
|
|
# This currently doesn't work.
|
|
# TODO: Re-enable once https://gitlab.com/torkleyy/cargo-publish-all/-/issues/3
|
|
# is resolved.
|
|
# See also https://github.com/lycheeverse/lychee/pull/346#issuecomment-928355735
|
|
#- run: cargo-publish-all --dry-run
|
|
|
|
publish:
|
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
needs:
|
|
- test
|
|
- lint
|
|
- publish-check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- name: cargo fetch
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fetch
|
|
- uses: actions-rs/install@v0.1
|
|
with:
|
|
crate: cargo-publish-all
|
|
version: latest
|
|
env:
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
- run: cargo-publish-all
|