Skip to content

Bump docker/build-push-action from 5 to 6 (#30) #103

Bump docker/build-push-action from 5 to 6 (#30)

Bump docker/build-push-action from 5 to 6 (#30) #103

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ["3.4", "4.0"]
steps:
- uses: actions/checkout@v4
- name: Install Graphviz
run: sudo apt-get update && sudo apt-get install -y graphviz
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Run tests
run: bundle exec rake test
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ matrix.ruby-version }}
path: coverage/
retention-days: 30
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version-file: ".ruby-version"
bundler-cache: true
- name: Run RuboCop
run: bundle exec rake rubocop
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version-file: ".ruby-version"
bundler-cache: true
- name: Run Steep type checker
run: bundle exec rake steep:check
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version-file: ".ruby-version"
bundler-cache: true
- name: Run bundler-audit
run: bundle exec rake bundle:audit:check
build-container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: archsight:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test Docker image
run: |
docker run --rm archsight:latest version
docker run --rm -v "${{ github.workspace }}/examples:/resources" archsight:latest lint
release-gem:
needs: [test, lint, typecheck, security]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version-file: ".ruby-version"
- name: Install dependencies
run: bundle install
- name: Update version from git tag
run: bundle exec rake version
- name: Build and publish gem
uses: rubygems/release-gem@v1
release-container:
needs: [test, lint, typecheck, security, build-container]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version-file: ".ruby-version"
bundler-cache: true
- name: Update version from git tag
run: bundle exec rake version
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max