Skip to content

Merge pull request #41 from Maegereg/main #31

Merge pull request #41 from Maegereg/main

Merge pull request #41 from Maegereg/main #31

Workflow file for this run

name: Validate Main
on:
# Triggers the workflow on push or pull request events for the master branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
lint_y_format:
name: Rust lint and format
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Check format
uses: actions-rs/cargo@v1
with:
command: fmt
args: "-- --check"
- name: Run clippy lint
uses: actions-rs/cargo@v1
with:
command: clippy
unit-test:
name: Run cargo unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Run all tests
uses: actions-rs/cargo@v1
with:
command: test
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install apt dependencies
run: |
sudo apt-get update && sudo apt-get -y install curl
- name: Run makefile
run: |
make all
- name: Store built packages
uses: actions/upload-artifact@v2
with:
name: haulage-package
path: target/haulage_*.deb
package-install:
runs-on: ubuntu-latest
needs: build
steps:
- name: Get previously built package
uses: actions/download-artifact@v2
with:
name: haulage-package
- name: Install haulage package
run: |
sudo dpkg -i haulage_*.deb || /bin/true
sudo apt-get install --yes -f
# run-integration-tests:
# runs-on: ubuntu-latest
# services:
# mariadb:
# image: mariadb:latest
# ports:
# - 3306
# env:
# MYSQL_USER: haulage_db
# MYSQL_PASSWORD: haulage_db
# MYSQL_DATABASE: haulage_db
# MYSQL_ROOT_PASSWORD: haulage_db
# options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
# steps:
# - name: Checkout repo
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Run tests
# env:
# DB_HOST: "127.0.0.1"
# DB_PORT: ${{ job.services.mariadb.ports[3306] }}
# DB_USER: "root"
# DB_PASSWORD: "haulage_db"
# DB_NAME: "haulage_db"
# TRANSACTION_LOG: "transaction_log.txt"
# run: |
# touch webgui/transaction_log.txt
# make test