Skip to content

Commit 16fb425

Browse files
committed
add linux pr check
1 parent b7b20a0 commit 16fb425

File tree

3 files changed

+200
-58
lines changed

3 files changed

+200
-58
lines changed

.github/workflows/linux-artifacts.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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: make out/linux-arm64/crc
34+
- name: Upload linux binary
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: linux-binary
38+
path: "out/linux-arm64/crc"
39+
build-qe:
40+
runs-on: ubuntu-latest
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
os: ['linux']
45+
arch: ['amd64', 'arm64']
46+
steps:
47+
- name: Check out repository code
48+
uses: actions/checkout@v4
49+
- name: Build qe oci images ${{matrix.os}}-${{matrix.arch}}
50+
run: |
51+
# e2e
52+
CRC_E2E_IMG_VERSION=gh ARCH=${{matrix.arch}} OS=${{matrix.os}} make containerized_e2e
53+
podman save -o ${{ env.IMAGE_NAME_E2E }}-${{matrix.os}}-${{matrix.arch}}.tar \
54+
quay.io/crcont/${{ env.IMAGE_NAME_E2E}}:gh-${{matrix.os}}-${{matrix.arch}}
55+
# integration
56+
CRC_INTEGRATION_IMG_VERSION=gh ARCH=${{matrix.arch}} OS=${{matrix.os}} make containerized_integration
57+
podman save -o ${{ env.IMAGE_NAME_INTEGRATION }}-${{matrix.os}}-${{matrix.arch}}.tar \
58+
quay.io/crcont/${{ env.IMAGE_NAME_INTEGRATION}}:gh-${{matrix.os}}-${{matrix.arch}}
59+
- name: Upload e2e ${{matrix.os}}-${{matrix.arch}}
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: ${{ env.IMAGE_NAME_E2E }}-${{matrix.os}}-${{matrix.arch}}
63+
path: ${{ env.IMAGE_NAME_E2E }}-${{matrix.os}}-${{matrix.arch}}.tar
64+
- name: Upload integration ${{matrix.os}}-${{matrix.arch}}
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: ${{ env.IMAGE_NAME_INTEGRATION }}-${{matrix.os}}-${{matrix.arch}}
68+
path: ${{ env.IMAGE_NAME_INTEGRATION }}-${{matrix.os}}-${{matrix.arch}}.tar
69+
save-gh-context:
70+
runs-on: ubuntu-latest
71+
strategy:
72+
fail-fast: false
73+
steps:
74+
- name: Save the GH context in an artifact
75+
env:
76+
GH_CONTEXT: ${{ toJSON(github) }}
77+
run: echo $GH_CONTEXT > gh_context.json
78+
- name: Upload the GH context artifact
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: gh-context
82+
path: gh_context.json

.github/workflows/linux-qe.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: tester-linux
2+
3+
on:
4+
workflow_run:
5+
workflows: [Build Linux 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+
ssh-keygen -t rsa -N '' -f id_rsa -q
27+
28+
- name: reserve machine from testing farm
29+
env:
30+
TESTING_FARM_API_TOKEN: ${{ secrets.TESTING_FARM_API_TOKEN }}
31+
run: |
32+
export TESTING_FARM_API_TOKEN=$TESTING_FARM_API_TOKEN
33+
eval $(ssh-agent)
34+
testing-farm reserve --compose Fedora-40 --arch aarch64 --ssh-public-key id_rsa.pub --no-autoconnect | tee info
35+
machine=`tail -n 1 info`
36+
echo ${machine##*@} > host
37+
echo "root" > username
38+
#ssh -o StrictHostKeyChecking=no -i id_rsa root@$host
39+
40+
- name: Download linux binary
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: linux-binary
44+
run-id: ${{ github.event.workflow_run.id }}
45+
github-token: ${{ github.token }}
46+
47+
- name: Download qe oci image
48+
id: download-qe-oci-image-artifact
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: crc-e2e-linux-arm64
52+
run-id: ${{ github.event.workflow_run.id }}
53+
github-token: ${{ github.token }}
54+
55+
- name: Correlate
56+
env:
57+
PULL_SECRET: ${{ secrets.PULL_SECRET }}
58+
run: |
59+
# Save pull-secret as file
60+
echo "${PULL_SECRET}" > pull-secret
61+
62+
- name: Install CRC on host
63+
run: |
64+
podman run --rm -d --name crc-linux-install \
65+
-e TARGET_HOST=$(cat host) \
66+
-e TARGET_HOST_USERNAME=$(cat username) \
67+
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
68+
-e TARGET_FOLDER=crc-support \
69+
-e TARGET_CLEANUP='false' \
70+
-e OUTPUT_FOLDER=/data \
71+
-e DEBUG='true' \
72+
-v ${PWD}:/data:z \
73+
-v ${PWD}/crc:/opt/crc-support/crc:z \
74+
quay.io/rhqp/crc-support:v0.6-linux crc-support/install.sh crc-support/crc
75+
podman logs -f crc-linux-install
76+
77+
- name: Run CRC e2e test
78+
run: |
79+
# load image
80+
podman load -i crc-e2e-linux-arm64.tar
81+
# run
82+
cmd="crc-qe/run.sh -junitFilename crc-e2e-junit.xml -targetFolder crc-qe"
83+
cmd_microshift="${cmd} -e2eTagExpression '@story_microshift'"
84+
cmd_openshift="${cmd} -e2eTagExpression '~@minimal && ~@story_microshift'"
85+
podman run --rm -d --name crc-e2e \
86+
-e TARGET_HOST=$(cat host) \
87+
-e TARGET_HOST_USERNAME=$(cat username) \
88+
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
89+
-e TARGET_FOLDER=crc-qe \
90+
-e TARGET_RESULTS=results \
91+
-e OUTPUT_FOLDER=/data \
92+
-e DEBUG=true \
93+
-v $PWD/pull-secret:/opt/crc/pull-secret:z \
94+
-v $PWD:/data:z \
95+
quay.io/crcont/crc-e2e:gh-linux-armd64 \
96+
${cmd_openshift}
97+
podman logs -f crc-e2e
98+
99+
- name: Test Report
100+
id: test-report
101+
uses: mikepenz/action-junit-report@v4
102+
if: always()
103+
with:
104+
fail_on_failure: true
105+
include_passed: true
106+
detailed_summary: true
107+
require_tests: true
108+
report_paths: '**/*.xml'
109+
110+
- name: Upload e2e results
111+
uses: actions/upload-artifact@v4
112+
if: always()
113+
with:
114+
name: linux-e2e-test
115+
path: |
116+
**/*.xml
117+
**/*.results
118+
**/*.log

.github/workflows/testing-farm.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)