feat: Add unit tests #66
This file contains hidden or 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: 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 | |
| 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 ansible ansible-lint | |
| - name: Install Ansible collections | |
| run: ansible-galaxy collection install -r requirements.yml -p ./collections | |
| - name: Ansible lint – PaaS | |
| run: ansible-lint playbooks/paas/main.yml | |
| env: | |
| ANSIBLE_INVENTORY: localhost, | |
| - name: Ansible lint – SaaS deploy | |
| run: ansible-lint playbooks/saas/main.yml playbooks/saas/operate.yml | |
| env: | |
| ANSIBLE_INVENTORY: localhost, | |
| - name: Ansible lint – SaaS image build | |
| run: ansible-lint playbooks/saas/image-forkable.yml | |
| env: | |
| ANSIBLE_INVENTORY: localhost, | |
| 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 |