Skip to content

Commit

Permalink
feat: v24.8.0 (#1)
Browse files Browse the repository at this point in the history
* feat: v24.8.0

* fix: remove real account id

* fix: rename .tln.conf
  • Loading branch information
VladyslavKurmaz authored Aug 28, 2024
1 parent 96b6c69 commit 1994d3f
Show file tree
Hide file tree
Showing 7 changed files with 701 additions and 0 deletions.
183 changes: 183 additions & 0 deletions base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
name: "Base"

on:
workflow_call:
inputs:
ref:
type: string
description: Ref to compare changes
cleanup:
type: boolean
description: Cleanup disk space
default: false
group:
type: string
description: Group
default: "dev"
environment:
type: string
description: Environment
default: "ci"
tests:
type: string
description: Tests
default: "unit, spec, static"
build:
type: boolean
description: build
default: false
package-n-upload:
type: boolean
description: Package & Upload
default: false
construct-n-deploy:
type: boolean
description: Construct Infrastructure & Deploy App
default: false
undeploy-n-deconstruct:
type: boolean
description: Undeploy App & Deconstruct Infrastruture
default: false
secrets:
ENVIRONMENT_GROUP:
required: true
SONAR_GITHUB_TOKEN:
required: true
# SONAR_TOKEN:
# required: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install sshuttle
run: |
sudo apt-get update && sudo apt-get install -y sshuttle ansible sshpass
sudo gpg -k
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install k6
- uses: actions/setup-node@v4
with:
node-version: "22.6.0"

- run: npm i -g [email protected]

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Free Disk Space (Ubuntu)
if: ${{ inputs.cleanup }}
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true

- name: Configure environment
env:
ENVIRONMENT_GROUP: ${{ secrets.ENVIRONMENT_GROUP }}
run: |
df -h
npm i
echo '{"detach": true}' > '.tlnrc'
echo '${{ inputs.group }}:${{ inputs.environment }}' > .context
mkdir secrets
echo "$ENVIRONMENT_GROUP" > secrets/.env.${{ inputs.group }}
tln configure-ci:prereq:get-secrets
ls -la secrets
- name: Init
run: |
tln init-all -- --repo-ref ${{ inputs.ref }}
- name: Format & Unit test
if: ${{ contains(inputs.tests, 'unit') }}
run: |
tln format-all:unit-test-all -- --repo-ref ${{ inputs.ref }}
- name: Spec test
if: ${{ contains(inputs.tests, 'spec') }}
run: |
#tln up platform
#docker ps -a
#tln spec-test-all -- --repo-ref ${{ inputs.ref }}
# - name: SonarCloud Scan
# uses: SonarSource/sonarcloud-github-action@master
# if: ${{ contains(inputs.tests, 'static') }}
# env:
# GITHUB_TOKEN: ${{ secrets.SONAR_GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Build
if: ${{ inputs.build }}
run: |
tln build-all -- --repo-ref ${{ inputs.ref }}
- name: Package and Upload
if: ${{ inputs.package-n-upload }}
run: |
tln package-all:publish-all -- --repo-ref ${{ inputs.ref }}
- name: Construct & Deploy
if: ${{ inputs.construct-n-deploy }}
run: |
#tln configure-provider:configure-group:construct-env:construct-app -- --init
#tln configure-provider:configure-group:construct-env -- --apply --auto-approve
#tln sshuttle platform/env/aws -- --bastion $(tln get-bastion platform/env/aws) --deamon --ci
#tln construct-app -- --apply --auto-approve
#tln deploy-app
## Configure tenant(s) is needed
## ...
#sudo pkill -f sshuttle
#echo "Waiting for platform to come up for 1 minutes ..."
#sleep 60
- name: Run API tests
if: ${{ contains(inputs.tests, 'api') }}
run: |
#tln run-api tests -- --prune --quiet
- name: Run Blind tests
if: ${{ contains(inputs.tests, 'blind') }}
run: |
#tln run-blind tests -- --prune --quiet
- name: Run UI tests
if: ${{ contains(inputs.tests, 'ui') }}
run: |
#tln run-ui tests -- --prune --quiet
- name: Run Load tests
if: ${{ contains(inputs.tests, 'load') }}
run: |
#tln run-load tests -- --prune --quiet
- name: Undeploy & Deconstruct
if: ${{ inputs.undeploy-n-deconstruct }}
run: |
#tln configure-provider:configure-group:construct-env:construct-app -- --init
#tln sshuttle platform/env/aws -- --bastion $(tln get-bastion platform/env/aws) --deamon --ci
#tln undeploy-app
#tln deconstruct-app -- --apply --auto-approve
#sudo pkill -f sshuttle
#tln deconstruct-env:configure-group:configure-provider -- --init --apply --auto-approve
48 changes: 48 additions & 0 deletions dispatch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Dispatch"

on:
workflow_dispatch:
inputs:
group:
type: string
description: Group
default: dev
environment:
type: string
description: Environment
default: ci
tests:
type: string
description: Tests unit, spec, static, blind, api, ui, load
build:
type: boolean
description: Build
package-n-upload:
type: boolean
description: Package & Upload
construct-n-deploy:
type: boolean
description: Construct Infrastructure & Deploy App
undeploy-n-deconstruct:
type: boolean
description: Undeploy App & Deconstruct Infrastruture

jobs:
pipeline:
permissions:
deployments: write
contents: read
uses: ./.github/workflows/base.yaml
with:
cleanup: false
group: ${{ inputs.group }}
environment: ${{ inputs.environment }}
tests: ${{ inputs.tests }}
build: ${{ inputs.build }}
package-n-upload: ${{ inputs.package-n-upload }}
construct-n-deploy: ${{ inputs.construct-n-deploy }}
undeploy-n-deconstruct: ${{ inputs.undeploy-n-deconstruct }}
secrets:
ENVIRONMENT_GROUP: ${{ secrets[format('ENVIRONMENT_GROUP_{0}', github.event.inputs.group)] }}
SONAR_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
20 changes: 20 additions & 0 deletions nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Nightly Build"
on:
schedule:
- cron: "0 5 * * *"

jobs:
pipeline:
permissions:
deployments: write
contents: read
uses: ./.github/workflows/base.yaml
with:
cleanup: false
group: dev
environment: dev01
tests: blind, api, ui
secrets:
ENVIRONMENT_GROUP: ${{ secrets.ENVIRONMENT_GROUP_DEV }}
SONAR_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
23 changes: 23 additions & 0 deletions pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Pull-request"

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
pipeline:
permissions:
deployments: write
contents: read
uses: ./.github/workflows/base.yaml
with:
ref: "origin/${{ github.event.pull_request.base.ref }}"
cleanup: false
group: dev
environment: ci
tests: unit, spec, static
build: true
secrets:
ENVIRONMENT_GROUP: ${{ secrets.ENVIRONMENT_GROUP_DEV }}
SONAR_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
24 changes: 24 additions & 0 deletions push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Push"

on:
push:
branches:
- main

jobs:
pipeline:
permissions:
deployments: write
contents: read
uses: ./.github/workflows/base.yaml
with:
cleanup: false
group: dev
environment: dev01
tests: static, api, ui, load
package-n-upload: true
construct-n-deploy: true
secrets:
ENVIRONMENT_GROUP: ${{ secrets.ENVIRONMENT_GROUP_DEV }}
SONAR_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Loading

0 comments on commit 1994d3f

Please sign in to comment.