Add Docker checks to GitHub Actions. #11
Workflow file for this run
This file contains 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: Branch Checks | |
on: | |
pull_request: | |
push: | |
branches-ignore: | |
- main | |
env: | |
REGISTRY: docker.io | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: git fetch origin main --depth=1 | |
- name: RuboCop Linter | |
uses: andrewmcodes/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
spec: | |
runs-on: ubuntu-latest | |
env: | |
COVERAGE: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
# runs 'bundle install' and caches installed gems automatically | |
bundler-cache: true | |
- name: Run tests | |
run: bundle exec rspec | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
- name: Build the image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Scan the image | |
uses: docker/scout-action@v1 | |
with: | |
command: cves | |
# only-fixed: true | |
only-severities: critical,high | |
write-comment: true |