Skip to content

Commit

Permalink
Reuse setup python env action
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Apr 17, 2024
1 parent 4072d67 commit 260d261
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 41 deletions.
18 changes: 9 additions & 9 deletions .github/actions/create-dev-env/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Build environment
description: Create build environment
name: Python environment
description: Create Python environment and install dependencies for running tests

inputs:
architecture:
Expand All @@ -16,12 +16,12 @@ runs:
# python3 is manually preinstalled in the arm64 VM self-hosted runner
- name: Set Up Python 🐍
if: ${{ inputs.architecture == 'amd64' }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: '3.11'
cache: pip
cache-dependency-path: |
**/requirements*.txt
- name: Install Dev Dependencies 📦
run: |
pip install --upgrade pip
pip install --upgrade -r requirements-dev.txt
shell: bash
- name: Install dependencies 📦
run: pip install -r requirements-dev.txt
31 changes: 10 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
- name: Login to GitHub Container Registry 🔑
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
Expand Down Expand Up @@ -107,28 +107,23 @@ jobs:
- name: Checkout Repo ⚡️
uses: actions/checkout@v4

- uses: docker/login-action@v2
- uses: docker/login-action@v2 🔑
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
- name: Create Python dev environment 📦
uses: ./.github/actions/create-dev-env
with:
python-version: '3.11'
cache: pip
cache-dependency-path: |
**/requirements*.txt
- name: Install dependencies
run: pip install -r requirements-dev.txt
architecture: ${{ inputs.architecture }}

- name: Run tests
# TODO: Hack with REGISTRY
run: REGISTRY= pytest -m "not integration" --target ${{matrix.target}}
env: ${{ fromJSON(needs.build.outputs.images) }}


integration-test:
needs: build
runs-on: ${{ inputs.runsOn }}
Expand All @@ -139,22 +134,16 @@ jobs:
- name: Checkout Repo ⚡️
uses: actions/checkout@v4

- uses: docker/login-action@v2
- uses: docker/login-action@v2 🔑
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
- name: Create Python dev environment 📦
uses: ./.github/actions/create-dev-env
with:
python-version: '3.11'
cache: pip
cache-dependency-path: |
**/requirements*.txt
- name: Install dependencies
run: pip install -r requirements-dev.txt
architecture: ${{ inputs.architecture }}

- name: Run tests
# TODO: Hack with REGISTRY
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/docker-merge-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ jobs:
- name: Checkout Repo ⚡️
uses: actions/checkout@v4

- name: Create dev environment 📦
uses: ./.github/actions/create-dev-env
with:
architecture: amd64

- name: Download amd64 tags file 📥
uses: actions/download-artifact@v4
with:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ jobs:
- name: Checkout Repo ⚡️
uses: actions/checkout@v4

- name: Create dev environment 📦
uses: ./.github/actions/create-dev-env
with:
architecture: ${{ inputs.architecture }}

- name: Read build variables
id: build_vars
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Build, test and push Docker Images
name: Docker Images

on:
pull_request:
Expand Down

0 comments on commit 260d261

Please sign in to comment.