Skip to content

Commit

Permalink
A0-3755 Faucet cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin-Radecki committed Dec 22, 2023
1 parent cc5bc59 commit e029e1b
Show file tree
Hide file tree
Showing 45 changed files with 5,575 additions and 2,974 deletions.
31 changes: 23 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,40 @@
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/typescript",
"plugin:security/recommended",
"plugin:prettier/recommended"
"semistandard"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
},
"plugins": [
"@typescript-eslint",
"security",
"promise",
"simple-import-sort"
],
"rules": {
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-unused-vars": "error",
"arrow-spacing":["warn",{ "before": true, "after": true }],
"camelcase": "off",
"comma-dangle": ["error", "never"],
"no-multiple-empty-lines": ["error", {"max": 1}],
"no-trailing-spaces": ["warn"],
"no-unused-vars": "off",
"object-curly-spacing": ["error", "always"],
"quotes": ["error", "single", { "avoidEscape": true }],
"semi": [2, "always"],
"simple-import-sort/imports": "error",
"sort-keys": [
"error",
"asc",
{ "caseSensitive": true, "natural": false, "minKeys": 2 }
]
"sort-keys": ["error", "asc", {"caseSensitive": true, "natural": false, "minKeys": 2}],
"switch-colon-spacing": ["error", {"after": true, "before": false}]
}
}
96 changes: 0 additions & 96 deletions .github/workflows/build.yml

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/deploy-to-testnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: Deploy to Testnet

on:
workflow_dispatch:
# TESTING, remove before merge
push:
branches:
- A0-3755

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: false

jobs:
deploy-faucet:
name: Build and push faucet image
runs-on: ubuntu-latest
steps:
- name: GIT | Checkout Source code
uses: actions/checkout@v4

- name: Call action get-ref-properties
id: get-ref-properties
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v6

- name: Get facuet rc image name
id: get-image-name
env:
ECR_REGISTRY: '${{ vars.ECR_PUBLIC_REGISTRY }}'
APP: faucet
TAG: '${{ steps.get-ref-properties.outputs.sha }}'
shell: bash
run: |
image=${{ env.ECR_REGISTRY }}/${{ env.APP }}:${{ env.TAG }}
echo "image=${image}" >> $GITHUB_OUTPUT
- name: Check deploy image existence
uses: Cardinal-Cryptography/github-actions/check-image-existence-ecr@v6
with:
ecr-image: ${{ steps.get-image-name.outputs.image }}

- name: Get repo owner
id: get-repo-owner
shell: bash
run: |
echo "repo-owner=$GITHUB_REPOSITORY_OWNER" >> $GITHUB_OUTPUT
- name: GIT | Checkout argocd apps repo
uses: actions/checkout@v4
with:
ref: 'testnet'
# yamllint disable-line rule:line-length
repository: ${{ steps.get-repo-owner.outputs.repo-owner }}/${{ secrets.REPO_ARGOCD_APPS_NAME }}
token: ${{ secrets.CI_GH_TOKEN }}
path: ${{ secrets.REPO_ARGOCD_APPS_NAME }}

- name: Init kustomize
uses: imranismail/setup-kustomize@v2
with:
kustomize-version: ${{ vars.KUSTOMIZE_VERSION }}

- name: Update faucet Testnet image in kustomize file
env:
RELEASE_IMAGE: ${{ steps.get-image-name.outputs.image }}
REGIONS_AWS: 'eu-central-1'
run: |
export aleph_path=$(pwd)
export apps_name=${{ secrets.REPO_ARGOCD_APPS_NAME }}
cd ${aleph_path}/${apps_name}/faucet/overlays/testnet/${{ env.REGIONS_AWS }}
kustomize edit set image "faucet-image-placeholder=${{ env.RELEASE_IMAGE }}"
- name: GIT | Commit changes to argocd apps repository.
uses: EndBug/[email protected]
with:
author_name: ${{ secrets.AUTOCOMMIT_AUTHOR }}
author_email: ${{ secrets.AUTOCOMMIT_EMAIL }}
# yamllint disable-line rule:line-length
message: "Updating testnet faucet docker image tag to: ${{ steps.get-image-name.outputs.image }}"
add: "*.yaml"
cwd: ${{ secrets.REPO_ARGOCD_APPS_NAME }}
branch: testnet
# TESTING, remove below line
push: false
18 changes: 0 additions & 18 deletions .github/workflows/lint.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/on-main-branch-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Push to main commit

on:
push:
branches:
- main
# TESTING, remove before merge
- A0-3755

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
main:
name: Build and push faucet image
runs-on: ubuntu-latest
steps:
- name: GIT | Checkout Source code
uses: actions/checkout@v4

- name: Call action get-ref-properties
id: get-ref-properties
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v6

- name: Get facuet rc image name
id: get-image-name
env:
ECR_REGISTRY: '${{ vars.ECR_PUBLIC_REGISTRY }}'
APP: faucet
TAG: '${{ steps.get-ref-properties.outputs.sha }}'
shell: bash
run: |
image=${{ env.ECR_REGISTRY }}/${{ env.APP }}:${{ env.TAG }}
echo "image=${image}" >> $GITHUB_OUTPUT
- name: Build docker image with PR aleph-node binary
run: |
docker build \
--tag '${{ steps.get-image-name.outputs.image }}' \
-f ./docker/Dockerfile .
- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ vars.ECR_PUBLIC_HOST }}
username: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}

- name: Push image to the ECR registry
id: push-image
run: |
docker push '${{ steps.get-image-name.outputs.image }}'
26 changes: 26 additions & 0 deletions .github/workflows/on-pr-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: PR commit
on:
pull_request:
merge_group:
# TESTING, remove before merge
push:
branches:
- A0-3755

jobs:
pr:
continue-on-error: true
strategy:
matrix:
step: ['lint', 'build']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: ${{ matrix.step }}
run: |
yarn install --immutable
yarn ${{ matrix.step }}
25 changes: 25 additions & 0 deletions .github/workflows/yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: GH Action YAML linter

on:
merge_group:
pull_request:
paths:
- '.github/**.yml'
- '.github/**.yaml'
# TESTING, remove before merge
push:
branches:
- A0-3755

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
main:
name: YAML Lint
runs-on: ubuntu-20.04
steps:
- name: LINT | Execute YAML linter
uses: Cardinal-Cryptography/github-actions/yaml-lint@v6
25 changes: 25 additions & 0 deletions .github/workflows/yaml-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: GH Action YAML validator

on:
merge_group:
pull_request:
paths:
- '.github/**.yml'
- '.github/**.yaml'
# TESTING, remove before merge
push:
branches:
- A0-3755

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
main:
name: YAML Validate
runs-on: ubuntu-20.04
steps:
- name: VALIDATE | Execute github-actions-validator
uses: Cardinal-Cryptography/github-actions/yaml-validate@v6
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ public
.DS_Store
.idea
.env.template
reset_backend.sh
restart_frontend.sh
Loading

0 comments on commit e029e1b

Please sign in to comment.