|
| 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