Skip to content

chore(deps): update rust crate serde_json to v1.0.117 #244

chore(deps): update rust crate serde_json to v1.0.117

chore(deps): update rust crate serde_json to v1.0.117 #244

Workflow file for this run

name: CI/CD
on:
push:
pull_request:
types:
- opened
workflow_dispatch: # allow manual execution
jobs:
check-repo:
name: Check git repository
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
format: 'table'
exit-code: '1'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
check-code-style:
name: Check code style
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
- uses: Swatinem/rust-cache@v2 # use /rust/cargo caching
with:
workspaces: "src-tauri -> target"
cache-on-failure: true # upload cache even if there are errors in this step
- name: Check the code style
run: cd src-tauri && cargo fmt --all -- --check
check-code:
name: Check rust code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: install dependencies
run: |
sudo apt update
sudo apt install -y libgtk-3-dev libwebkit2gtk-4.0-dev librsvg2-dev
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@v2 # use /rust/cargo caching
with:
workspaces: "src-tauri -> target"
cache-on-failure: true # upload cache even if there are errors in this step
- name: Verify code
run: cd src-tauri && cargo clippy
test:
name: Run application tests
runs-on: ubuntu-latest
env:
BIGDATA_CLOUD_API_KEY: ${{ secrets.BIGDATA_CLOUD_API_KEY }}
OPEN_WEATHER_MAP_API_KEY: ${{ secrets.OPEN_WEATHER_MAP_API_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: install dependencies
run: |
sudo apt update
sudo apt install -y libgtk-3-dev libwebkit2gtk-4.0-dev librsvg2-dev
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v2 # use /rust/cargo caching
with:
workspaces: "src-tauri -> target"
cache-on-failure: true # upload cache even if there are errors in this step
- name: Test code
run: cd src-tauri && cargo test
create-release:
name: Create new release
needs: [ check-repo, check-code-style, check-code, test ]
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Dependencies
run: |
npm install -g \
semantic-release \
@semantic-release/git \
@semantic-release/gitlab \
@semantic-release/changelog \
@semantic-release/exec \
@semantic-release/commit-analyzer \
conventional-changelog-conventionalcommits
- name: Generate Semantic Release Notes and Create Release
id: semantic-release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: npx semantic-release
- name: Delete old releases
uses: dev-drprasad/[email protected]
with:
keep_latest: 5
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
bundle-and-upload:
needs: [ create-release ]
name: Bundle and upload application artifacts
strategy:
fail-fast: false
matrix:
platform: [ ubuntu-20.04, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2 # use /rust/cargo caching
with:
workspaces: "src-tauri -> target"
cache-on-failure: true # upload cache even if there are errors in this step
- name: Detect and set latest github release VERSION
shell: bash
run: |
REPO="RouHim/binvec"
curl --silent "https://api.github.com/repos/${REPO}/releases/latest"
curl --silent "https://api.github.com/repos/${REPO}/releases/latest" | jq -r ".tag_name"
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/${REPO}/releases/latest" | jq -r ".tag_name")
LATEST_RELEASE=${LATEST_RELEASE#v}
echo "Latest release is $LATEST_RELEASE"
echo "VERSION=$LATEST_RELEASE" >> $GITHUB_ENV
- name: Set UPLOAD_URL variable
shell: bash
run: |
UPLOAD_URL=$(curl --silent https://api.github.com/repos/rouhim/binvec/releases/latest | jq -r '.upload_url')
echo "UPLOAD_URL=${UPLOAD_URL}" >> $GITHUB_ENV
- name: Set version
shell: bash
run: |
cd src-tauri
jq --arg new_version "${{ env.VERSION }}" '.package.version = $new_version' tauri.conf.json > tmp.json && mv tmp.json tauri.conf.json
echo "Tauri version is now: $(cat tauri.conf.json | jq ".package.version")"
awk -v var="${{ env.VERSION }}" '{gsub(/version = "0.0.0"/, "version = \""var"\""); print}' Cargo.toml > temp && mv temp Cargo.toml
echo "Cargo version is now" $(cargo metadata --no-deps --format-version 1 | jq -r ".packages[0].version")
cd ..
- name: Install Tauri dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: sudo apt update && sudo apt install -y libwebkit2gtk-4.0-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
- uses: cargo-bins/cargo-binstall@main
- name: Install Tauri-CLI
run: cargo binstall --no-confirm --force tauri-cli
- name: Build the app
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
run: cargo tauri build
- name: Upload linux AppImage
if: matrix.platform == 'ubuntu-20.04'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: src-tauri/target/release/bundle/appimage/bin-vec_${{ env.VERSION }}_amd64.AppImage
asset_name: binvec_${{ env.VERSION }}_amd64.AppImage
asset_content_type: application/octet-stream
- name: Upload linux AppImage updater
if: matrix.platform == 'ubuntu-20.04'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: src-tauri/target/release/bundle/appimage/bin-vec_${{ env.VERSION }}_amd64.AppImage.tar.gz
asset_name: binvec_${{ env.VERSION }}_amd64.AppImage.tar.gz
asset_content_type: application/octet-stream
- name: Upload linux AppImage updater signature
if: matrix.platform == 'ubuntu-20.04'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: src-tauri/target/release/bundle/appimage/bin-vec_${{ env.VERSION }}_amd64.AppImage.tar.gz.sig
asset_name: binvec_${{ env.VERSION }}_amd64.AppImage.tar.gz.sig
asset_content_type: application/octet-stream
- name: Upload windows installer
if: matrix.platform == 'windows-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: src-tauri/target/release/bundle/msi/BinVec_${{ env.VERSION }}_x64_en-US.msi
asset_name: binvec_${{ env.VERSION }}_x64_en-US.msi
asset_content_type: application/octet-stream
- name: Upload windows updater
if: matrix.platform == 'windows-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: src-tauri/target/release/bundle/msi/BinVec_${{ env.VERSION }}_x64_en-US.msi.zip
asset_name: binvec_${{ env.VERSION }}_x64_en-US.msi.zip
asset_content_type: application/octet-stream
- name: Upload windows updater signature
if: matrix.platform == 'windows-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: src-tauri/target/release/bundle/msi/BinVec_${{ env.VERSION }}_x64_en-US.msi.zip.sig
asset_name: binvec_${{ env.VERSION }}_x64_en-US.msi.zip.sig
asset_content_type: application/octet-stream
update-updater:
name: Update updater
needs: [ bundle-and-upload ]
runs-on: ubuntu-22.04
env:
UPDATER_FILE: ".github/updater/binvec_update.json"
steps:
- uses: actions/checkout@v4
- name: Detect and set latest github release VERSION
shell: bash
run: |
REPO="RouHim/binvec"
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/$REPO/releases/latest" | jq -r ".tag_name")
LATEST_RELEASE=${LATEST_RELEASE#v}
echo "Latest release is $LATEST_RELEASE"
echo "VERSION=$LATEST_RELEASE" >> $GITHUB_ENV
- name: Build updater json
run: bash .github/updater/build_update_json.sh "${{ env.VERSION }}" "${{ env.UPDATER_FILE }}"
- name: Deploy update information to gist
uses: exuanbo/actions-deploy-gist@v1
with:
token: ${{ secrets.RELEASE_TOKEN }}
gist_id: 6dd4931683170f25859dc88cb1788b10
file_path: ${{ env.UPDATER_FILE }}