From 3014dd65ec5b10ec0736689fef1c089c4774717e Mon Sep 17 00:00:00 2001 From: Pierre Donat-Bouillud Date: Tue, 14 Jan 2025 12:57:37 -0500 Subject: [PATCH] Add independent dev container build job and new verify job --- .github/workflows/devcontainer.yml | 55 +++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 6ccca926..0b67483b 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -7,10 +7,11 @@ on: # rebuild any PRs and main branch changes - benchmarking jobs: - build: + build-devcontainer: runs-on: ubuntu-latest + outputs: + imageName: ${{ steps.imageName.outputs.imageName }} steps: - - name: Checkout (GitHub) uses: actions/checkout@v3 @@ -22,15 +23,61 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: set lower case owner name + id: imageName run: | echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + echo "imageName=ghcr.io/{OWNER,,}/r-compile-server" >>${GITHUB_OUTPUT} env: OWNER: '${{ github.repository_owner }}' + + - name: Pre-build dev container image + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/${{ env.OWNER_LC }}/r-compile-server + cacheFrom: ghcr.io/${{ env.OWNER_LC }}/r-compile-server + push: always + test: + runs-on: ubuntu-latest + needs: build-devcontainer + steps: + + - name: Checkout (GitHub) + uses: actions/checkout@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + # See https://github.com/devcontainers/ci/blob/main/docs/github-action.md - name: Build and run dev container task uses: devcontainers/ci@v0.3 with: - imageName: ghcr.io/${{ env.OWNER_LC }}/r-compile-server + cacheFrom: ${{ needs.build-devcontainer.outputs.imageName }} # Change this to be your CI task/script - runCmd: cd server; mvn --batch-mode --update-snapshots test \ No newline at end of file + runCmd: cd server; mvn --batch-mode --update-snapshots test + + verify: + runs-on: ubuntu-latest + needs: build-devcontainer + steps: + + - name: Checkout (GitHub) + uses: actions/checkout@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + + - name: Build and run dev container task + uses: devcontainers/ci@v0.3 + with: + cacheFrom: ${{ needs.build-devcontainer.outputs.imageName }} + runCmd: cd server; mvn --batch-mode --update-snapshots verify