Integration tests #4692
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration tests | |
on: | |
workflow_run: | |
workflows: | |
- build-ci | |
types: | |
- completed | |
pull_request: | |
concurrency: | |
group: integration-tests-${{ github.head_ref || github.ref }}-${{ github.repository }} | |
cancel-in-progress: true | |
env: | |
REPO: ttl.sh/elemental-ci | |
jobs: | |
container-tests: | |
runs-on: macos-12 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: tests/go.mod | |
- name: Install dependencies | |
run: brew install cdrtools jq | |
- name: Wait for build | |
uses: fountainhead/[email protected] | |
id: wait-for-build | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
checkName: build-all-artifacts | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
timeoutSeconds: 1800 | |
- name: Stop the workflow if build has failed | |
if: steps.wait-for-build.outputs.conclusion == 'failure' | |
run: exit 1 | |
- name: Restore cache artifacts | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-artifacts | |
with: | |
path: build/* | |
key: build-ci-${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Run tests | |
run: | | |
GIT_TAG=$(git describe --abbrev=0 --tags 2>/dev/null || echo "v0.0.0") | |
GIT_COMMIT_SHORT=$(git rev-parse --short HEAD) | |
export CONTAINER_IMAGE=${REPO}:${GIT_TAG}-${GIT_COMMIT_SHORT} | |
export COS_HOST=127.0.0.1:2222 | |
export ISO=$PWD/$(ls build/elemental-*.iso 2>/dev/null) | |
cd tests && make container-tests | |
- name: Upload logs | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: vbox.logs.zip | |
path: tests/**/logs/* | |
if-no-files-found: warn | |
- name: Release space from worker ♻ | |
if: always() | |
run: | | |
cd tests && make clean || true | |
sudo rm -rf build bin dist || true | |
iso-tests: | |
runs-on: macos-12 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Export tag | |
id: export_tag | |
run: | | |
git describe --abbrev=0 --tags | |
TAG=`git describe --abbrev=0 --tags 2>/dev/null || echo "v0.0.0"` | |
echo "elemental_tag=$TAG" >> $GITHUB_OUTPUT | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: tests/go.mod | |
- name: Install dependencies | |
run: brew install cdrtools jq | |
- name: Wait for build | |
uses: fountainhead/[email protected] | |
id: wait-for-build | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
checkName: build-all-artifacts | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
timeoutSeconds: 1800 | |
- name: Stop the workflow if build has failed | |
if: steps.wait-for-build.outputs.conclusion == 'failure' | |
run: exit 1 | |
- name: Restore cache artifacts | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-artifacts | |
with: | |
path: build/* | |
key: build-ci-${{ github.event.pull_request.head.sha || github.sha }} | |
- name: Run tests | |
run: | | |
export COS_HOST=127.0.0.1:2222 | |
export ISO=$PWD/$(ls build/elemental-*.iso 2>/dev/null) | |
cd tests && make iso-tests | |
- name: Upload logs | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: vbox.logs.zip | |
path: tests/**/logs/* | |
if-no-files-found: warn | |
- name: Release space from worker ♻ | |
if: always() | |
run: | | |
cd tests && make clean || true | |
sudo rm -rf build bin dist || true |