-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (134 loc) · 5.03 KB
/
test.yaml
File metadata and controls
157 lines (134 loc) · 5.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Deploy dev
on:
workflow_dispatch:
inputs:
repository:
description: docker registry repository name
default: plataforma-unico
type: string
required: true
ref:
description: branch, tag or SHA to refer your code
required: true
type: string
app_name:
description: Application namespace
required: true
type: choice
options:
- bff/user/api
- core/api
- ingress/userauthz/filter
- ingress/vaultauthz/filter
- moja/dictionary/api
- moja/document/api
- moja/docupdateidns
- moja/product/api
- notification/notification/api
- notification/pendingactivities/api
- notification/preference/api
- notification/push/api
- preference/preference/api
env:
GO_VERSION: "1.20"
GITHUB_ACCESS_TOKEN: ${{ secrets.SA_SRE_READONLY }}
OUTPUT_FOLDER_PATH: ./build
GCP_JSON_B64: ${{ secrets.gcp_auth_json_b64 != '' && secrets.gcp_auth_json_b64 || secrets.GCP_REGISTRY_CROSS }}
GCP_JSON_PATH: ${{ secrets.gcp_auth_json_b64 != '' && 'custom.json' || 'uar.json' }}
DOCKER_REGISTRY_ENDPOINT: "us-east1-docker.pkg.dev"
DOCKER_REPOSITORY_NAME: "plataforma-unico"
GCP_PROJECT_ID: "u8ea11577"
# Go Code Entrypoint
# Note: All Variable has _SRC_ENTRYPOINT as suffix. The prefix must be the same of tag prefix, in upper case and replace - to _. Example tag: bff-user-api/1.0.0, env will be BFF_USER_API_SRC_ENTRYPOINT. The same to _CODE_FOLDER
BFF_USER_API_SRC_ENTRYPOINT: cmd/user/api/main.go
BFF_USER_API_CODE_FOLDER: internal/user
BFF_USER_API_SONARQUBE_PRODUCT_KEY: acesso_you_bff_user_api
CORE_API_SRC_ENTRYPOINT: cmd/core/api/main.go
CORE_API_SRC_CODE_FOLDER: cmd/core/api/main.go
CORE_API_SONARQUBE_PRODUCT_KEY: acesso_you_bff_user_api
jobs:
testando:
name: testando
runs-on: ubuntu-22.04
steps:
- run: echo ${{ inputs.ref }}
- run: echo ${{ inputs.app_name }}
- name: Checkout code ${{ inputs.ref }}
uses: actions/checkout@v3
with:
fetch-depth: 1
ref: ${{ inputs.ref }}
- run: ls -la
# build:
# name: Build
# runs-on: ubuntu-22.04
# needs: [env-setup]
# env:
# GOPRIVATE: github.com/acesso-io
# GIT_CONFIG_TOKEN: $GITHUB_ACCESS_TOKEN
# SRC_ENTRYPOINT: ${{ needs.env-setup.outputs.src_entrypoint }}
# steps:
# - name: Checkout code ${{ github.head_ref }}
# uses: actions/checkout@v3
# with:
# fetch-depth: 1
# ref: ${{ github.head_ref }}
# - uses: actions/setup-go@v4
# name: Install Go ${{ needs.env-setup.outputs.go_version }}
# with:
# go-version: ${{ needs.env-setup.outputs.go_version }}
# - name: Git configure
# run: git config --global url.https://$GITHUB_ACCESS_TOKEN@github.com/.insteadOf https://github.com/
# - uses: actions/cache@v2
# with:
# path: |
# ~/.cache/go-build
# ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# restore-keys: |
# ${{ runner.os }}-go-
# - name: Go fmt
# shell: bash
# run: |
# ! go fmt ./... 2>&1 | read
# - name: Go Build
# run: |
# go build -v -o ${{ env.OUTPUT_FOLDER_PATH }}/${{ needs.env-setup.outputs.app_name }} $SRC_ENTRYPOINT
# echo "file inside bin folder..."
# ls -la ${{ env.OUTPUT_FOLDER_PATH }}
# - name: Create Artifact
# id: create_actifact
# uses: actions/upload-artifact@v3
# with:
# name: ${{ needs.env-setup.outputs.app_name }}
# path: ${{ env.OUTPUT_FOLDER_PATH }}
# retention-days: 1
# docker-image:
# name: Docker Push ${{ needs.env-setup.outputs.release_version }}
# runs-on: ubuntu-22.04
# env:
# DOCKER_IMAGE_FULLNAME: ${{ needs.env-setup.outputs.docker_image_fullname }}
# needs: [env-setup, build]
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Setup gcloud
# uses: google-github-actions/setup-gcloud@v0
# - name: GCP Auth
# run: |
# echo -n "${GCP_JSON_B64}" | base64 --decode > "${GCP_JSON_PATH}"
# gcloud auth activate-service-account --key-file="${GCP_JSON_PATH}"
# gcloud auth configure-docker ${DOCKER_REGISTRY_ENDPOINT}
# - name: Get Binary
# uses: actions/download-artifact@v3
# with:
# name: ${{ needs.env-setup.outputs.app_name }}
# path: ${{ env.OUTPUT_FOLDER_PATH }}
# - name: List Directory
# run: ls -la
# - name: Docker Build
# run: docker build --build-arg APP_NAME=${{ needs.env-setup.outputs.app_name }} -f Dockerfile.ci -t "${DOCKER_IMAGE_FULLNAME}" .
# - name: Docker push to UAR (Unico Artifact Registry)
# run: |
# gcloud auth configure-docker ${{ env.DOCKER_REGISTRY_ENDPOINT }}
# docker push "${DOCKER_IMAGE_FULLNAME}"