Skip to content

Commit

Permalink
Add release workflows and rename rust to verify
Browse files Browse the repository at this point in the history
Signed-off-by: Ismael González <[email protected]>
  • Loading branch information
ismaelgv committed Nov 5, 2021
1 parent 1c15edd commit 4d4ad7b
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 24 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Release

on:
push:
tags: ["*"]

env:
PROJECT_NAME: rnr
CARGO_TERM_COLOR: always

jobs:
build-artifacts:
name: Build a release artifacts
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
env:
BUILD_DIR: "build"
TARGET: ${{ matrix.target }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Get the version
id: version
shell: bash
run: |
echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Configure toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ env.TARGET }}

- name: Build
shell: bash
run: |
cargo build --target=${TARGET} --release --verbose
- name: Create package
shell: bash
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
out_dir=${GITHUB_WORKSPACE}
package_name="${PROJECT_NAME}-${VERSION}-${TARGET}"
deploy_dir="${BUILD_DIR}/${package_name}"
# Create deployment directory
mkdir "${deploy_dir}"
mkdir "${deploy_dir}/completion"
# Copy files
cp "target/${TARGET}/release/${PROJECT_NAME}" "${deploy_dir}/"
cp "target/${TARGET}/release/build/rnr"-*/out/"_rnr" "${deploy_dir}/completion/"
cp "target/${TARGET}/release/build/rnr"-*/out/"rnr.bash" "${deploy_dir}/completion/"
cp "target/${TARGET}/release/build/rnr"-*/out/"rnr.fish" "${deploy_dir}/completion/"
cp "target/${TARGET}/release/build/rnr"-*/out/"_rnr.ps1" "${deploy_dir}/completion/"
cp README.md "${deploy_dir}"
cp LICENSE "${deploy_dir}"
# Archive
pushd "${tempdir}"
tar czf "${out_dir}/${package_name}.tar.gz" "${package_name}"/*
popd
rm -r "${tempdir}"
- name: Store artifacts

publish-release:
name: Build a release artifacts
runs-on: ubuntu-latest
steps:
- name: Get the version
id: version
shell: bash
run: |
echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Fetch artifacts

- name: Publish new release
# uses: softprops/action-gh-release@v1
# with:
# name: ${{ steps.version.outputs.version }}
# artifacts: ""
# body: ""
24 changes: 0 additions & 24 deletions .github/workflows/rust.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: RnR

on:
push:
branches: [master]
pull_request:
branches: [master]

env:
CARGO_TERM_COLOR: always

jobs:
verify:
name: Verify the project
if: startsWith(github.ref, 'refs/head/') # Only commits
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build project
shell: bash
run: cargo build --verbose

- name: Run tests
shell: bash
run: cargo test --verbose

0 comments on commit 4d4ad7b

Please sign in to comment.