Skip to content

Commit

Permalink
build: enable cloning private repos
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverNChalk committed Nov 25, 2024
1 parent f2b81c9 commit 2fb66e5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/actions/rust-toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: rust-toolchain
description: "Sets up a standard rust toolchain"
inputs:
toolchain:
description: "Which rust toolchain to use"
required: false
personal-access-token:
description: "Access token for private repos"
required: false

runs:
using: "composite"
Expand All @@ -23,3 +27,9 @@ runs:
- uses: Swatinem/rust-cache@v2.0.0
with:
shared-key: ${{ steps.get-toolchain.outputs.toolchain }}
- run: git config --global url."https://x-access-token:${{ inputs.personal-access-token }}@github.com/".insteadOf "https://github.com/"
if: ${{ inputs.personal-access-token != null }}
shell: bash
- run: git config --global url."https://${{ inputs.personal-access-token }}@github.com/".insteadOf "git@github.com:"
if: ${{ inputs.personal-access-token != null }}
shell: bash
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CI_READ }}
submodules: recursive
- uses: ./.github/workflows/actions/rust-toolchain
with:
personal-access-token: ${{ secrets.CI_READ }}
- run: cargo check --all-features

test:
Expand All @@ -35,8 +38,11 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CI_READ }}
submodules: recursive
- uses: ./.github/workflows/actions/rust-toolchain
with:
personal-access-token: ${{ secrets.CI_READ }}
- run: cargo test --all-features

fmt:
Expand All @@ -46,9 +52,11 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CI_READ }}
submodules: recursive
- uses: ./.github/workflows/actions/rust-toolchain
with:
personal-access-token: ${{ secrets.CI_READ }}
toolchain: nightly
- run: rustup component add rustfmt
- run: cargo fmt --all --check
Expand All @@ -60,8 +68,11 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CI_READ }}
submodules: recursive
- uses: ./.github/workflows/actions/rust-toolchain
with:
personal-access-token: ${{ secrets.CI_READ }}
- run: rustup component add clippy
- run: cargo clippy --all-features -- --deny warnings

Expand All @@ -72,6 +83,9 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CI_READ }}
submodules: recursive
- uses: ./.github/workflows/actions/rust-toolchain
with:
personal-access-token: ${{ secrets.CI_READ }}
- run: cargo doc --all-features --no-deps

0 comments on commit 2fb66e5

Please sign in to comment.