Skip to content

Add support to include repositories #705

Add support to include repositories

Add support to include repositories #705

Workflow file for this run

on:
workflow_dispatch:
push:
tags:
- 'v*'
branches:
- '**'
name: CI
jobs:
build_and_test:
name: Rust project
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
include:
- os: ubuntu-latest
bin: git-workspace
name: git-workspace-Linux-x86_64.tar.gz
- os: macOS-latest
bin: git-workspace
name: git-workspace-Darwin-x86_64.tar.gz
- os: windows-latest
bin: git-workspace.exe
name: git-workspace-Windows-x86_64.zip
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GITLAB_ALTERNATIVE_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GCM_INTERACTIVE: never
GIT_TERMINAL_PROMPT: 0
RUST_BACKTRACE: "1"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
release_profile: "release"
steps:
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Set workspace var
shell: bash
run: |
mkdir -p "$RUNNER_TEMP/workspace-test-dir/"
echo GIT_WORKSPACE=$RUNNER_TEMP/workspace-test-dir/ >> $GITHUB_ENV
- uses: actions/checkout@master
- name: Switch SSH to https
shell: bash
run: |
git config --global url."https://gitlab.com/".insteadOf [email protected]:
git config --global url."https://github.com/".insteadOf [email protected]:
git config --global url."https://".insteadOf git://
if [[ "${{ matrix.os }}" == "windows-latest" ]]
then
git config --global credential.helper wincred
fi
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-on-failure: 'false'
- run: cargo build
- name: git workspace add github org
run: cargo run -- add github django --exclude "/django.*"
- name: git-workspace update
run: cargo run -- update
- name: git-workspace fetch
run: cargo run -- fetch
- name: git-workspace list
run: cargo run -- list
- name: Remove workspace
shell: bash
run: echo > ${GIT_WORKSPACE}/workspace.toml
- name: git-workspace archive
run: cargo run -- archive --force
- name: Build release
if: startsWith(github.ref, 'refs/tags/') || inputs.publish-tag
run: cargo build --profile=${{env.release_profile}}
- name: Package
if: startsWith(github.ref, 'refs/tags/') || inputs.publish-tag
shell: bash
run: |
strip target/${{env.release_profile}}/${{ matrix.bin }}
cd target/${{env.release_profile}}
if [[ "${{ matrix.os }}" == "windows-latest" ]]
then
7z a ../../${{ matrix.name }} ${{ matrix.bin }}
else
tar czvf ../../${{ matrix.name }} ${{ matrix.bin }}
fi
cd -
- name: Archive binaries
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/') || inputs.publish-tag
with:
name: build-${{ matrix.name }}
path: ${{ matrix.name }}
checks:
name: Checks
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: "1"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.publish-tag || null }}
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-on-failure: 'false'
- name: Run cargo fmt
if: success() || failure()
run: cargo fmt --all -- --check
- name: Run cargo check
if: success() || failure()
run: cargo check
- if: success() || failure()
run: cargo clippy --all-targets --all-features -- -D warnings