Bump mislav/bump-homebrew-formula-action from 2 to 3 #683
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
steps: | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- 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 [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: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- 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 | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
steps: | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- 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 |