Skip to content

Story-Init ---> Staging #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**

# ----------------------------------------------------------------
# ROOT
# ----------------------------------------------------------------

!/README.md
!/LICENCE
!/justfile
!/Cargo.toml
!/.behaverc

# ----------------------------------------------------------------
# PROJECT
# ----------------------------------------------------------------

!/templates
!/templates/template*

!/docs
!/docs/**/
!/docs/**/*.md

!/models
!/models/*.yaml

!/src
!/src/**/
!/src/**/*.rs

!/tests
!/tests/**/
!/tests/**/*.rs

!/dist
!/dist/VERSION

# ----------------------------------------------------------------
# FORCE REMOVE
# ----------------------------------------------------------------

**/.session
**/logs
**/.vscode
**/*.tmp
**/.DS_Store
**/__archive__*
**/__pycache__*
/build

# ----------------------------------------------------------------
# FORCE RETAIN
# ----------------------------------------------------------------

!**/.gitkeep
109 changes: 109 additions & 0 deletions .github/workflows/auto.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: QA (automatic)

on:
pull_request:
branches:
- main
- dev
- develop
- staging

paths:
- '**/*'

# see <https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#discussion>
types:
- opened
- reopened
- unlocked
- edited
- assigned
- review_requested
- ready_for_review

permissions:
contents: read

jobs:
qa:
name: QA
runs-on: ubuntu-latest
environment: "local"
env:
ARTEFACT_NAME: "${{ vars.ARTEFACT_NAME }}"
PROJECT_NAME: "${{ vars.PROJECT_NAME }}"
ARCHITECTURE: "x86_64-unknown-linux-musl"
HTTP_IP: "${{ vars.HTTP_IP }}"
HTTP_PORT: ${{ vars.HTTP_PORT }}
HTTP_USER: "${{ vars.HTTP_USER }}"
# secrets
HTTP_PASSWORD: ${{ secrets.HTTP_PASSWORD }}

steps:
- uses: actions/[email protected]

- name: Action - install justfile tool
uses: extractions/setup-just@v2
with:
just-version: "1.14.0"

- name: Action - install zig
uses: goto-bus-stop/[email protected]
with:
version: "0.12.0"

- name: Action - install rust
uses: actions-rust-lang/[email protected]

- name: Setup - ping basic tools and perform pre-installation
shell: bash
run: |-
just --version
zig version
rustup --version
rustc --version
cargo --version

- name: Setup - Environment + Settings
shell: bash
run: |
touch .env && rm .env
echo '
ARTEFACT_NAME="${{ env.ARTEFACT_NAME }}"
PROJECT_NAME="${{ env.PROJECT_NAME }}"
HTTP_IP="${{ env.HTTP_IP }}"
HTTP_PORT=${{ env.HTTP_PORT }}
HTTP_USER="${{ env.HTTP_USER }}"
HTTP_PASSWORD="${{ env.HTTP_PASSWORD }}"
ARCHITECTURE="${{ env.ARCHITECTURE }}"
' > .env
just setup

- name: STEP 1 - build code
shell: bash
run: |-
just build

- name: STEP 2 - run linting
shell: bash
run: |-
# NOTE: passively checks if linting _can_ be performed not if it _has_ been performed.
# NOTE: path-patterns look unintuitive, but they are correct (i.e. *.rs instead of **/*.rs).
just lint "src/*.rs"
# just lint "tests/*.rs" # currently no files

- name: STEP 3 - run unit tests
shell: bash
run: |-
just tests-unit

- name: STEP 4 - run behavioural tests
shell: bash
run: |-
just tests-behave

- name: STEP 5 - run the binary and ping the service
shell: bash
run: |-
just run-binary &
curl 'http://${{ env.HTTP_IP }}:${{ env.HTTP_PORT }}/api/ping'
96 changes: 96 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Deployment

on:
workflow_dispatch:
inputs:
docker-image:
description: Choice of docker image on which to run action.
default: ubuntu-latest
type: choice
options:
- ubuntu-latest
environment:
description: 'Choice of environment for pipeline'
# NOTE: this option provides dropdown list of choices of environments set on GitHub (enterprise only)
type: environment
required: true
default: 'test'
# NOTE: currently not used, but can use in future
log-level:
description: 'Log level'
default: INFO
type: choice
options:
- INFO
- DEBUG
- WARNING

jobs:
build:
name: DEPLOY
# runs-on: [self-hosted, "${{ github.event.inputs.os }}", x64, gpu]
runs-on: ${{ github.event.inputs.docker-image }}
environment: "${{ github.event.inputs.environment }}"
env:
# vars - http
HTTP_IP: "${{ vars.HTTP_IP }}"
HTTP_PORT: ${{ vars.HTTP_PORT }}
HTTP_USER: "${{ vars.HTTP_USER }}"
# vars - rust
ARTEFACT_NAME: "${{ vars.ARTEFACT_NAME }}"
PROJECT_NAME: "${{ vars.PROJECT_NAME }}"
ARCHITECTURE: "x86_64-unknown-linux-musl"
# secrets
HTTP_PASSWORD: "${{ secrets.HTTP_PASSWORD }}"

steps:
- name: Action - checkout repo
uses: actions/[email protected]

- name: Action - install justfile tool
uses: extractions/setup-just@v2
with:
just-version: "1.34.0"

- name: Action - install zig
uses: goto-bus-stop/[email protected]
with:
version: "0.12.0"

- name: Action - install rust
uses: actions-rust-lang/[email protected]

- name: Setup - ping basic tools and perform pre-installation
shell: bash
run: |-
just --version
zig version
rustup --version
rustc --version
cargo --version

- name: Setup - Environment + Settings
shell: bash
run: |
touch .env && rm .env
echo '
ARTEFACT_NAME="${{ env.ARTEFACT_NAME }}"
PROJECT_NAME="${{ env.PROJECT_NAME }}"
HTTP_IP="${{ env.HTTP_IP }}"
HTTP_PORT=${{ env.HTTP_PORT }}
HTTP_USER="${{ env.HTTP_USER }}"
HTTP_PASSWORD="${{ env.HTTP_PASSWORD }}"
ARCHITECTURE="${{ env.ARCHITECTURE }}"
' > .env
just setup

- name: Build - compile code and move artefact
shell: bash
run: |
just build

- name: Release - Deploy artefact
shell: bash
run: |
# cp target/release/${{ env.PROJECT_NAME }}
echo "Not yet implemented"
Loading