Skip to content

Commit

Permalink
ci: implement usage of stepped workflow (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
afonsojramos authored Nov 10, 2022
1 parent 28d7db3 commit fedc85c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Main Workflow

on: [push, pull_request]
on:
workflow_call:

jobs:
build:
name: Build
strategy:
matrix:
rust-version: ["1.65", "stable"]
rust-version: ['1.65', 'stable']
runs-on: ubuntu-latest
steps:
- name: Repository Checkout
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI Workflow

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
uses: ./.github/workflows/build.yml
secrets: inherit

lint:
name: Lint
uses: ./.github/workflows/lint.yml
secrets: inherit

docker:
name: Docker
needs: [build, lint]
uses: ./.github/workflows/docker.yml
secrets: inherit
12 changes: 7 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
name: Docker Workflow

on:
push:
branches: [main]
tags: ['v*.*.*']
pull_request:
branches: [main]

workflow_call:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
name: Build
name: Build & Push Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -36,6 +38,6 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name == 'push' }}
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 2 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Lint

on: [push, pull_request]
on:
workflow_call:

jobs:
clippy:
Expand Down

0 comments on commit fedc85c

Please sign in to comment.