Skip to content

Commit

Permalink
[actions] push-container and pre-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
stonier committed Feb 8, 2023
1 parent 5250426 commit 1987707
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/pre-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: pre-merge

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

on:
pull_request:
workflow_dispatch:

jobs:
pre-merge:
runs-on: ubuntu-22.04
container:
image: ghcr.io/${{ github.repository }}-ci:${ROS_DISTRO}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'

- name: Tox - Tests
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e ${{ matrix.python-py-version }}
- name: Tox - Formatters, Linters
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e check
- name: Tox - MyPy
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e my${{ matrix.python-py-version }}
52 changes: 52 additions & 0 deletions .github/workflows/push-ros2-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: push-ros2-image

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-ci
ROS_DISTRO: rolling

on:
push:
paths:
- .devcontainer/Dockerfile
branches:
- devel
workflow_dispatch:

jobs:
push-container:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to GCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Echo
run: |
echo "USER: ${{ github.actor }}"
echo "REPOSITORY: ${{ github.repository }}"
echo "ROS_DISTRO: ${{} env.ROS_DISTRO }}"
echo "TAGS: ${{ steps.meta.outputs.tags }}"
echo "LABELS: ${{ steps.meta.outputs.labels }}"
- name: Image - py_trees-${{ env.ROS_DISTRO }}
uses: docker/build-push-action@v3
with:
file: ./.devcontainer/Dockerfile
push: true
build-args: |
ROS_DISTRO=${{ env.ROS_DISTRO }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.ROS_DISTRO }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 1987707

Please sign in to comment.