First pass to cache the chroot #195
Workflow file for this run
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: 'Build GitLab CI container (PR)' | |
| on: | |
| push: | |
| paths: | |
| - docker-contributor/php-config | |
| - docker-gitlabci/** | |
| - .github/workflows/build-gitlab-container-PR.yml | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - docker-contributor/php-config | |
| - docker-gitlabci/** | |
| - .github/workflows/build-gitlab-container-PR.yml | |
| jobs: | |
| pr-gitlab: | |
| # Stop processing if this is a merge-queue | |
| # Stop processing if this is not against our repo | |
| # Always run if this PR is not from our organization | |
| # Or run if this PR is not `main` (So notQueue && ourRepo && (notPROurOrg || notMain)) | |
| if : ${{ !contains(github.ref, 'gh-readonly-queue') && | |
| github.repository == 'domjudge/domjudge-packaging' && | |
| !(github.event.pull_request.head.repo.full_name == 'domjudge/domjudge-packaging' && github.ref == 'main') }} | |
| name: PR GitLab image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Use the same PHP config as the contributor containers | |
| run: cp -r docker-{contributor,gitlabci}/php-config | |
| - name: Log in to GitHub Container registry (possibly at fork) | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| - name: Building an example chroot... | |
| run: | | |
| sudo apt install make pkg-config sudo debootstrap libcgroup-dev php-cli php-curl php-json php-xml php-zip lsof procps gcc g++ libcgroup-dev make acl zip unzip pv mariadb-server nginx php php-fpm php-gd php-cli php-intl php-mbstring php-mysql php-curl php-json php-xml php-zip composer ntp python3-yaml php-bcmath | |
| wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip | |
| unzip main.zip | |
| cd domjudge-main | |
| make configure | |
| ./configure --with-domjudge-user=domjudge --with-judgehost_chrootdir="$(pwd)/chroot" | |
| cd misc-tools | |
| make dj_make_chroot | |
| sudo ./dj_make_chroot | |
| - run: | | |
| find . --name chroot | |
| pwd | |
| - name: Build and push Docker images | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: "./docker-gitlabci" | |
| push: false | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |