WIP: Convert use of Vagrant to podman-compose for tests #2311
Workflow file for this run
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: Gating tests | |
on: | |
pull_request: | |
push: | |
branches: [main, devel] | |
env: | |
GITHUB_CI: true | |
jobs: | |
audit-and-build: | |
name: Audit and build | |
runs-on: ubuntu-latest | |
container: | |
image: fedora:latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Audit dependencies | |
run: npx audit-ci --config audit-ci.json --skip-dev | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
- name: Install project | |
run: npm install | |
- name: Prettier | |
run: npm run prettier | |
- name: Lint | |
run: npm run lint | |
- name: Build project | |
run: npm run build | |
- name: Upload dist folder | |
uses: actions/upload-artifact@v4 | |
with: | |
name: freeipa-webui-build | |
path: dist/ | |
unit-tests: | |
name: Unit tests | |
needs: audit-and-build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Install project | |
run: npm install | |
- name: Run jest | |
run: npm run test | |
integration-tests: | |
name: Integration tests | |
needs: audit-and-build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: freeipa-webui-build | |
path: dist | |
- name: Build test image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: containerfile-fedora | |
tags: latest | |
containerfiles: tests/ipalab/containerfile-fedora | |
- name: Install dependencies | |
shell: bash | |
run: | | |
sudo apt update -y | |
sudo apt install libkrb5-dev libvirt-dev | |
sudo apt install software-properties-common | |
sudo apt install ansible-core podman | |
- name: Generate ipalab configuration | |
shell: bash | |
run: | | |
sed -e "s@CONF_DIR@$(pwd)@g" tests/ipalab/ipa.yaml.in > tests/ipalab/ipa.yaml | |
- name: Add podman network for tests | |
shell: bash | |
run: | | |
subnet="$(grep subnet: tests/ipalab/ipa.yaml | cut -d: -f2-)" | |
network="$(grep network: tests/ipalab/ipa.yaml | cut -d: -f2-)" | |
podman network create --disable-dns --subnet $subnet $network | |
- name: Configure FreeIPA environment and set up Modern UI for it | |
uses: rjeffman/[email protected] | |
with: | |
cluster_configuration: tests/ipalab/ipa.yaml | |
test_playbooks: tests/ipalab/playbooks/webui.yaml | |
- name: Put IPA Server's IP to /etc/hosts | |
run: sudo echo "$(podman exec -ti server.ipa.demo hostname -I) server.ipa.demo" | sudo tee -a /etc/hosts | |
- name: Run Cypress tests | |
uses: cypress-io/github-action@v6 | |
with: | |
browser: electron | |
config-file: cypress/cypress.config.ts | |
command: | | |
podman unshare --rootless-netns \ | |
npx cypress run --config-file cypress/cypress.config.ts --browser electron ||: | |
- name: Shutdown the test machines and a network | |
uses: rjeffman/[email protected] | |
with: | |
cluster_configuration: tests/ipalab/ipa.yaml | |
shutdown: true | |
- name: Remove ipalab configuration | |
shell: bash | |
run: rm -f tests/ipalab/ipa.yaml | |
- name: Upload cypress screenshots | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
- name: Upload cypress videos | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: cypress-videos | |
path: cypress/videos |