Skip to content

Commit 1cea656

Browse files
committed
SCALRCORE-25157: Migrate go-scalr tests to tev2
1 parent 852d297 commit 1cea656

File tree

1 file changed

+86
-35
lines changed

1 file changed

+86
-35
lines changed

.github/workflows/default.yml

Lines changed: 86 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ jobs:
2121
env:
2222
SCALR_TOKEN: ${{ secrets.SCALR_TOKEN }}
2323
UPSTREAM_ID: ${{ github.run_number }}
24-
GCP: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
25-
GH_PAT: ${{ secrets.GH_PAT }}
2624
steps:
2725
- uses: actions/checkout@v3
2826
- uses: actions/setup-go@v3
@@ -58,38 +56,91 @@ jobs:
5856
- name: Pull python builder
5957
shell: bash
6058
run: |
59+
echo "::group::Pull python builder image"
6160
docker pull eu.gcr.io/development-156220/fatmouse/python-builder:master
6261
docker tag eu.gcr.io/development-156220/fatmouse/python-builder:master fatmouse/python-builder:master
63-
# - name: Create container
64-
# id: create
65-
# uses: Scalr/gh-action-revizor@master
66-
# with:
67-
# command: create
68-
# - name: Run tests
69-
# env:
70-
# SCALR_ADDRESS: https://${{ steps.create.outputs.hostname }}
71-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
# TEST_AWS_ACCESS_KEY: ${{ secrets.TEST_AWS_ACCESS_KEY }}
73-
# TEST_AWS_SECRET_KEY: ${{ secrets.TEST_AWS_SECRET_KEY }}
74-
# TEST_AWS_ROLE_ARN: ${{ secrets.TEST_AWS_ROLE_ARN }}
75-
# TEST_AWS_EXTERNAL_ID: ${{ secrets.TEST_AWS_EXTERNAL_ID }}
76-
# TEST_ARM_CLIENT_ID: ${{ secrets.TEST_ARM_CLIENT_ID }}
77-
# TEST_ARM_CLIENT_SECRET: ${{ secrets.TEST_ARM_CLIENT_SECRET }}
78-
# TEST_ARM_TENANT_ID: ${{ secrets.TEST_ARM_TENANT_ID }}
79-
# TEST_ARM_SUBSCRIPTION_ID: ${{ secrets.TEST_ARM_SUBSCRIPTION_ID }}
80-
# run: make test
81-
# - name: Install goveralls
82-
# env:
83-
# GO111MODULE: off
84-
# run: go get github.com/mattn/goveralls
85-
# - name: Send coverage
86-
# env:
87-
# COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
# run: goveralls -coverprofile=covprofile -service=github
89-
# - name: Delete container
90-
# id: delete
91-
# if: ${{ always() && steps.create.outputs.container_id }}
92-
# uses: Scalr/gh-action-revizor@master
93-
# with:
94-
# command: delete
95-
# container_id: ${{ steps.create.outputs.container_id }}
62+
echo "::endgroup::"
63+
- name: Get current job log URL
64+
uses: Tiryoh/gha-jobid-action@v0
65+
id: get-job-id
66+
with:
67+
github_token: ${{ secrets.GITHUB_TOKEN }}
68+
job_name: ${{ github.job }}
69+
- name: Generate run tag
70+
shell: bash
71+
run: |
72+
if [ ${{ github.run_attempt }} = 1 ]; then
73+
RERUN_SUFFIX=""
74+
else
75+
RERUN_SUFFIX=$(echo -${{ github.run_attempt }})
76+
fi
77+
echo "RUN_TAG=e2e-${{ github.workflow }}-${{ github.job }}-${{ github.run_number }}${RERUN_SUFFIX}" >> $GITHUB_ENV
78+
- name: Create container
79+
id: create
80+
shell: bash
81+
run: |
82+
if [ -z ${{ env.API_BRANCH }} ]; then
83+
FATMOUSE_BRANCH=""
84+
else
85+
FATMOUSE_BRANCH="--fatmouse-branch ${{ env.API_BRANCH }}"
86+
fi
87+
88+
if [ -z ${{ env.DB_BRANCH }} ]; then
89+
SCALR_BRANCH=""
90+
else
91+
SCALR_BRANCH="--scalr-branch ${{ env.DB_BRANCH }}"
92+
fi
93+
94+
if [ "${{ env.API_BRANCH }}" = "staging" ]; then
95+
IMAGE="--scalr-server-image-tag staging"
96+
else
97+
IMAGE=""
98+
fi
99+
100+
docker run --rm \
101+
-e GITHUB_WORKSPACE=true \
102+
-e GITHUB_OUTPUT=/fatmouse/output \
103+
-w /fatmouse \
104+
-v $PWD/fatmouse:/fatmouse \
105+
-v $GITHUB_OUTPUT:/fatmouse/output \
106+
-v ~/.scalr-labs:/etc/scalr-labs \
107+
fatmouse/python-builder:master python -u clickfile.py te up \
108+
${FATMOUSE_BRANCH} ${SCALR_BRANCH} ${IMAGE} \
109+
--run-url ${{ steps.get-job-id.outputs.html_url }} \
110+
--skip-ui-build \
111+
--cpu=1 \
112+
--ram=2G \
113+
${{ env.RUN_TAG }}
114+
- name: Run tests
115+
env:
116+
SCALR_ADDRESS: ${{ steps.create.outputs.host }}
117+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118+
TEST_AWS_ACCESS_KEY: ${{ secrets.TEST_AWS_ACCESS_KEY }}
119+
TEST_AWS_SECRET_KEY: ${{ secrets.TEST_AWS_SECRET_KEY }}
120+
TEST_AWS_ROLE_ARN: ${{ secrets.TEST_AWS_ROLE_ARN }}
121+
TEST_AWS_EXTERNAL_ID: ${{ secrets.TEST_AWS_EXTERNAL_ID }}
122+
TEST_ARM_CLIENT_ID: ${{ secrets.TEST_ARM_CLIENT_ID }}
123+
TEST_ARM_CLIENT_SECRET: ${{ secrets.TEST_ARM_CLIENT_SECRET }}
124+
TEST_ARM_TENANT_ID: ${{ secrets.TEST_ARM_TENANT_ID }}
125+
TEST_ARM_SUBSCRIPTION_ID: ${{ secrets.TEST_ARM_SUBSCRIPTION_ID }}
126+
run: make test
127+
- name: Install goveralls
128+
env:
129+
GO111MODULE: off
130+
run: go get github.com/mattn/goveralls
131+
- name: Send coverage
132+
env:
133+
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134+
run: goveralls -coverprofile=covprofile -service=github
135+
- name: Delete container
136+
id: delete
137+
if: ${{ always() }}
138+
shell: bash
139+
run: |
140+
docker run --rm \
141+
-w /fatmouse \
142+
-v $PWD/fatmouse:/fatmouse \
143+
-v ~/.scalr-labs:/etc/scalr-labs \
144+
fatmouse/python-builder:master \
145+
python -u clickfile.py te rm \
146+
--no-wait ${{ env.RUN_TAG }}

0 commit comments

Comments
 (0)