Skip to content

Push on tags

Push on tags #672

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"
steps:
- name: Set workspace var
shell: bash
run: |
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 git@gitlab.com:
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
if [[ "${{ matrix.os }}" == "windows-latest" ]]
then
git config --global credential.helper wincred
fi
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: Swatinem/rust-cache@v2
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
- name: git workspace add github org
uses: actions-rs/cargo@v1
with:
command: run
args: add github django --exclude "/django.*"
- name: git-workspace update
uses: actions-rs/cargo@v1
with:
command: run
args: update
- name: git-workspace fetch
uses: actions-rs/cargo@v1
with:
command: run
args: fetch
- name: git-workspace list
uses: actions-rs/cargo@v1
with:
command: run
args: list
- name: Remove workspace
shell: bash
run: echo > ${GIT_WORKSPACE}/workspace.toml
- name: git-workspace archive
uses: actions-rs/cargo@v1
with:
command: run
args: archive --force
- name: Build release
if: startsWith(github.ref, 'refs/tags/')
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Package
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
strip target/release/${{ matrix.bin }}
cd target/release
if [[ "${{ matrix.os }}" == "windows-latest" ]]
then
7z a ../../${{ matrix.name }} ${{ matrix.bin }}
else
tar czvf ../../${{ matrix.name }} ${{ matrix.bin }}
fi
cd -
- name: Publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: false
files: 'git-workspace*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
checks:
name: Checks
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Run cargo fmt
uses: actions-rs/cargo@v1
if: success() || failure()
with:
command: fmt
args: --all -- --check
- name: Run cargo check
uses: actions-rs/cargo@v1
if: success() || failure()
with:
command: check