CI by Jo5ta #37
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: CI Pipeline | |
| run-name: CI by ${{ github.actor }} | |
| on: | |
| push: | |
| branches: ['main'] | |
| pull_request: | |
| branches: ['main'] | |
| env: | |
| CI: true | |
| CONTAINER_TARGET: ci | |
| CONTAINER_CMD: docker | |
| CONTAINER_NON_INTERACTIVE: true | |
| # Required for pushing to ghcr.io | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| # ============================================ | |
| # Quick checks (format, version) - fail fast | |
| # ============================================ | |
| checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Load CI-Container | |
| uses: ./.github/actions/load-container | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Format Check | |
| run: ./scripts/container.sh ./scripts/ci-cd/step_format.sh | |
| - name: Fetch main branch for version check | |
| if: github.event_name == 'pull_request' | |
| run: git fetch origin main:main | |
| - name: Version Check | |
| if: github.event_name == 'pull_request' | |
| run: ./scripts/container.sh ./scripts/ci-cd/step_version.sh | |
| # ============================================ | |
| # Build and Test | |
| # ============================================ | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| needs: checks | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Load CI-Container | |
| uses: ./.github/actions/load-container | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build | |
| run: ./scripts/container.sh ./scripts/ci-cd/step_build.sh | |
| - name: Test | |
| run: ./scripts/container.sh ./scripts/ci-cd/step_test.sh | |
| - name: Memory Check | |
| run: ./scripts/container.sh ./scripts/ci-cd/step_memcheck.sh | |
| # ============================================ | |
| # Packaging | |
| # ============================================ | |
| package: | |
| runs-on: ubuntu-latest | |
| needs: build-and-test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Load CI-Container | |
| uses: ./.github/actions/load-container | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Package | |
| run: ./scripts/container.sh ./scripts/ci-cd/step_package.sh | |
| - name: Package Validate | |
| run: ./scripts/container.sh ./scripts/ci-cd/step_package_validate.sh --skip-srpm-rebuild |