Skip to content

Docker Image CI

Docker Image CI #5

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
name: Docker Build
runs-on: ubuntu-latest
steps:
-
name: Checkout branch
uses: actions/checkout@v4
-
name: Docker Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
-
name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
-
name: Build and push Docker images
uses: docker/[email protected]
with:
push: false
load: true
tags: contrastsecuritydemo/netflicks:latest-agent
test:
name: Run Tests
runs-on: ubuntu-latest
needs:
- build
steps:
-
run: |
echo Testing now
-
name: Checkout branch
uses: actions/checkout@v4
-
name: Run docker-compose tests
run: |
docker-compose up -d
-
name: Setup Node
uses: actions/setup-node@v3
-
name: Install dependencies
run: |
cd e2e
npm install
npx playwright install
-
name: Install playwright browsers
run: |
cd e2e
npx playwright install-deps chromium
-
name: Run tests
run: |
cd e2e
npx playwright test
pre-merge:
name: Prepare to merge
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Docker Metadata action
id: metadata
uses: docker/metadata-action@v5
with:
images: contrastsecuritydemo/netflicks
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
- name: Version number
run: |
echo Getting the old build number
echo ::set-output name=build_number::$(echo ${{ steps.metadata.outputs.tags }} | cut -d'.' -f3)
merge:
name: Merge if PR is merged and tests pass
if: github.event.pull_request.merged
runs-on: ubuntu-latest
needs:
- build
- test
steps:
- run: |
echo The PR was merged