Skip to content

test again?

test again? #19

Workflow file for this run

name: Test, build and release binary
on:
push:
branches:
- main
pull_request: null
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REPOSITORY: ${{ github.event.repository.name }}
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
test:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
include:
- os: macos-latest-large
- os: macos-latest-xlarge
- os: ubuntu-latest
- os: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
#- uses: actions-rs/cargo@v1
# with:
# command: run
# args: '-- -h'
lints:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: 'rustfmt, clippy'
- uses: actions-rs/cargo@v1
with:
command: fmt
args: '--all -- --check'
- uses: actions-rs/cargo@v1
with:
command: clippy
args: '-- -D warnings'
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
lfs: true
- run: git remote -v
- run: git fetch --depth=1
- id: get_previous_version
run: echo ::set-output name=PREVIOUS_VERSION::$(git describe --tags "$(git rev-list --tags --max-count=1)")
shell: bash
- id: semvers
uses: WyriHaximus/github-action-next-semvers@master
with:
version: '${{ steps.get_previous_version.outputs.PREVIOUS_VERSION || ''0.0.0'' }}'
- run: mkdir -p ./version
- run: echo "$VERSION" > ./version/version
env:
VERSION: ${{ steps.semvers.outputs.v_patch }}
- run: echo "$VERSION" > ./version/version
env:
VERSION: ${{ steps.semvers.outputs.v_major }}
if: "contains(github.event.head_commit.message, 'BC BREAK')"
- uses: actions/upload-artifact@master
with:
name: version
path: ./version/version
build:
needs:
- version
- lints
- test
- check
runs-on: '${{ matrix.os }}'
strategy:
matrix:
include:
- os: macos-latest-large
target: x86_64-apple-darwin
suffix: ''
- os: macos-latest-xlarge
target: aarch64-apple-darwin
suffix: ''
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
suffix: ''
- os: windows-latest
target: x86_64-pc-windows-msvc
suffix: .exe
steps:
- uses: actions/checkout@master
with:
lfs: true
- uses: actions/download-artifact@master
with:
name: version
- id: get_version
run: echo ::set-output "name=VERSION::$(IFS=\=;cat Cargo.toml | grep version | head -n1 | awk {'print $3'})"
shell: bash
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
env:
VERSION: '${{ steps.get_version.outputs.VERSION }}'
with:
command: build
args: '--release'
- uses: actions/upload-artifact@master
with:
name: ${{ env.REPOSITORY }}-${{ matrix.target }}
path: ./target/release/${{ env.REPOSITORY }}${{ matrix.suffix }}
release:
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
lfs: true
- uses: actions/download-artifact@master
with:
name: ${{ env.REPOSITORY }}-${{ matrix.target }}
path: ./${{ matrix.target }}
- id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: '${{ secrets.ACTIONS_TOKEN }}'
with:
tag_name: '${{ steps.get_version.outputs.VERSION || ''0.0.0.0'' }}'
release_name: 'Release ${{ steps.get_version.outputs.VERSION || ''0.0.0.0''}}'
draft: false
prerelease: false
- id: files
run: |
ls .
- uses: actions/[email protected]
env:
GITHUB_TOKEN: '${{ secrets.ACTIONS_TOKEN }}'
with:
upload_url: '${{ steps.create_release.outputs.upload_url }}'
asset_path: ./${{ matrix.target }}/${{ env.REPOSITORY }}
asset_name: ${{ env.REPOSITORY }}-${{ matrix.target }}
asset_content_type: application/octet-stream