Skip to content

feat: ➕ add redis-rs-tls-session feature for ssl redi… #27

feat: ➕ add redis-rs-tls-session feature for ssl redi…

feat: ➕ add redis-rs-tls-session feature for ssl redi… #27

Workflow file for this run

name: CI
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
env:
BRANCH_NAME: ${{ github.ref == 'refs/heads/dev' && 'dev' || 'main' }}
PRERELEASE: ${{ github.ref == 'refs/heads/dev' && 'true' || 'false' }}
TAG_SUFFIX: ${{ github.ref == 'refs/heads/dev' && '-dev' || '' }}
jobs:
changes:
runs-on: ubuntu-22.04
outputs:
build: ${{ steps.filter.outputs.src }}
ci: ${{ steps.filter.outputs.ci }}
steps:
- name: Checkout
if: github.event_name == 'push'
uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
base: ${{ env.BRANCH_NAME }}
filters: |
src:
- '**/*.rs'
- 'sys/**'
- 'Cargo.toml'
- 'Cargo.lock'
ci:
- '.github/workflows/ci.yml'
build:
needs: changes
strategy:
fail-fast: false
matrix:
os:
- {
name: ubuntu-22.04,
binary_name: shiki-server,
output_name: shiki-server-linux-x64,
}
- {
name: macos-12,
binary_name: shiki-server,
output_name: shiki-server-macos-x64,
}
- {
name: windows-2022,
binary_name: shiki-server.exe,
output_name: shiki-server-windows-x64.exe,
}
name: build-${{ matrix.os.name }}
runs-on: ${{ matrix.os.name }}
if: needs.changes.outputs.build == 'true'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Add MSBuild to PATH
if: runner.os == 'Windows'
uses: microsoft/[email protected]
- name: Install Dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt install -y cmake clang libssl-dev pkg-config
fi
shell: bash
- name: Select Python 3.10
if: runner.os == 'macOS'
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Conan
uses: turtlebrowser/get-conan@main
with:
version: 1.60.0
- name: Install OpenSSL
if: runner.os == 'Windows'
uses: johnwason/vcpkg-action@v5
id: vcpkg
with:
pkgs: openssl
triplet: x64-windows-static
cache-key: ${{ runner.os }}-vcpkg
token: ${{ github.token }}
- name: Add VCPKG_ROOT and OPENSSL env vars
if: runner.os == 'Windows'
run: |
echo "OPENSSL_NO_VENDOR=1" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "OPENSSL_DIR=${{ github.workspace }}\vcpkg\installed\x64-windows-static" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "VCPKG_ROOT=${{ github.workspace }}\vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Lint
run: |
cargo fmt --all -- --check
cargo clippy -- -D warnings
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@main
- name: Install cargo check tools
run: |
which cargo-deny || cargo binstall cargo-deny
which cargo-outdated || cargo binstall cargo-outdated
which cargo-udeps || cargo binstall cargo-udeps
which cargo-audit || cargo binstall cargo-audit
which cargo-pants || cargo binstall cargo-pants
# - name: Check
# run: |
# cargo deny check
# cargo outdated --exit-code 1
# cargo udeps
# rm -rf ~/.cargo/advisory-db
# cargo audit
# cargo pants
- name: Build
run: cargo build --locked --release --verbose
- name: Move binary
run: mv ./target/release/${{ matrix.os.binary_name }} ./target/release/${{ matrix.os.output_name }}
shell: bash
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os.output_name }}
path: ./target/release/${{ matrix.os.output_name }}
if-no-files-found: error
release:
needs: build
runs-on: ubuntu-22.04
if: github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Latest Tag
id: latest-tag
run: |
if [[ "${{ github.ref }}" == 'refs/heads/dev' ]]; then
latest_tag=$(git tag -l | grep "\-dev" | sort -V | tail -n 1 || true)
else
latest_tag=$(git tag -l | grep -v "\-dev" | sort -V | tail -n 1 || true)
fi
if [[ -z $latest_tag ]]; then
latest_tag=""
fi
echo "::set-output name=tag::$latest_tag"
shell: bash
- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
branch: ${{ env.BRANCH_NAME }}
fromTag: ${{ steps.latest-tag.outputs.tag }}
- name: Create Draft Release
uses: ncipollo/[email protected]
with:
prerelease: ${{ env.PRERELEASE }}
draft: false
commit: ${{ github.sha }}
tag: ${{ steps.semver.outputs.next }}${{ env.TAG_SUFFIX }}
name: ${{ steps.semver.outputs.next }}${{ env.TAG_SUFFIX }}
body: "*pending*"
token: ${{ github.token }}
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ steps.semver.outputs.next }}${{ env.TAG_SUFFIX }}
toTag: ${{ steps.semver.outputs.current }}${{ env.TAG_SUFFIX }}
writeToFile: false
- name: Create Release
uses: ncipollo/[email protected]
with:
prerelease: ${{ env.PRERELEASE }}
allowUpdates: true
draft: false
makeLatest: true
commit: ${{ github.sha }}
tag: ${{ steps.semver.outputs.next }}${{ env.TAG_SUFFIX }}
name: ${{ steps.semver.outputs.next }}${{ env.TAG_SUFFIX }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
outputs:
next: ${{ steps.semver.outputs.next }}
upload:
needs: release
runs-on: ubuntu-22.04
if: github.event_name == 'push'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: .
- name: Upload artifacts to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ github.token }}
file_glob: true
file: "**/*"
tag: ${{ needs.release.outputs.next }}${{ env.TAG_SUFFIX }}