Skip to content

Commit d592a60

Browse files
authored
Merge pull request #2 from noprd/staging
Staging ---> Main
2 parents 6c067ed + 496467b commit d592a60

22 files changed

+4272
-0
lines changed

.dockerignore

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
3+
# ----------------------------------------------------------------
4+
# ROOT
5+
# ----------------------------------------------------------------
6+
7+
!/README.md
8+
!/LICENCE
9+
!/justfile
10+
!/Cargo.toml
11+
!/.behaverc
12+
13+
# ----------------------------------------------------------------
14+
# PROJECT
15+
# ----------------------------------------------------------------
16+
17+
!/templates
18+
!/templates/template*
19+
20+
!/docs
21+
!/docs/**/
22+
!/docs/**/*.md
23+
24+
!/models
25+
!/models/*.yaml
26+
27+
!/src
28+
!/src/**/
29+
!/src/**/*.rs
30+
31+
!/tests
32+
!/tests/**/
33+
!/tests/**/*.rs
34+
35+
!/dist
36+
!/dist/VERSION
37+
38+
# ----------------------------------------------------------------
39+
# FORCE REMOVE
40+
# ----------------------------------------------------------------
41+
42+
**/.session
43+
**/logs
44+
**/.vscode
45+
**/*.tmp
46+
**/.DS_Store
47+
**/__archive__*
48+
**/__pycache__*
49+
/build
50+
51+
# ----------------------------------------------------------------
52+
# FORCE RETAIN
53+
# ----------------------------------------------------------------
54+
55+
!**/.gitkeep

.github/workflows/auto.yaml

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: QA (automatic)
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- dev
8+
- develop
9+
- staging
10+
11+
paths:
12+
- '**/*'
13+
14+
# see <https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#discussion>
15+
types:
16+
- opened
17+
- reopened
18+
- unlocked
19+
- edited
20+
- assigned
21+
- review_requested
22+
- ready_for_review
23+
24+
permissions:
25+
contents: read
26+
27+
jobs:
28+
qa:
29+
name: QA
30+
runs-on: ubuntu-latest
31+
environment: "local"
32+
env:
33+
ARTEFACT_NAME: "${{ vars.ARTEFACT_NAME }}"
34+
PROJECT_NAME: "${{ vars.PROJECT_NAME }}"
35+
ARCHITECTURE: "x86_64-unknown-linux-musl"
36+
HTTP_IP: "${{ vars.HTTP_IP }}"
37+
HTTP_PORT: ${{ vars.HTTP_PORT }}
38+
HTTP_USER: "${{ vars.HTTP_USER }}"
39+
# secrets
40+
HTTP_PASSWORD: ${{ secrets.HTTP_PASSWORD }}
41+
42+
steps:
43+
- uses: actions/[email protected]
44+
45+
- name: Action - install justfile tool
46+
uses: extractions/setup-just@v2
47+
with:
48+
just-version: "1.14.0"
49+
50+
- name: Action - install zig
51+
uses: goto-bus-stop/[email protected]
52+
with:
53+
version: "0.12.0"
54+
55+
- name: Action - install rust
56+
uses: actions-rust-lang/[email protected]
57+
58+
- name: Setup - ping basic tools and perform pre-installation
59+
shell: bash
60+
run: |-
61+
just --version
62+
zig version
63+
rustup --version
64+
rustc --version
65+
cargo --version
66+
67+
- name: Setup - Environment + Settings
68+
shell: bash
69+
run: |
70+
touch .env && rm .env
71+
echo '
72+
ARTEFACT_NAME="${{ env.ARTEFACT_NAME }}"
73+
PROJECT_NAME="${{ env.PROJECT_NAME }}"
74+
HTTP_IP="${{ env.HTTP_IP }}"
75+
HTTP_PORT=${{ env.HTTP_PORT }}
76+
HTTP_USER="${{ env.HTTP_USER }}"
77+
HTTP_PASSWORD="${{ env.HTTP_PASSWORD }}"
78+
ARCHITECTURE="${{ env.ARCHITECTURE }}"
79+
' > .env
80+
just setup
81+
82+
- name: STEP 1 - build code
83+
shell: bash
84+
run: |-
85+
just build
86+
87+
- name: STEP 2 - run linting
88+
shell: bash
89+
run: |-
90+
# NOTE: passively checks if linting _can_ be performed not if it _has_ been performed.
91+
# NOTE: path-patterns look unintuitive, but they are correct (i.e. *.rs instead of **/*.rs).
92+
just lint "src/*.rs"
93+
# just lint "tests/*.rs" # currently no files
94+
95+
- name: STEP 3 - run unit tests
96+
shell: bash
97+
run: |-
98+
just tests-unit
99+
100+
- name: STEP 4 - run behavioural tests
101+
shell: bash
102+
run: |-
103+
just tests-behave
104+
105+
- name: STEP 5 - run the binary and ping the service
106+
shell: bash
107+
run: |-
108+
just run-binary &
109+
curl 'http://${{ env.HTTP_IP }}:${{ env.HTTP_PORT }}/api/ping'

.github/workflows/deploy.yaml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Deployment
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
docker-image:
7+
description: Choice of docker image on which to run action.
8+
default: ubuntu-latest
9+
type: choice
10+
options:
11+
- ubuntu-latest
12+
environment:
13+
description: 'Choice of environment for pipeline'
14+
# NOTE: this option provides dropdown list of choices of environments set on GitHub (enterprise only)
15+
type: environment
16+
required: true
17+
default: 'test'
18+
# NOTE: currently not used, but can use in future
19+
log-level:
20+
description: 'Log level'
21+
default: INFO
22+
type: choice
23+
options:
24+
- INFO
25+
- DEBUG
26+
- WARNING
27+
28+
jobs:
29+
build:
30+
name: DEPLOY
31+
# runs-on: [self-hosted, "${{ github.event.inputs.os }}", x64, gpu]
32+
runs-on: ${{ github.event.inputs.docker-image }}
33+
environment: "${{ github.event.inputs.environment }}"
34+
env:
35+
# vars - http
36+
HTTP_IP: "${{ vars.HTTP_IP }}"
37+
HTTP_PORT: ${{ vars.HTTP_PORT }}
38+
HTTP_USER: "${{ vars.HTTP_USER }}"
39+
# vars - rust
40+
ARTEFACT_NAME: "${{ vars.ARTEFACT_NAME }}"
41+
PROJECT_NAME: "${{ vars.PROJECT_NAME }}"
42+
ARCHITECTURE: "x86_64-unknown-linux-musl"
43+
# secrets
44+
HTTP_PASSWORD: "${{ secrets.HTTP_PASSWORD }}"
45+
46+
steps:
47+
- name: Action - checkout repo
48+
uses: actions/[email protected]
49+
50+
- name: Action - install justfile tool
51+
uses: extractions/setup-just@v2
52+
with:
53+
just-version: "1.34.0"
54+
55+
- name: Action - install zig
56+
uses: goto-bus-stop/[email protected]
57+
with:
58+
version: "0.12.0"
59+
60+
- name: Action - install rust
61+
uses: actions-rust-lang/[email protected]
62+
63+
- name: Setup - ping basic tools and perform pre-installation
64+
shell: bash
65+
run: |-
66+
just --version
67+
zig version
68+
rustup --version
69+
rustc --version
70+
cargo --version
71+
72+
- name: Setup - Environment + Settings
73+
shell: bash
74+
run: |
75+
touch .env && rm .env
76+
echo '
77+
ARTEFACT_NAME="${{ env.ARTEFACT_NAME }}"
78+
PROJECT_NAME="${{ env.PROJECT_NAME }}"
79+
HTTP_IP="${{ env.HTTP_IP }}"
80+
HTTP_PORT=${{ env.HTTP_PORT }}
81+
HTTP_USER="${{ env.HTTP_USER }}"
82+
HTTP_PASSWORD="${{ env.HTTP_PASSWORD }}"
83+
ARCHITECTURE="${{ env.ARCHITECTURE }}"
84+
' > .env
85+
just setup
86+
87+
- name: Build - compile code and move artefact
88+
shell: bash
89+
run: |
90+
just build
91+
92+
- name: Release - Deploy artefact
93+
shell: bash
94+
run: |
95+
# cp target/release/${{ env.PROJECT_NAME }}
96+
echo "Not yet implemented"

0 commit comments

Comments
 (0)