Skip to content

Commit

Permalink
test: check if running checkout inside custom container works
Browse files Browse the repository at this point in the history
  • Loading branch information
ahwayakchih authored Jan 16, 2025
1 parent fe2486d commit 0009b62
Showing 1 changed file with 36 additions and 33 deletions.
69 changes: 36 additions & 33 deletions .github/workflows/puppeteer-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,56 +28,59 @@ jobs:
echo "name=$IMAGE_ID" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
build:
runs-on: ubuntu-latest
needs: prepare
# build:
# runs-on: ubuntu-latest
# needs: prepare

permissions:
contents: read
packages: write
attestations: write
id-token: write
# permissions:
# contents: read
# packages: write
# attestations: write
# id-token: write

steps:
- name: Workaround Windows mess and set git to keep original line endings
run: git config --global core.autocrlf false
# steps:
# - name: Workaround Windows mess and set git to keep original line endings
# run: git config --global core.autocrlf false

- uses: actions/checkout@v4
# - uses: actions/checkout@v4

- run: podman --version
# - run: podman --version

- name: Build container image
run: |
podman build -t "$IMAGE_NAME" -f puppeteer.containerfile \
--label "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
--label "org.opencontainers.image.description=Puppeteer container" \
--label "org.opencontainers.image.licenses=MIT"
# - name: Build container image
# run: |
# podman build -t "$IMAGE_NAME" -f puppeteer.containerfile \
# --label "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
# --label "org.opencontainers.image.description=Puppeteer container" \
# --label "org.opencontainers.image.licenses=MIT"

- name: List images
run: podman images
# - name: List images
# run: podman images

- name: Test run
run: podman run --rm --init --userns=keep-id -v $(pwd):/app -w /app $IMAGE_NAME ls -la
# - name: Test run
# run: podman run --rm --init --userns=keep-id -v $(pwd):/app -w /app $IMAGE_NAME ls -la

- name: Login in to registry
if: success()
run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
# - name: Login in to registry
# if: success()
# run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin

- name: Push container image
if: success()
run: |
IMAGE=${{ needs.prepare.outputs.name }}:${{ needs.prepare.outputs.version }}
podman tag $IMAGE_NAME $IMAGE
podman push $IMAGE
# - name: Push container image
# if: success()
# run: |
# IMAGE=${{ needs.prepare.outputs.name }}:${{ needs.prepare.outputs.version }}
# podman tag $IMAGE_NAME $IMAGE
# podman push $IMAGE

test:
runs-on: ubuntu-latest
needs: prepare
needs: [ prepare ]
# env variables are not available at this level, only in steps:
# https://github.com/actions/runner/issues/2394
# so registry has to be hardcoded
container: ghcr.io/${{ needs.prepare.outputs.name }}:${{ needs.prepare.outputs.version }}

steps:
- uses: actions/checkout@v4

- name: Self test
run: |
echo "Chrome: " $CHROME_BIN
Expand Down

0 comments on commit 0009b62

Please sign in to comment.