chore: cargo.lock #73
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
name: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
pull_request: | |
branches: [main] | |
env: | |
LINUX_ARTIFACT: jvem_linux.tar.gz | |
WINDOWS_ARTIFACT: jvem.zip | |
MACOS_ARTIFACT: jvem_macos.tar.gz | |
jobs: | |
common-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: tests | |
run: cargo test --verbose | |
- name: install latest rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
override: true | |
build-linux: | |
needs: common-build | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- name: build and test | |
run: | | |
cargo build --all --release | |
bash src/tests/test.sh | |
- name: package | |
run: | | |
mv target/release/jvem target/release/jvem_amd64 | |
mkdir source | |
mv target/release/jvem_amd64 source/ | |
tar -czvf ${{ env.LINUX_ARTIFACT }} -C source/ . | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: linux-artifact | |
path: ${{ env.LINUX_ARTIFACT }} | |
build-win: | |
needs: common-build | |
runs-on: windows-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- name: build | |
run: | | |
cargo build --all --release | |
mkdir source | |
copy target\release\jvem.exe source/ | |
Compress-Archive -Path source\* -DestinationPath ${{ env.WINDOWS_ARTIFACT }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: windows-artifact | |
path: ${{ env.WINDOWS_ARTIFACT }} | |
build-macos: | |
needs: common-build | |
runs-on: macos-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- name: build | |
run: | | |
cargo build --all --release | |
mkdir source | |
mv target/release/jvem source/ | |
tar -czvf ${{ env.MACOS_ARTIFACT }} -C source/ . | |
- name: upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: macos-artifact | |
path: ${{ env.MACOS_ARTIFACT }} | |
release: | |
needs: [build-linux, build-win, build-macos] | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v2 | |
- name: download Linux Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-artifact | |
path: . | |
- name: download Windows Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: windows-artifact | |
path: . | |
- name: download macOS Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: macos-artifact | |
path: . | |
- name: release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
${{ env.LINUX_ARTIFACT }} | |
${{ env.WINDOWS_ARTIFACT }} | |
${{ env.MACOS_ARTIFACT }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |