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