Skip to content

Commit 5aa3387

Browse files
committed
add testing farm github action
1 parent 7b042f7 commit 5aa3387

File tree

2 files changed

+232
-0
lines changed

2 files changed

+232
-0
lines changed

.github/workflows/linux-artifacts.yml

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: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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+
testing-farm reserve --compose Fedora-40 --duration 240 --arch aarch64 --ssh-public-key id_rsa.pub --no-autoconnect | tee info
51+
machine=`tail -n 1 info`
52+
echo ${machine##*@} > host
53+
echo root > username
54+
echo proxy > bastion_username
55+
echo testing-farm.io > bastion_host
56+
#ssh -o StrictHostKeyChecking=no -i id_rsa root@$host
57+
58+
- name: Download linux binary
59+
working-directory: ${{ env.timestamp }}
60+
uses: actions/download-artifact@v4
61+
with:
62+
name: linux-binary
63+
run-id: ${{ github.event.workflow_run.id }}
64+
github-token: ${{ github.token }}
65+
66+
- name: Download qe oci image
67+
working-directory: ${{ env.timestamp }}
68+
id: download-qe-oci-image-artifact
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: crc-e2e-linux-arm64
72+
run-id: ${{ github.event.workflow_run.id }}
73+
github-token: ${{ github.token }}
74+
75+
- name: Install CRC on host
76+
working-directory: ${{ env.timestamp }}
77+
run: |
78+
podman run --rm -d --privileged --name crc-linux-install \
79+
-e TARGET_HOST=$(cat host) \
80+
-e TARGET_HOST_USERNAME=$(cat username) \
81+
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
82+
-e BASTION_HOST_USERNAME=$(cat bastion_username) \
83+
-e BASTION_HOST=$(cat bastion_host) \
84+
-e TARGET_FOLDER=crc-support \
85+
-e TARGET_CLEANUP='false' \
86+
-e OUTPUT_FOLDER=/data \
87+
-e DEBUG='true' \
88+
-e SSH_AUTH_SOCK=$(cat ssh_auth_sock) \
89+
-v "$(cat ssh_auth_sock):$(cat ssh_auth_sock)" \
90+
-v ${PWD}:/data:z \
91+
-v ${PWD}/crc:/opt/crc-support/crc:z \
92+
quay.io/rhqp/crc-support:v0.5.1-linux crc-support/install.sh crc-support/crc
93+
podman logs -f crc-linux-install
94+
95+
- name: Run CRC e2e test
96+
working-directory: ${{ env.timestamp }}
97+
run: |
98+
# load image
99+
podman load -i crc-e2e-linux-arm64.tar
100+
# run
101+
cmd="crc-qe/run.sh -junitFilename crc-e2e-junit.xml -targetFolder crc-qe"
102+
cmd_microshift="${cmd} -e2eTagExpression '@story_microshift'"
103+
cmd_openshift="${cmd} -e2eTagExpression '~@minimal && ~@story_microshift'"
104+
podman run --rm -d --privileged --name crc-e2e \
105+
-e TARGET_HOST=$(cat host) \
106+
-e TARGET_HOST_USERNAME=$(cat username) \
107+
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
108+
-e BASTION_HOST_USERNAME=$(cat bastion_username) \
109+
-e BASTION_HOST=$(cat bastion_host) \
110+
-e TARGET_FOLDER=crc-qe \
111+
-e TARGET_RESULTS=results \
112+
-e OUTPUT_FOLDER=/data \
113+
-e DEBUG=true \
114+
-e SSH_AUTH_SOCK=$(cat ssh_auth_sock) \
115+
-v "$(cat ssh_auth_sock):$(cat ssh_auth_sock)" \
116+
-v $PWD/pull-secret:/opt/crc/pull-secret:z \
117+
-v $PWD:/data:z \
118+
quay.io/crcont/crc-e2e:gh-linux-arm64 \
119+
${cmd_openshift}
120+
podman logs -f crc-e2e
121+
122+
- name: Test Report
123+
working-directory: ${{ env.timestamp }}
124+
id: test-report
125+
uses: mikepenz/action-junit-report@v4
126+
if: always()
127+
with:
128+
fail_on_failure: true
129+
include_passed: true
130+
detailed_summary: true
131+
require_tests: true
132+
report_paths: '**/*.xml'
133+
134+
- name: Upload e2e results
135+
working-directory: ${{ env.timestamp }}
136+
uses: actions/upload-artifact@v4
137+
if: always()
138+
with:
139+
name: linux-e2e-test
140+
path: |
141+
**/*.xml
142+
**/*.results
143+
**/*.log
144+
145+
- name: Env clear
146+
run: |
147+
kill $(cat ${{ env.commit_sha }}/ssh_agent_pid)
148+
rm -r ${{ env.commit_sha }}
149+

0 commit comments

Comments
 (0)