From 30bb8c36f5e6cb93c72d3fa29ca54eb1740c4a27 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:20:24 +0300 Subject: [PATCH 01/15] Update blank.yml --- .github/workflows/blank.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index fecac54f..5ea7c097 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -87,7 +87,9 @@ jobs: port: ${{ secrets.DEPLOY_SSH_PORT }} script: | mkdir -p /var/www/csr/stage/ - echo '${{ secrets.DEPLOY_CONFIG }}' > /var/www/csr/stage/config.json + echo '${{ variables.DEPLOY_CONFIG }}' > /var/www/csr/stage/config.json + echo '${{ variables.NGINX_CONF }}' > /etc/nginx/conf.d/stage.csr.conf sudo systemctl daemon-reload && sudo service stage.csr stop - cp ~/csr /var/www/csr/stage/server + cp ~/csr /var/www/csr/stage/server + sudo nginx -s reload sudo service stage.csr start From f70ae8e172d755bf6327186abac79f567410a548 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:20:40 +0300 Subject: [PATCH 02/15] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 5ea7c097..849a6fa4 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -60,7 +60,7 @@ jobs: path: csr retention-days: 5 deploy: - if: github.ref == 'refs/heads/master' +# if: github.ref == 'refs/heads/master' environment: stage runs-on: ubuntu-latest From ae184b6d49ecab5c6f145909e1fb42d76ce57456 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:22:48 +0300 Subject: [PATCH 03/15] Update blank.yml --- .github/workflows/blank.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 849a6fa4..c1ea4082 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -87,8 +87,8 @@ jobs: port: ${{ secrets.DEPLOY_SSH_PORT }} script: | mkdir -p /var/www/csr/stage/ - echo '${{ variables.DEPLOY_CONFIG }}' > /var/www/csr/stage/config.json - echo '${{ variables.NGINX_CONF }}' > /etc/nginx/conf.d/stage.csr.conf + echo '${{ env.DEPLOY_CONFIG }}' > /var/www/csr/stage/config.json + echo '${{ env.NGINX_CONF }}' > /etc/nginx/conf.d/stage.csr.conf sudo systemctl daemon-reload && sudo service stage.csr stop cp ~/csr /var/www/csr/stage/server sudo nginx -s reload From b39c6fe6a1b87540158709932fef3420291d4621 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:24:33 +0300 Subject: [PATCH 04/15] Update blank.yml --- .github/workflows/blank.yml | 132 ++++++++++++++++++------------------ 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index c1ea4082..7b419a20 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -6,78 +6,78 @@ on: pull_request: branches: ["master"] jobs: - test: - runs-on: ubuntu-22.04 - container: golang:1.19-alpine - steps: - - uses: actions/checkout@v3 - - name: Test - env: - min_coverage: '70' - coverage_result: '/total:\s+\(statements\)\s+(\d+.\d+)\%/' - run: | - set -e - apk add --update --no-cache make - make setup_alpine && make setup && make generate - go test $(go list ./... | grep -v generated) -race -coverprofile=coverage.out -short - make coverage && coverage_total=$(make coverage_total | tail -n1) && echo $coverage_total - if [ $min_coverage -gt $coverage_total ]; then exit 1; else echo "unit tests OK"; fi - lint: - runs-on: ubuntu-latest - container: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine - steps: - - uses: actions/checkout@v3 - - name: Lint - run: | - set -e - apk add --update --no-cache make - make setup_alpine && make setup && make generate - make lint - ls - echo "---" - cat report.txt - echo "---" - - name: 'Upload Artifact' - uses: actions/upload-artifact@v3 - with: - name: lint-report - path: report.txt - retention-days: 5 - build: - runs-on: ubuntu-latest - container: golang:1.19-alpine - needs: [lint,test] - steps: - - uses: actions/checkout@v3 - - name: Build - run: | - apk add --update --no-cache make - make setup_alpine && make setup && make generate && make build - - name: 'Upload Artifact' - uses: actions/upload-artifact@v3 - with: - name: artifact - path: csr - retention-days: 5 +# test: +# runs-on: ubuntu-22.04 +# container: golang:1.19-alpine +# steps: +# - uses: actions/checkout@v3 +# - name: Test +# env: +# min_coverage: '70' +# coverage_result: '/total:\s+\(statements\)\s+(\d+.\d+)\%/' +# run: | +# set -e +# apk add --update --no-cache make +# make setup_alpine && make setup && make generate +# go test $(go list ./... | grep -v generated) -race -coverprofile=coverage.out -short +# make coverage && coverage_total=$(make coverage_total | tail -n1) && echo $coverage_total +# if [ $min_coverage -gt $coverage_total ]; then exit 1; else echo "unit tests OK"; fi +# lint: +# runs-on: ubuntu-latest +# container: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine +# steps: +# - uses: actions/checkout@v3 +# - name: Lint +# run: | +# set -e +# apk add --update --no-cache make +# make setup_alpine && make setup && make generate +# make lint +# ls +# echo "---" +# cat report.txt +# echo "---" +# - name: 'Upload Artifact' +# uses: actions/upload-artifact@v3 +# with: +# name: lint-report +# path: report.txt +# retention-days: 5 +# build: +# runs-on: ubuntu-latest +# container: golang:1.19-alpine +# needs: [lint,test] +# steps: +# - uses: actions/checkout@v3 +# - name: Build +# run: | +# apk add --update --no-cache make +# make setup_alpine && make setup && make generate && make build +# - name: 'Upload Artifact' +# uses: actions/upload-artifact@v3 +# with: +# name: artifact +# path: csr +# retention-days: 5 deploy: # if: github.ref == 'refs/heads/master' environment: stage runs-on: ubuntu-latest - needs: [build] +# needs: [build] steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - - name: Uploady csr - uses: appleboy/scp-action@master - with: - host: ${{ secrets.DEPLOY_SSH_HOST }} - username: ${{ secrets.DEPLOY_SSH_USER }} - key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} - port: ${{ secrets.DEPLOY_SSH_PORT }} - source: csr - target: ~/ +# - uses: actions/download-artifact@v3 +# with: +# name: artifact +# - name: Uploady csr +# uses: appleboy/scp-action@master +# with: +# host: ${{ secrets.DEPLOY_SSH_HOST }} +# username: ${{ secrets.DEPLOY_SSH_USER }} +# key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} +# port: ${{ secrets.DEPLOY_SSH_PORT }} +# source: csr +# target: ~/ - name: Deploy uses: appleboy/ssh-action@master with: From b155bea6e5e3bf2600f00d402e6a1bc86a3973d3 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:26:49 +0300 Subject: [PATCH 05/15] Update blank.yml --- .github/workflows/blank.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 7b419a20..cac6fc97 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -87,8 +87,8 @@ jobs: port: ${{ secrets.DEPLOY_SSH_PORT }} script: | mkdir -p /var/www/csr/stage/ - echo '${{ env.DEPLOY_CONFIG }}' > /var/www/csr/stage/config.json - echo '${{ env.NGINX_CONF }}' > /etc/nginx/conf.d/stage.csr.conf + sudo echo '${{ secrets.DEPLOY_CONFIG }}' > /var/www/csr/stage/config.json + sudo echo '${{ env.NGINX_CONF }}' > /etc/nginx/conf.d/stage.csr.conf sudo systemctl daemon-reload && sudo service stage.csr stop cp ~/csr /var/www/csr/stage/server sudo nginx -s reload From 6748a6c1c2d886b783036d89b62269423d93df75 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:30:46 +0300 Subject: [PATCH 06/15] Update blank.yml --- .github/workflows/blank.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index cac6fc97..5ff7f6fe 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -87,8 +87,9 @@ jobs: port: ${{ secrets.DEPLOY_SSH_PORT }} script: | mkdir -p /var/www/csr/stage/ - sudo echo '${{ secrets.DEPLOY_CONFIG }}' > /var/www/csr/stage/config.json + echo '${{ env.DEPLOY_CONF }}' > /var/www/csr/stage/config.json sudo echo '${{ env.NGINX_CONF }}' > /etc/nginx/conf.d/stage.csr.conf + sudo echo '${{ env.SYSTEMD_CONF }}' > /etc/systemd/system/stage.csr.service sudo systemctl daemon-reload && sudo service stage.csr stop cp ~/csr /var/www/csr/stage/server sudo nginx -s reload From 2997d32a87e8c1deb222baab4a8d8fb96a4314e9 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:34:50 +0300 Subject: [PATCH 07/15] Update blank.yml --- .github/workflows/blank.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 5ff7f6fe..3c75d3b1 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -87,9 +87,9 @@ jobs: port: ${{ secrets.DEPLOY_SSH_PORT }} script: | mkdir -p /var/www/csr/stage/ - echo '${{ env.DEPLOY_CONF }}' > /var/www/csr/stage/config.json - sudo echo '${{ env.NGINX_CONF }}' > /etc/nginx/conf.d/stage.csr.conf - sudo echo '${{ env.SYSTEMD_CONF }}' > /etc/systemd/system/stage.csr.service + echo '${{ env.DEPLOY_CONF }}' | sudo tee /var/www/csr/stage/config.json + echo '${{ env.NGINX_CONF }}' | sudo tee /etc/nginx/conf.d/stage.csr.conf + echo '${{ env.SYSTEMD_CONF }}' | sudo tee /etc/systemd/system/stage.csr.service sudo systemctl daemon-reload && sudo service stage.csr stop cp ~/csr /var/www/csr/stage/server sudo nginx -s reload From 0b4ca0207221c5cde1a89e83d9269f8488efc76f Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:41:00 +0300 Subject: [PATCH 08/15] Update blank.yml --- .github/workflows/blank.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 3c75d3b1..9e97e862 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -87,8 +87,8 @@ jobs: port: ${{ secrets.DEPLOY_SSH_PORT }} script: | mkdir -p /var/www/csr/stage/ - echo '${{ env.DEPLOY_CONF }}' | sudo tee /var/www/csr/stage/config.json - echo '${{ env.NGINX_CONF }}' | sudo tee /etc/nginx/conf.d/stage.csr.conf + echo '${{ vars.DEPLOY_CONF }}' | sudo tee /var/www/csr/stage/config.json + echo '${{ envs.NGINX_CONF }}' | sudo tee /etc/nginx/conf.d/stage.csr.conf echo '${{ env.SYSTEMD_CONF }}' | sudo tee /etc/systemd/system/stage.csr.service sudo systemctl daemon-reload && sudo service stage.csr stop cp ~/csr /var/www/csr/stage/server From be20db8b4c626f1c2f4d769f79d9c2a956a6b011 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:41:50 +0300 Subject: [PATCH 09/15] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 9e97e862..e9526c55 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -88,7 +88,7 @@ jobs: script: | mkdir -p /var/www/csr/stage/ echo '${{ vars.DEPLOY_CONF }}' | sudo tee /var/www/csr/stage/config.json - echo '${{ envs.NGINX_CONF }}' | sudo tee /etc/nginx/conf.d/stage.csr.conf + echo '${{ env.NGINX_CONF }}' | sudo tee /etc/nginx/conf.d/stage.csr.conf echo '${{ env.SYSTEMD_CONF }}' | sudo tee /etc/systemd/system/stage.csr.service sudo systemctl daemon-reload && sudo service stage.csr stop cp ~/csr /var/www/csr/stage/server From 2231167d5bebadb2cdfde0de8010401d9ef55ad8 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:43:39 +0300 Subject: [PATCH 10/15] Update blank.yml --- .github/workflows/blank.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index e9526c55..3032a747 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -87,9 +87,9 @@ jobs: port: ${{ secrets.DEPLOY_SSH_PORT }} script: | mkdir -p /var/www/csr/stage/ - echo '${{ vars.DEPLOY_CONF }}' | sudo tee /var/www/csr/stage/config.json - echo '${{ env.NGINX_CONF }}' | sudo tee /etc/nginx/conf.d/stage.csr.conf - echo '${{ env.SYSTEMD_CONF }}' | sudo tee /etc/systemd/system/stage.csr.service + echo '${{ secrets.DEPLOY_CONF }}' | sudo tee /var/www/csr/stage/config.json + echo '${{ vars.NGINX_CONF }}' | sudo tee /etc/nginx/conf.d/stage.csr.conf + echo '${{ vars.SYSTEMD_CONF }}' | sudo tee /etc/systemd/system/stage.csr.service sudo systemctl daemon-reload && sudo service stage.csr stop cp ~/csr /var/www/csr/stage/server sudo nginx -s reload From 27773d37065c55b90eaa15c48d8eedbc0cee953f Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 17:46:22 +0300 Subject: [PATCH 11/15] Update blank.yml --- .github/workflows/blank.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 3032a747..1dffaf86 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -89,6 +89,7 @@ jobs: mkdir -p /var/www/csr/stage/ echo '${{ secrets.DEPLOY_CONF }}' | sudo tee /var/www/csr/stage/config.json echo '${{ vars.NGINX_CONF }}' | sudo tee /etc/nginx/conf.d/stage.csr.conf + echo '${{ vars.DEFAULT_NGINX_CONF }}' | sudo tee /etc/systemd/nginx.conf echo '${{ vars.SYSTEMD_CONF }}' | sudo tee /etc/systemd/system/stage.csr.service sudo systemctl daemon-reload && sudo service stage.csr stop cp ~/csr /var/www/csr/stage/server From 66c0c8e4232a760501d71c977ca92d404a61ef1f Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 18:01:48 +0300 Subject: [PATCH 12/15] Update blank.yml --- .github/workflows/blank.yml | 134 ++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 1dffaf86..63e23792 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -6,78 +6,78 @@ on: pull_request: branches: ["master"] jobs: -# test: -# runs-on: ubuntu-22.04 -# container: golang:1.19-alpine -# steps: -# - uses: actions/checkout@v3 -# - name: Test -# env: -# min_coverage: '70' -# coverage_result: '/total:\s+\(statements\)\s+(\d+.\d+)\%/' -# run: | -# set -e -# apk add --update --no-cache make -# make setup_alpine && make setup && make generate -# go test $(go list ./... | grep -v generated) -race -coverprofile=coverage.out -short -# make coverage && coverage_total=$(make coverage_total | tail -n1) && echo $coverage_total -# if [ $min_coverage -gt $coverage_total ]; then exit 1; else echo "unit tests OK"; fi -# lint: -# runs-on: ubuntu-latest -# container: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine -# steps: -# - uses: actions/checkout@v3 -# - name: Lint -# run: | -# set -e -# apk add --update --no-cache make -# make setup_alpine && make setup && make generate -# make lint -# ls -# echo "---" -# cat report.txt -# echo "---" -# - name: 'Upload Artifact' -# uses: actions/upload-artifact@v3 -# with: -# name: lint-report -# path: report.txt -# retention-days: 5 -# build: -# runs-on: ubuntu-latest -# container: golang:1.19-alpine -# needs: [lint,test] -# steps: -# - uses: actions/checkout@v3 -# - name: Build -# run: | -# apk add --update --no-cache make -# make setup_alpine && make setup && make generate && make build -# - name: 'Upload Artifact' -# uses: actions/upload-artifact@v3 -# with: -# name: artifact -# path: csr -# retention-days: 5 + test: + runs-on: ubuntu-22.04 + container: golang:1.19-alpine + steps: + - uses: actions/checkout@v3 + - name: Test + env: + min_coverage: '70' + coverage_result: '/total:\s+\(statements\)\s+(\d+.\d+)\%/' + run: | + set -e + apk add --update --no-cache make + make setup_alpine && make setup && make generate + go test $(go list ./... | grep -v generated) -race -coverprofile=coverage.out -short + make coverage && coverage_total=$(make coverage_total | tail -n1) && echo $coverage_total + if [ $min_coverage -gt $coverage_total ]; then exit 1; else echo "unit tests OK"; fi + lint: + runs-on: ubuntu-latest + container: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine + steps: + - uses: actions/checkout@v3 + - name: Lint + run: | + set -e + apk add --update --no-cache make + make setup_alpine && make setup && make generate + make lint + ls + echo "---" + cat report.txt + echo "---" + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: lint-report + path: report.txt + retention-days: 5 + build: + runs-on: ubuntu-latest + container: golang:1.19-alpine + needs: [lint,test] + steps: + - uses: actions/checkout@v3 + - name: Build + run: | + apk add --update --no-cache make + make setup_alpine && make setup && make generate && make build + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: artifact + path: csr + retention-days: 5 deploy: -# if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' environment: stage runs-on: ubuntu-latest -# needs: [build] + needs: [build] steps: -# - uses: actions/download-artifact@v3 -# with: -# name: artifact -# - name: Uploady csr -# uses: appleboy/scp-action@master -# with: -# host: ${{ secrets.DEPLOY_SSH_HOST }} -# username: ${{ secrets.DEPLOY_SSH_USER }} -# key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} -# port: ${{ secrets.DEPLOY_SSH_PORT }} -# source: csr -# target: ~/ + - uses: actions/download-artifact@v3 + with: + name: artifact + - name: Uploady csr + uses: appleboy/scp-action@master + with: + host: ${{ secrets.DEPLOY_SSH_HOST }} + username: ${{ secrets.DEPLOY_SSH_USER }} + key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} + port: ${{ secrets.DEPLOY_SSH_PORT }} + source: csr + target: ~/ - name: Deploy uses: appleboy/ssh-action@master with: From ad8e5e834908a9f08e2bbd86ce56f0c065343949 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 18:46:08 +0300 Subject: [PATCH 13/15] Update blank.yml --- .github/workflows/blank.yml | 136 ++++++++++++++++++------------------ 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 63e23792..6a8e093b 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -6,78 +6,78 @@ on: pull_request: branches: ["master"] jobs: - test: - runs-on: ubuntu-22.04 - container: golang:1.19-alpine - steps: - - uses: actions/checkout@v3 - - name: Test - env: - min_coverage: '70' - coverage_result: '/total:\s+\(statements\)\s+(\d+.\d+)\%/' - run: | - set -e - apk add --update --no-cache make - make setup_alpine && make setup && make generate - go test $(go list ./... | grep -v generated) -race -coverprofile=coverage.out -short - make coverage && coverage_total=$(make coverage_total | tail -n1) && echo $coverage_total - if [ $min_coverage -gt $coverage_total ]; then exit 1; else echo "unit tests OK"; fi - lint: - runs-on: ubuntu-latest - container: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine - steps: - - uses: actions/checkout@v3 - - name: Lint - run: | - set -e - apk add --update --no-cache make - make setup_alpine && make setup && make generate - make lint - ls - echo "---" - cat report.txt - echo "---" - - name: 'Upload Artifact' - uses: actions/upload-artifact@v3 - with: - name: lint-report - path: report.txt - retention-days: 5 - build: - runs-on: ubuntu-latest - container: golang:1.19-alpine - needs: [lint,test] - steps: - - uses: actions/checkout@v3 - - name: Build - run: | - apk add --update --no-cache make - make setup_alpine && make setup && make generate && make build - - name: 'Upload Artifact' - uses: actions/upload-artifact@v3 - with: - name: artifact - path: csr - retention-days: 5 +# test: +# runs-on: ubuntu-22.04 +# container: golang:1.19-alpine +# steps: +# - uses: actions/checkout@v3 +# - name: Test +# env: +# min_coverage: '70' +# coverage_result: '/total:\s+\(statements\)\s+(\d+.\d+)\%/' +# run: | +# set -e +# apk add --update --no-cache make +# make setup_alpine && make setup && make generate +# go test $(go list ./... | grep -v generated) -race -coverprofile=coverage.out -short +# make coverage && coverage_total=$(make coverage_total | tail -n1) && echo $coverage_total +# if [ $min_coverage -gt $coverage_total ]; then exit 1; else echo "unit tests OK"; fi +# lint: +# runs-on: ubuntu-latest +# container: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine +# steps: +# - uses: actions/checkout@v3 +# - name: Lint +# run: | +# set -e +# apk add --update --no-cache make +# make setup_alpine && make setup && make generate +# make lint +# ls +# echo "---" +# cat report.txt +# echo "---" +# - name: 'Upload Artifact' +# uses: actions/upload-artifact@v3 +# with: +# name: lint-report +# path: report.txt +# retention-days: 5 +# build: +# runs-on: ubuntu-latest +# container: golang:1.19-alpine +# needs: [lint,test] +# steps: +# - uses: actions/checkout@v3 +# - name: Build +# run: | +# apk add --update --no-cache make +# make setup_alpine && make setup && make generate && make build +# - name: 'Upload Artifact' +# uses: actions/upload-artifact@v3 +# with: +# name: artifact +# path: csr +# retention-days: 5 deploy: - if: github.ref == 'refs/heads/master' + # if: github.ref == 'refs/heads/master' environment: stage runs-on: ubuntu-latest - needs: [build] +# needs: [build] steps: - - uses: actions/download-artifact@v3 - with: - name: artifact - - name: Uploady csr - uses: appleboy/scp-action@master - with: - host: ${{ secrets.DEPLOY_SSH_HOST }} - username: ${{ secrets.DEPLOY_SSH_USER }} - key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} - port: ${{ secrets.DEPLOY_SSH_PORT }} - source: csr - target: ~/ +# - uses: actions/download-artifact@v3 +# with: +# name: artifact +# - name: Uploady csr +# uses: appleboy/scp-action@master +# with: +# host: ${{ secrets.DEPLOY_SSH_HOST }} +# username: ${{ secrets.DEPLOY_SSH_USER }} +# key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} +# port: ${{ secrets.DEPLOY_SSH_PORT }} +# source: csr +# target: ~/ - name: Deploy uses: appleboy/ssh-action@master with: @@ -87,7 +87,7 @@ jobs: port: ${{ secrets.DEPLOY_SSH_PORT }} script: | mkdir -p /var/www/csr/stage/ - echo '${{ secrets.DEPLOY_CONF }}' | sudo tee /var/www/csr/stage/config.json + echo '${{ secrets.DEPLOY_CONFIG }}' | sudo tee /var/www/csr/stage/config.json echo '${{ vars.NGINX_CONF }}' | sudo tee /etc/nginx/conf.d/stage.csr.conf echo '${{ vars.DEFAULT_NGINX_CONF }}' | sudo tee /etc/systemd/nginx.conf echo '${{ vars.SYSTEMD_CONF }}' | sudo tee /etc/systemd/system/stage.csr.service From a16a82722b9c162828eef51020e12c3752c7d1a3 Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 18:47:30 +0300 Subject: [PATCH 14/15] Update blank.yml --- .github/workflows/blank.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 6a8e093b..7f8a0f27 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -87,7 +87,7 @@ jobs: port: ${{ secrets.DEPLOY_SSH_PORT }} script: | mkdir -p /var/www/csr/stage/ - echo '${{ secrets.DEPLOY_CONFIG }}' | sudo tee /var/www/csr/stage/config.json + echo '${{ secrets.APPLICATION_CONF }}' | sudo tee /var/www/csr/stage/config.json echo '${{ vars.NGINX_CONF }}' | sudo tee /etc/nginx/conf.d/stage.csr.conf echo '${{ vars.DEFAULT_NGINX_CONF }}' | sudo tee /etc/systemd/nginx.conf echo '${{ vars.SYSTEMD_CONF }}' | sudo tee /etc/systemd/system/stage.csr.service From e38a56bf1b5109bb98815c2dd964e79a5e9d52ee Mon Sep 17 00:00:00 2001 From: karpovichart Date: Sat, 4 Feb 2023 18:48:27 +0300 Subject: [PATCH 15/15] Update blank.yml --- .github/workflows/blank.yml | 134 ++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml index 7f8a0f27..43645979 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/blank.yml @@ -6,78 +6,78 @@ on: pull_request: branches: ["master"] jobs: -# test: -# runs-on: ubuntu-22.04 -# container: golang:1.19-alpine -# steps: -# - uses: actions/checkout@v3 -# - name: Test -# env: -# min_coverage: '70' -# coverage_result: '/total:\s+\(statements\)\s+(\d+.\d+)\%/' -# run: | -# set -e -# apk add --update --no-cache make -# make setup_alpine && make setup && make generate -# go test $(go list ./... | grep -v generated) -race -coverprofile=coverage.out -short -# make coverage && coverage_total=$(make coverage_total | tail -n1) && echo $coverage_total -# if [ $min_coverage -gt $coverage_total ]; then exit 1; else echo "unit tests OK"; fi -# lint: -# runs-on: ubuntu-latest -# container: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine -# steps: -# - uses: actions/checkout@v3 -# - name: Lint -# run: | -# set -e -# apk add --update --no-cache make -# make setup_alpine && make setup && make generate -# make lint -# ls -# echo "---" -# cat report.txt -# echo "---" -# - name: 'Upload Artifact' -# uses: actions/upload-artifact@v3 -# with: -# name: lint-report -# path: report.txt -# retention-days: 5 -# build: -# runs-on: ubuntu-latest -# container: golang:1.19-alpine -# needs: [lint,test] -# steps: -# - uses: actions/checkout@v3 -# - name: Build -# run: | -# apk add --update --no-cache make -# make setup_alpine && make setup && make generate && make build -# - name: 'Upload Artifact' -# uses: actions/upload-artifact@v3 -# with: -# name: artifact -# path: csr -# retention-days: 5 + test: + runs-on: ubuntu-22.04 + container: golang:1.19-alpine + steps: + - uses: actions/checkout@v3 + - name: Test + env: + min_coverage: '70' + coverage_result: '/total:\s+\(statements\)\s+(\d+.\d+)\%/' + run: | + set -e + apk add --update --no-cache make + make setup_alpine && make setup && make generate + go test $(go list ./... | grep -v generated) -race -coverprofile=coverage.out -short + make coverage && coverage_total=$(make coverage_total | tail -n1) && echo $coverage_total + if [ $min_coverage -gt $coverage_total ]; then exit 1; else echo "unit tests OK"; fi + lint: + runs-on: ubuntu-latest + container: registry.gitlab.com/gitlab-org/gitlab-build-images:golangci-lint-alpine + steps: + - uses: actions/checkout@v3 + - name: Lint + run: | + set -e + apk add --update --no-cache make + make setup_alpine && make setup && make generate + make lint + ls + echo "---" + cat report.txt + echo "---" + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: lint-report + path: report.txt + retention-days: 5 + build: + runs-on: ubuntu-latest + container: golang:1.19-alpine + needs: [lint,test] + steps: + - uses: actions/checkout@v3 + - name: Build + run: | + apk add --update --no-cache make + make setup_alpine && make setup && make generate && make build + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: artifact + path: csr + retention-days: 5 deploy: - # if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' environment: stage runs-on: ubuntu-latest -# needs: [build] + needs: [build] steps: -# - uses: actions/download-artifact@v3 -# with: -# name: artifact -# - name: Uploady csr -# uses: appleboy/scp-action@master -# with: -# host: ${{ secrets.DEPLOY_SSH_HOST }} -# username: ${{ secrets.DEPLOY_SSH_USER }} -# key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} -# port: ${{ secrets.DEPLOY_SSH_PORT }} -# source: csr -# target: ~/ + - uses: actions/download-artifact@v3 + with: + name: artifact + - name: Uploady csr + uses: appleboy/scp-action@master + with: + host: ${{ secrets.DEPLOY_SSH_HOST }} + username: ${{ secrets.DEPLOY_SSH_USER }} + key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }} + port: ${{ secrets.DEPLOY_SSH_PORT }} + source: csr + target: ~/ - name: Deploy uses: appleboy/ssh-action@master with: