Draft: Added setup test #133
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 container | |
on: | |
push: | |
branches: | |
- master | |
- staging | |
- prod | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
docker: | |
runs-on: ubuntu-22.04 | |
name: Docker Build and Push | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Generate Auth Token | |
uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.APP_ID }} | |
private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Build test image | |
id: docker-build-test | |
uses: docker/build-push-action@v5 | |
with: | |
target: test | |
push: false | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Run Perl tests | |
run: docker build . -t metacpan/metacpan-ingest && docker compose run ingest env PLACK_ENV=dev prove -lv t | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ github.repository }} | |
flavor: | | |
latest=false | |
tags: | | |
type=sha,format=long,priority=1000 | |
type=ref,event=branch | |
type=ref,event=pr | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |