Skip to content

Commit

Permalink
Build deb | github action
Browse files Browse the repository at this point in the history
  • Loading branch information
a-givertzman committed Apr 25, 2024
1 parent 60bfce5 commit 70cbe6b
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 15 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Markdownlint configuration
# refet to the documentation for details:
# - [Linter for markdown](https://github.com/avto-dev/markdown-lint)
# - [Rules configuration](https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml)
# - [github](https://github.com/markdownlint/markdownlint?tab=readme-ov-file)
# Default state for all rules
default: true

# Path to configuration file to extend
extends: null

# MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md013.md
MD013:
# Number of characters
line_length: 160
# Number of characters for headings
heading_line_length: 80
# Number of characters for code blocks
code_block_line_length: 160
# Include code blocks
code_blocks: true
# Include tables
tables: true
# Include headings
headings: true
# Strict length checking
strict: false
# Stern length checking
stern: false

# MD033/no-inline-html : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md033.md
MD033:
# Allowed elements
allowed_elements: [
details,
summary,
]

2 changes: 1 addition & 1 deletion .github/workflows/packaging/deb/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
############ LIST OF MANAGED VARIABLES REQUIRED FOR DEB PACKAGE ############
name=api-server
# version=x.y.z - reading late from first arg $1
# version=x.y.z - reading from first arg $1
descriptionShort="API Server wrapping databases, executable and python scripts plugins"
descriptionExtended="API Server - service running on the socket.
Provides simple and universe access to the databases, executable and python plugins.
Expand Down
File renamed without changes.
59 changes: 59 additions & 0 deletions .github/workflows/release_deb_package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Create release with beb pacage

on:
workflow_dispatch:

env:
TERM: dumb
CARGO_TERM_COLOR: always
API_SERVER_ADDR: '0.0.0.0'
API_SERVER_PORT: 8080
POSTGRES_PASSWORD: postgres
PYTHON_VERSION: 'python3.10'

jobs:
build_and_test:
name: Creating new release with beb pacage
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Update version number in the Cargo.toml
run: |
old_version_var=$(cat ./Cargo.toml | sed -rn 's/^version[\t ]*=[\t ]*\"([0-9]+\.[0-9]+\.[0-9]+)\"\s*$/\1/gp')
echo "old version: $old_version_var"
echo "new build: ${{ github.run_number }}"
sed -i -r "s/^(version[\t ]*=[\t ]*\"[0-9]+\.[0-9]+\.)[0-9]+\"\s*$/\1${{ github.run_number }}\"/g" ./Cargo.toml
new_version_var=$(cat ./Cargo.toml | sed -rn 's/^version[\t ]*=[\t ]*\"([0-9]+\.[0-9]+\.[0-9]+)\"\s*$/\1/gp')
echo "new version: $new_version_var"
echo "NEW_VERSION=$new_version_var" >> $GITHUB_ENV
echo "new version: ${{ env.NEW_VERSION }}"
- name: Build release
run: cargo build --release

- name: Commit new version ${{ env.NEW_VERSION }}
run: |
echo "on repositiry: ${{ github.repository }}"
git config --global user.name 'anton.lobanov'
git config --global user.email '[email protected]'
git remote set-url origin https://a-givertzman:${{ secrets.RELEASES_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Automated version update to: ${{ env.NEW_VERSION }}"
- name: Push to protected branch "master"
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.RELEASES_TOKEN }}
branch: master
unprotect_reviews: true

- name: Zip artifact for deployment
run: zip ./target/release/release.zip -r ./target/release/* ./config.yaml ./extensions/*

- name: Publish release
uses: ncipollo/release-action@v1
with:
artifacts: "./target/release/release.zip"
tag: internal_v${{ env.NEW_VERSION }}
token: ${{ secrets.RELEASES_TOKEN }}
30 changes: 16 additions & 14 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ jobs:
build_and_test:
name: Testing
runs-on: ubuntu-latest
# strategy:
# matrix:
# toolchain:
# - stable
# - beta
# - nightly


# Service containers to run with `container-job`
services:
# Label used to access the service container
Expand Down Expand Up @@ -55,15 +47,25 @@ jobs:
toolchain: stable
override: true

# - name: Static analisis
# run: |
# cargo check
# # - run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
# # - run: cargo build --release
- name: Static analysis | Markdown lint tool
uses: docker://avtodev/markdown-lint:v1
with:
config: '.github/workflows/markdownlint.yaml'
args: "**/*.md"
- name: Static analysis | cargo check
run: |
cargo check
- name: Static analysis | cargo clippy
run: |
cargo clippy
# cargo fmt --check
- name: Static analysis | cargo fmt
run: |
echo "escaped for now because of to much of errors, will be turned on later"
# cargo fmt --check
- name: Unit tests
run: cargo test -- --show-output


- name: Integration tests
run: |
Expand Down

0 comments on commit 70cbe6b

Please sign in to comment.