2019-11-21 18:18:54 +08:00
|
|
|
---
|
2020-07-08 15:50:07 +08:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2020-07-21 20:39:12 +08:00
|
|
|
- release-v*
|
2020-07-08 15:50:07 +08:00
|
|
|
- trying
|
2020-07-21 20:39:12 +08:00
|
|
|
- staging
|
|
|
|
tags:
|
|
|
|
- 'v[0-9]+.[0-9]+.[0-9]+' # this only concerns tags on stable
|
2019-11-21 18:18:54 +08:00
|
|
|
|
2019-12-07 18:57:33 +08:00
|
|
|
name: Test binaries with cargo test
|
2019-11-21 18:18:54 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
check:
|
2019-12-07 18:57:33 +08:00
|
|
|
name: Test on ${{ matrix.os }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2019-12-11 00:53:26 +08:00
|
|
|
os: [ubuntu-latest, macos-latest]
|
2019-11-21 18:18:54 +08:00
|
|
|
steps:
|
2019-12-07 18:57:33 +08:00
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
2020-07-14 00:53:19 +08:00
|
|
|
components: clippy
|
2019-12-07 18:57:33 +08:00
|
|
|
- name: Run cargo test
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
2020-01-22 21:30:09 +08:00
|
|
|
args: --locked --release
|
2020-07-28 20:41:49 +08:00
|
|
|
- name: Run cargo test backup
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: backup --locked --release -- --ignored --test-threads 1
|
2020-06-27 21:17:36 +08:00
|
|
|
- name: Run cargo clippy
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: clippy
|
2020-07-21 20:39:12 +08:00
|
|
|
|
2020-05-22 17:56:00 +08:00
|
|
|
build-image:
|
|
|
|
name: Test the build of Docker image
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- run: docker build . --file Dockerfile -t meilisearch
|
|
|
|
name: Docker build
|
2020-07-21 20:39:12 +08:00
|
|
|
|
|
|
|
## A push occurred on a release branch, a prerelease is created and assets are generated
|
|
|
|
prerelease:
|
|
|
|
name: create prerelease
|
|
|
|
needs: [check, build-image]
|
|
|
|
if: ${{ contains(github.ref, 'release-') && github.event_name == 'push' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: Get version number
|
|
|
|
id: version-number
|
|
|
|
run: echo "##[set-output name=number;]$(echo ${{ github.ref }} | sed 's/.*\(v.*\)/\1/')"
|
|
|
|
- name: Get commit count
|
|
|
|
id: commit-count
|
|
|
|
run: echo "##[set-output name=count;]$(git rev-list remotes/origin/master..remotes/origin/release-${{ steps.version-number.outputs.number }} --count)"
|
|
|
|
- name: Create Release
|
|
|
|
id: create_release
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }} # Personal Access Token
|
|
|
|
with:
|
|
|
|
tag_name: ${{ steps.version-number.outputs.number }}rc${{ steps.commit-count.outputs.count }}
|
|
|
|
release_name: Pre-release ${{ steps.version-number.outputs.number }}-rc${{ steps.commit-count.outputs.count }}
|
|
|
|
prerelease: true
|
|
|
|
|
|
|
|
## If a tag is pushed, a release is created for this tag, and assets will be generated
|
|
|
|
release:
|
|
|
|
name: create release
|
|
|
|
needs: [check, build-image]
|
|
|
|
if: ${{ contains(github.ref, 'tags/v') }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Get version number
|
|
|
|
id: version-number
|
|
|
|
run: echo "##[set-output name=number;]$(echo ${{ github.ref }} | sed 's/.*\(v.*\)/\1/')"
|
|
|
|
- name: Create Release
|
|
|
|
id: create_release
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }} # PAT
|
|
|
|
with:
|
|
|
|
tag_name: ${{ steps.version-number.outputs.number }}
|
|
|
|
release_name: Meilisearch ${{ steps.version-number.outputs.number }}
|
|
|
|
prerelease: false
|