on: push: branches: [ master ] pull_request: branches: [ master ] 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 - name: cargo publish check lychee-lib uses: actions-rs/cargo@v1 with: command: publish args: --dry-run --manifest-path lychee-lib/Cargo.toml - name: cargo publish check lychee uses: actions-rs/cargo@v1 with: command: publish args: --dry-run --manifest-path lychee-bin/Cargo.toml publish: if: startsWith(github.ref, 'refs/tags/') needs: - test - lint - publish-check runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: cargo fetch uses: actions-rs/cargo@v1 with: command: fetch - name: cargo publish lychee-lib uses: actions-rs/cargo@v1 env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} with: command: publish args: --manifest-path lychee-lib/Cargo.toml - name: cargo publish lychee uses: actions-rs/cargo@v1 env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} with: command: publish args: --manifest-path lychee-bin/Cargo.toml