Skip to content

Commit

Permalink
Use a composite action for job setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cdubz committed Jun 3, 2022
1 parent 99dd61b commit 3c05768
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 46 deletions.
28 changes: 28 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Setup
description: Set up Baby Buddy environment and dependencies.
inputs:
python-version:
description: 'What Python version to use.'
required: false
default: '3.x'
runs:
using: 'composite'
steps:
- uses: actions/setup-python@v3
id: setup-python
with:
python-version: ${{ inputs.python-version }}
- uses: actions/cache@v3
with:
path: |
~/.local/share/virtualenvs
Pipfile.lock
key: ${{ runner.os }}-python-${{ inputs.python-version }}-pipenv-${{ hashFiles('**/requirements.txt') }}
- name: Install Python dependencies
shell: bash
run: |
python -m pip install --upgrade pipenv wheel
pipenv install --dev
- uses: actions/setup-node@v3
with:
node-version: 16
19 changes: 4 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,9 @@ jobs:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
id: setup-python
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
with:
path: |
~/.local/share/virtualenvs
Pipfile.lock
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('**/requirements.txt') }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pipenv wheel
pipenv install --dev
- uses: actions/setup-node@v3
with:
node-version: 16
- run: |
npm install -g gulp-cli
npm install
Expand Down Expand Up @@ -74,6 +60,9 @@ jobs:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: Install Railway CLI
run: npm i -g @railway/cli
- name: Deploy demo
run: npx railway up
env:
Expand Down
15 changes: 1 addition & 14 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,10 @@ jobs:
language: [ 'javascript', 'python' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
id: setup-python
with:
python-version: '3.x'
- uses: actions/cache@v3
with:
path: |
~/.local/share/virtualenvs
Pipfile.lock
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('**/requirements.txt') }}
- uses: github/codeql-action/init@v2
with:
config-file: ./.github/codeql/codeql-config.yml
languages: ${{ matrix.language }}
setup-python-dependencies: false
- name: Install dependencies
run: |
python -m pip install --upgrade pipenv wheel
pipenv install
- uses: ./.github/actions/setup
- uses: github/codeql-action/analyze@v2
18 changes: 1 addition & 17 deletions .github/workflows/demo-reset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,7 @@ jobs:
url: https://demo.baby-buddy.net
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
id: setup-python
with:
python-version: '3.x'
- uses: actions/cache@v3
with:
path: |
~/.local/share/virtualenvs
Pipfile.lock
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('**/requirements.txt') }}
- name: Install pipenv
run: python -m pip install --upgrade pipenv wheel
- name: Install dependencies
run: pipenv install
- uses: actions/setup-node@v3
with:
node-version: '16'
- uses: ./.github/actions/setup
- name: Install Railway CLI
run: npm i -g @railway/cli
- name: Reset demo database
Expand Down

0 comments on commit 3c05768

Please sign in to comment.