Skip to content

Commit

Permalink
add linux pr check
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyLuLiu committed Aug 30, 2024
1 parent b7b20a0 commit 16fb425
Show file tree
Hide file tree
Showing 3 changed files with 200 additions and 58 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/linux-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build Linux artifacts
on:
push:
branches:
- "main"
paths-ignore:
- 'docs/**'
- 'images/docs-builder/**'
- '*.adoc'
pull_request:
paths-ignore:
- 'docs/**'
- 'images/docs-builder/**'
- '*.adoc'
env:
IMAGE_NAME_E2E: crc-e2e
IMAGE_NAME_INTEGRATION: crc-integration
jobs:
build-installer:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: ['1.21']
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Build Linux installer
run: make out/linux-arm64/crc
- name: Upload linux binary
uses: actions/upload-artifact@v4
with:
name: linux-binary
path: "out/linux-arm64/crc"
build-qe:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: ['linux']
arch: ['amd64', 'arm64']
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Build qe oci images ${{matrix.os}}-${{matrix.arch}}
run: |
# e2e
CRC_E2E_IMG_VERSION=gh ARCH=${{matrix.arch}} OS=${{matrix.os}} make containerized_e2e
podman save -o ${{ env.IMAGE_NAME_E2E }}-${{matrix.os}}-${{matrix.arch}}.tar \
quay.io/crcont/${{ env.IMAGE_NAME_E2E}}:gh-${{matrix.os}}-${{matrix.arch}}
# integration
CRC_INTEGRATION_IMG_VERSION=gh ARCH=${{matrix.arch}} OS=${{matrix.os}} make containerized_integration
podman save -o ${{ env.IMAGE_NAME_INTEGRATION }}-${{matrix.os}}-${{matrix.arch}}.tar \
quay.io/crcont/${{ env.IMAGE_NAME_INTEGRATION}}:gh-${{matrix.os}}-${{matrix.arch}}
- name: Upload e2e ${{matrix.os}}-${{matrix.arch}}
uses: actions/upload-artifact@v4
with:
name: ${{ env.IMAGE_NAME_E2E }}-${{matrix.os}}-${{matrix.arch}}
path: ${{ env.IMAGE_NAME_E2E }}-${{matrix.os}}-${{matrix.arch}}.tar
- name: Upload integration ${{matrix.os}}-${{matrix.arch}}
uses: actions/upload-artifact@v4
with:
name: ${{ env.IMAGE_NAME_INTEGRATION }}-${{matrix.os}}-${{matrix.arch}}
path: ${{ env.IMAGE_NAME_INTEGRATION }}-${{matrix.os}}-${{matrix.arch}}.tar
save-gh-context:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Save the GH context in an artifact
env:
GH_CONTEXT: ${{ toJSON(github) }}
run: echo $GH_CONTEXT > gh_context.json
- name: Upload the GH context artifact
uses: actions/upload-artifact@v4
with:
name: gh-context
path: gh_context.json
118 changes: 118 additions & 0 deletions .github/workflows/linux-qe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: tester-linux

on:
workflow_run:
workflows: [Build Linux artifacts]
types:
- completed

jobs:
tests:
runs-on: [self-hosted, linux, testing-farm]
strategy:
fail-fast: false
matrix:
go: ['1.21']
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: prepare env
run: |
sudo yum install podman openssh-server git make -y
ssh-keygen -t rsa -N '' -f id_rsa -q
- name: reserve machine from testing farm
env:
TESTING_FARM_API_TOKEN: ${{ secrets.TESTING_FARM_API_TOKEN }}
run: |
export TESTING_FARM_API_TOKEN=$TESTING_FARM_API_TOKEN
eval $(ssh-agent)
testing-farm reserve --compose Fedora-40 --arch aarch64 --ssh-public-key id_rsa.pub --no-autoconnect | tee info
machine=`tail -n 1 info`
echo ${machine##*@} > host
echo "root" > username
#ssh -o StrictHostKeyChecking=no -i id_rsa root@$host
- name: Download linux binary
uses: actions/download-artifact@v4
with:
name: linux-binary
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}

- name: Download qe oci image
id: download-qe-oci-image-artifact
uses: actions/download-artifact@v4
with:
name: crc-e2e-linux-arm64
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}

- name: Correlate
env:
PULL_SECRET: ${{ secrets.PULL_SECRET }}
run: |
# Save pull-secret as file
echo "${PULL_SECRET}" > pull-secret
- name: Install CRC on host
run: |
podman run --rm -d --name crc-linux-install \
-e TARGET_HOST=$(cat host) \
-e TARGET_HOST_USERNAME=$(cat username) \
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
-e TARGET_FOLDER=crc-support \
-e TARGET_CLEANUP='false' \
-e OUTPUT_FOLDER=/data \
-e DEBUG='true' \
-v ${PWD}:/data:z \
-v ${PWD}/crc:/opt/crc-support/crc:z \
quay.io/rhqp/crc-support:v0.6-linux crc-support/install.sh crc-support/crc
podman logs -f crc-linux-install
- name: Run CRC e2e test
run: |
# load image
podman load -i crc-e2e-linux-arm64.tar
# run
cmd="crc-qe/run.sh -junitFilename crc-e2e-junit.xml -targetFolder crc-qe"
cmd_microshift="${cmd} -e2eTagExpression '@story_microshift'"
cmd_openshift="${cmd} -e2eTagExpression '~@minimal && ~@story_microshift'"
podman run --rm -d --name crc-e2e \
-e TARGET_HOST=$(cat host) \
-e TARGET_HOST_USERNAME=$(cat username) \
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
-e TARGET_FOLDER=crc-qe \
-e TARGET_RESULTS=results \
-e OUTPUT_FOLDER=/data \
-e DEBUG=true \
-v $PWD/pull-secret:/opt/crc/pull-secret:z \
-v $PWD:/data:z \
quay.io/crcont/crc-e2e:gh-linux-armd64 \
${cmd_openshift}
podman logs -f crc-e2e
- name: Test Report
id: test-report
uses: mikepenz/action-junit-report@v4
if: always()
with:
fail_on_failure: true
include_passed: true
detailed_summary: true
require_tests: true
report_paths: '**/*.xml'

- name: Upload e2e results
uses: actions/upload-artifact@v4
if: always()
with:
name: linux-e2e-test
path: |
**/*.xml
**/*.results
**/*.log
58 changes: 0 additions & 58 deletions .github/workflows/testing-farm.yml

This file was deleted.

0 comments on commit 16fb425

Please sign in to comment.