Skip to content

Commit 07649fa

Browse files
committed
add testing farm github action
1 parent 7b042f7 commit 07649fa

File tree

2 files changed

+233
-0
lines changed

2 files changed

+233
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build Linux artifacts
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
paths-ignore:
7+
- 'docs/**'
8+
- 'images/docs-builder/**'
9+
- '*.adoc'
10+
pull_request:
11+
paths-ignore:
12+
- 'docs/**'
13+
- 'images/docs-builder/**'
14+
- '*.adoc'
15+
env:
16+
IMAGE_NAME_E2E: crc-e2e
17+
IMAGE_NAME_INTEGRATION: crc-integration
18+
jobs:
19+
build-installer:
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
go: ['1.21']
25+
steps:
26+
- name: Check out repository code
27+
uses: actions/checkout@v4
28+
- name: Set up Go
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version: ${{ matrix.go }}
32+
- name: Build Linux installer
33+
run: |
34+
make out/linux-arm64/crc
35+
- name: Upload linux binary
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: linux-binary
39+
path: "out/linux-arm64/crc"
40+
build-qe:
41+
runs-on: ubuntu-latest
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
os: ['linux']
46+
arch: ['amd64', 'arm64']
47+
steps:
48+
- name: Check out repository code
49+
uses: actions/checkout@v4
50+
- name: Build qe oci images ${{matrix.os}}-${{matrix.arch}}
51+
run: |
52+
# e2e
53+
CRC_E2E_IMG_VERSION=gh ARCH=${{matrix.arch}} OS=${{matrix.os}} make containerized_e2e
54+
podman save -o ${{ env.IMAGE_NAME_E2E }}-${{matrix.os}}-${{matrix.arch}}.tar \
55+
quay.io/crcont/${{ env.IMAGE_NAME_E2E}}:gh-${{matrix.os}}-${{matrix.arch}}
56+
# integration
57+
CRC_INTEGRATION_IMG_VERSION=gh ARCH=${{matrix.arch}} OS=${{matrix.os}} make containerized_integration
58+
podman save -o ${{ env.IMAGE_NAME_INTEGRATION }}-${{matrix.os}}-${{matrix.arch}}.tar \
59+
quay.io/crcont/${{ env.IMAGE_NAME_INTEGRATION}}:gh-${{matrix.os}}-${{matrix.arch}}
60+
- name: Upload e2e ${{matrix.os}}-${{matrix.arch}}
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: ${{ env.IMAGE_NAME_E2E }}-${{matrix.os}}-${{matrix.arch}}
64+
path: ${{ env.IMAGE_NAME_E2E }}-${{matrix.os}}-${{matrix.arch}}.tar
65+
- name: Upload integration ${{matrix.os}}-${{matrix.arch}}
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: ${{ env.IMAGE_NAME_INTEGRATION }}-${{matrix.os}}-${{matrix.arch}}
69+
path: ${{ env.IMAGE_NAME_INTEGRATION }}-${{matrix.os}}-${{matrix.arch}}.tar
70+
save-gh-context:
71+
runs-on: ubuntu-latest
72+
strategy:
73+
fail-fast: false
74+
steps:
75+
- name: Save the GH context in an artifact
76+
env:
77+
GH_CONTEXT: ${{ toJSON(github) }}
78+
run: echo $GH_CONTEXT > gh_context.json
79+
- name: Upload the GH context artifact
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: gh-context
83+
path: gh_context.json

.github/workflows/linux-qe.yml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: tester-linux
2+
3+
on:
4+
workflow_run:
5+
workflows: [Build Windows artifacts]
6+
types:
7+
- completed
8+
9+
jobs:
10+
tests:
11+
runs-on: [self-hosted, linux, testing-farm]
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
go: ['1.21']
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: ${{ matrix.go }}
22+
23+
- name: prepare env
24+
run: |
25+
sudo yum install podman openssh-server git make -y
26+
echo "commit_sha=${commit_sha}" >> "$GITHUB_ENV"
27+
mkdir ${{ env.commit_sha }}
28+
cd ${{ env.commit_sha }}
29+
30+
#timestamp=`date +%s`
31+
#mkdir $timestamp
32+
#echo "timestamp=$timestamp" >> $GITHUB_ENV
33+
$cd $timestamp
34+
35+
ssh-keygen -t rsa -N '' -f id_rsa -q
36+
eval $(ssh-agent -s)
37+
echo $SSH_AUTH_SOCK > ssh_auth_sock
38+
echo $SSH_AGENT_PID > ssh_agent_pid
39+
#kill $(cat ssh_agent_pid)
40+
ssh-add id_rsa
41+
42+
- name: reserve machine from testing farm
43+
working-directory: ${{ env.timestamp }}
44+
env:
45+
TESTING_FARM_API_TOKEN: ${{ secrets.TESTING_FARM_API_TOKEN }}
46+
PULL_SECRET: ${{ secrets.PULL_SECRET }}
47+
run: |
48+
echo "${PULL_SECRET}" > pull-secret
49+
export TESTING_FARM_API_TOKEN=${TESTING_FARM_API_TOKEN}
50+
#export TESTING_FARM_API_TOKEN=4a7ba1e1-3881-4bf8-9543-b3521b4fed17
51+
testing-farm reserve --compose Fedora-40 --duration 240 --arch aarch64 --ssh-public-key id_rsa.pub --no-autoconnect | tee info
52+
machine=`tail -n 1 info`
53+
echo ${machine##*@} > host
54+
echo root > username
55+
echo proxy > bastion_username
56+
echo testing-farm.io > bastion_host
57+
#ssh -o StrictHostKeyChecking=no -i id_rsa root@$host
58+
59+
- name: Download linux binary
60+
working-directory: ${{ env.timestamp }}
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: linux-binary
64+
run-id: ${{ github.event.workflow_run.id }}
65+
github-token: ${{ github.token }}
66+
67+
- name: Download qe oci image
68+
working-directory: ${{ env.timestamp }}
69+
id: download-qe-oci-image-artifact
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: crc-e2e-linux-arm64
73+
run-id: ${{ github.event.workflow_run.id }}
74+
github-token: ${{ github.token }}
75+
76+
- name: Install CRC on host
77+
working-directory: ${{ env.timestamp }}
78+
run: |
79+
podman run --rm -d --privileged --name crc-linux-install \
80+
-e TARGET_HOST=$(cat host) \
81+
-e TARGET_HOST_USERNAME=$(cat username) \
82+
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
83+
-e BASTION_HOST_USERNAME=$(cat bastion_username) \
84+
-e BASTION_HOST=$(cat bastion_host) \
85+
-e TARGET_FOLDER=crc-support \
86+
-e TARGET_CLEANUP='false' \
87+
-e OUTPUT_FOLDER=/data \
88+
-e DEBUG='true' \
89+
-e SSH_AUTH_SOCK=$(cat ssh_auth_sock) \
90+
-v "$(cat ssh_auth_sock):$(cat ssh_auth_sock)" \
91+
-v ${PWD}:/data:z \
92+
-v ${PWD}/crc:/opt/crc-support/crc:z \
93+
quay.io/rhqp/crc-support:v0.5.1-linux crc-support/install.sh crc-support/crc
94+
podman logs -f crc-linux-install
95+
96+
- name: Run CRC e2e test
97+
working-directory: ${{ env.timestamp }}
98+
run: |
99+
# load image
100+
podman load -i crc-e2e-linux-arm64.tar
101+
# run
102+
cmd="crc-qe/run.sh -junitFilename crc-e2e-junit.xml -targetFolder crc-qe"
103+
cmd_microshift="${cmd} -e2eTagExpression '@story_microshift'"
104+
cmd_openshift="${cmd} -e2eTagExpression '~@minimal && ~@story_microshift'"
105+
podman run --rm -d --privileged --name crc-e2e \
106+
-e TARGET_HOST=$(cat host) \
107+
-e TARGET_HOST_USERNAME=$(cat username) \
108+
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
109+
-e BASTION_HOST_USERNAME=$(cat bastion_username) \
110+
-e BASTION_HOST=$(cat bastion_host) \
111+
-e TARGET_FOLDER=crc-qe \
112+
-e TARGET_RESULTS=results \
113+
-e OUTPUT_FOLDER=/data \
114+
-e DEBUG=true \
115+
-e SSH_AUTH_SOCK=$(cat ssh_auth_sock) \
116+
-v "$(cat ssh_auth_sock):$(cat ssh_auth_sock)" \
117+
-v $PWD/pull-secret:/opt/crc/pull-secret:z \
118+
-v $PWD:/data:z \
119+
quay.io/crcont/crc-e2e:gh-linux-arm64 \
120+
${cmd_openshift}
121+
podman logs -f crc-e2e
122+
123+
- name: Test Report
124+
working-directory: ${{ env.timestamp }}
125+
id: test-report
126+
uses: mikepenz/action-junit-report@v4
127+
if: always()
128+
with:
129+
fail_on_failure: true
130+
include_passed: true
131+
detailed_summary: true
132+
require_tests: true
133+
report_paths: '**/*.xml'
134+
135+
- name: Upload e2e results
136+
working-directory: ${{ env.timestamp }}
137+
uses: actions/upload-artifact@v4
138+
if: always()
139+
with:
140+
name: linux-e2e-test
141+
path: |
142+
**/*.xml
143+
**/*.results
144+
**/*.log
145+
146+
- name: Env clear
147+
run: |
148+
kill $(cat ${{ env.commit_sha }}/ssh_agent_pid)
149+
rm -r ${{ env.commit_sha }}
150+

0 commit comments

Comments
 (0)