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 22c2cae
Show file tree
Hide file tree
Showing 2 changed files with 83 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
token:
description: "Access token for private repos"
required: false

runs:
using: "composite"
Expand All @@ -23,3 +27,9 @@ runs:
- uses: Swatinem/[email protected]
with:
shared-key: ${{ steps.get-toolchain.outputs.toolchain }}
- run: git config --global url."https://x-access-token:${{ inputs.token }}@github.com/".insteadOf "https://github.com/"
if: ${{ inputs.token != null }}
shell: bash
- run: git config --global url."https://${{ inputs.token }}@github.com/".insteadOf "[email protected]:"
if: ${{ inputs.token != null }}
shell: bash
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,41 @@ jobs:
with:
concurrent_skipping: "same_content_newer"

debug:
runs-on: ubuntu-latest
steps:
- run: echo $GITHUB_WORKSPACE
shell: bash
- run: echo $INPUT_REPOSITORY
shell: bash
- run: echo $INPUT_PATH
shell: bash
- run: echo $INPUT_REF
shell: bash
- run: env
shell: bash

check:
needs: skip-duplicates
if: needs.skip-duplicates.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
env:
ci_read: ${{ secrets.CI_READ }}
if: ${{ env.ci_read != '' }}
with:
token: ${{ env.ci_read }}
submodules: recursive
- uses: actions/checkout@v3
env:
ci_read: ${{ secrets.CI_READ }}
if: ${{ env.ci_read == '' }}
with:
submodules: recursive
- uses: ./.github/workflows/actions/rust-toolchain
with:
token: ${{ secrets.CI_READ }}
- run: cargo check --all-features

test:
Expand All @@ -34,9 +60,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
env:
ci_read: ${{ secrets.CI_READ }}
if: ${{ env.ci_read != '' }}
with:
token: ${{ env.ci_read }}
submodules: recursive
- uses: actions/checkout@v3
env:
ci_read: ${{ secrets.CI_READ }}
if: ${{ env.ci_read == '' }}
with:
submodules: recursive
- uses: ./.github/workflows/actions/rust-toolchain
with:
token: ${{ secrets.CI_READ }}
- run: cargo test --all-features

fmt:
Expand All @@ -45,10 +83,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
env:
ci_read: ${{ secrets.CI_READ }}
if: ${{ env.ci_read != '' }}
with:
token: ${{ env.ci_read }}
submodules: recursive
- uses: actions/checkout@v3
env:
ci_read: ${{ secrets.CI_READ }}
if: ${{ env.ci_read == '' }}
with:
submodules: recursive
- uses: ./.github/workflows/actions/rust-toolchain
with:
token: ${{ secrets.CI_READ }}
toolchain: nightly
- run: rustup component add rustfmt
- run: cargo fmt --all --check
Expand All @@ -59,9 +108,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
env:
ci_read: ${{ secrets.CI_READ }}
if: ${{ env.ci_read != '' }}
with:
token: ${{ env.ci_read }}
submodules: recursive
- uses: actions/checkout@v3
env:
ci_read: ${{ secrets.CI_READ }}
if: ${{ env.ci_read == '' }}
with:
submodules: recursive
- uses: ./.github/workflows/actions/rust-toolchain
with:
token: ${{ secrets.CI_READ }}
- run: rustup component add clippy
- run: cargo clippy --all-features -- --deny warnings

Expand All @@ -71,7 +132,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
env:
ci_read: ${{ secrets.CI_READ }}
if: ${{ env.ci_read != '' }}
with:
token: ${{ env.ci_read }}
submodules: recursive
- uses: actions/checkout@v3
env:
ci_read: ${{ secrets.CI_READ }}
if: ${{ env.ci_read == '' }}
with:
submodules: recursive
- uses: ./.github/workflows/actions/rust-toolchain
with:
token: ${{ secrets.CI_READ }}
- run: cargo doc --all-features --no-deps

0 comments on commit 22c2cae

Please sign in to comment.