Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduplicate GitHub Actions steps. #81

Merged
merged 1 commit into from
Jan 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/actions/init-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Initialize Dependencies
description: Install project dependencies

inputs:
python-version:
description: Python version to install
required: false
default: "3.10"

outputs:
python-version:
description: Same as input
value: ${{ inputs.python-version }}

runs:
using: composite
steps:
- {name: Install Python, uses: actions/setup-python@v2, with: {python-version: "${{ inputs.python-version }}"}}
- {name: Install Poetry, uses: abatilo/[email protected]}
- {name: Cache venv, uses: actions/cache@v2, with: {path: .venv, key: "${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}"}, id: cache}
- {name: Install dependencies, run: make deps, shell: bash, if: "steps.cache.outputs.cache-hit != 'true'"}
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- {name: Check out repository code, uses: actions/checkout@v2, with: {fetch-depth: 0}}
- {name: Install Python, uses: actions/setup-python@v2, with: {python-version: "3.10"}}
- {name: Install Poetry, uses: abatilo/[email protected]}
- {name: Cache venv, uses: actions/cache@v2, with: {path: .venv, key: "${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}"}, id: cache}
- {name: Install dependencies, run: make deps, if: "steps.cache.outputs.cache-hit != 'true'"}
- {name: Initialize dependencies, uses: ./.github/actions/init-deps}
- {name: Run lints, run: make lint}
- {name: Build docs, run: make docs}
5 changes: 1 addition & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ jobs:
SPHINX_HTML_BASEURL: "https://${{ github.event_name != 'release' && 'rob86stage.' || '' }}robpol86.com/"
steps:
- {name: Check out repository code, uses: actions/checkout@v2, with: {fetch-depth: 0}}
- {name: Install Python, uses: actions/setup-python@v2, with: {python-version: "3.10"}}
- {name: Install Poetry, uses: abatilo/[email protected]}
- {name: Cache venv, uses: actions/cache@v2, with: {path: .venv, key: "${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}"}, id: cache}
- {name: Install dependencies, run: make deps, if: "steps.cache.outputs.cache-hit != 'true'"}
- {name: Initialize dependencies, uses: ./.github/actions/init-deps}
- {name: Build docs, run: make docs}
- {name: Store HTML, uses: actions/upload-artifact@v2, with: {name: html, path: build/html/, if-no-files-found: error}}

Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ jobs:
SPHINX_HTML_BASEURL: "https://robpol86.com/"
steps:
- {name: Check out repository code, uses: actions/checkout@v2, with: {fetch-depth: 0}}
- {name: Install Python, uses: actions/setup-python@v2, with: {python-version: "3.10"}}
- {name: Install Poetry, uses: abatilo/[email protected]}
- {name: Cache venv, uses: actions/cache@v2, with: {path: .venv, key: "${{ runner.os }}-venv-${{ hashFiles('poetry.lock') }}"}, id: cache}
- {name: Install dependencies, run: make deps, if: "steps.cache.outputs.cache-hit != 'true'"}
- {name: Initialize dependencies, uses: ./.github/actions/init-deps}
- {name: Build docs, run: make docs}
- {name: Prettify, uses: creyD/[email protected], with: {prettier_options: "--write html/**/*.{js,css,html,xml}", prettier_plugins: "@prettier/plugin-xml"}}
- {name: Store HTML, uses: actions/upload-artifact@v2, with: {name: html_wf, path: build/html/, if-no-files-found: error}}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/
## [Unreleased]

- Added Auto Reboot section to Franklin T9 page.
- De-duplicating steps in multiple GitHub Actions workflows by defining my own composite action in this same repo.

## 2022-01-04

Expand Down