Skip to content

feat: Add unit tests #73

feat: Add unit tests

feat: Add unit tests #73

name: Docker
on:
push:
branches: ["main"]
tags: ["v*.*.*"]
pull_request:
branches: ["main"]
permissions:
contents: write
packages: write
id-token: write
jobs:
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.value }}
steps:
- name: Compute version
id: version
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "value=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
echo "value=sha-${SHORT_SHA}" >> $GITHUB_OUTPUT
fi
quality:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ui-next
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: ui-next/package-lock.json
- name: Install dependencies
run: npm install
- name: Lint
run: npm run lint
- name: Build check
run: npm run build
env:
AUTH_SECRET: ci-placeholder
DATABASE_URL: ":memory:"
ansible-quality:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ansible
env:
ANSIBLE_INVENTORY: localhost,
ANSIBLE_COLLECTIONS_PATH: ./collections
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: ansible/requirements.txt
- name: Install Ansible and lint tools
run: pip install -r requirements.txt
- name: Install Ansible collections
run: ansible-galaxy collection install -r requirements.yml -p ./collections --force
- name: Ansible lint – PaaS
run: ansible-lint --offline playbooks/paas/main.yml
- name: Ansible lint – SaaS deploy
run: ansible-lint --offline playbooks/saas/main.yml playbooks/saas/operate.yml
- name: Ansible lint – SaaS image build
run: ansible-lint --offline playbooks/saas/image-forkable.yml
build-ui:
needs: [setup, quality]
uses: ./.github/workflows/docker-build.yml
with:
image_name: ${{ github.repository }}-ui
context: ui/.
version: ${{ needs.setup.outputs.version }}
registry: ghcr.io
push: ${{ github.event_name != 'pull_request' }}
secrets:
registry_token: ${{ secrets.GITHUB_TOKEN }}
build-ui-next:
needs: [setup, quality]
uses: ./.github/workflows/docker-build.yml
with:
image_name: ${{ github.repository }}-ui-next
context: ui-next/.
version: ${{ needs.setup.outputs.version }}
registry: ghcr.io
push: ${{ github.event_name != 'pull_request' }}
secrets:
registry_token: ${{ secrets.GITHUB_TOKEN }}
build-ansible:
needs: [setup, quality, ansible-quality]
uses: ./.github/workflows/docker-build.yml
with:
image_name: ${{ github.repository }}-ansible
context: ansible/.
version: ${{ needs.setup.outputs.version }}
registry: ghcr.io
push: ${{ github.event_name != 'pull_request' }}
secrets:
registry_token: ${{ secrets.GITHUB_TOKEN }}
release:
needs: [build-ui, build-ui-next, build-ansible]
runs-on: ubuntu-latest
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true