Skip to content

Commit 3ae9130

Browse files
committed
Add initial GitHub Actions workflows
1 parent ee4ec72 commit 3ae9130

4 files changed

Lines changed: 192 additions & 2 deletions

File tree

.github/workflows/image_build.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build and Push Image
2+
on:
3+
push:
4+
pull_request:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
branches: [ main ]
8+
9+
env:
10+
IMAGE_NAME: cli-proton-dotnet
11+
IMAGE_REGISTRY: quay.io
12+
IMAGE_NAMESPACE: rhmessagingqe
13+
14+
jobs:
15+
build:
16+
name: Build and push image
17+
runs-on: ubuntu-22.04
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
# https://www.integralist.co.uk/posts/github-actions/
23+
- name: Prepare ref name
24+
id: cleaned_ref_name
25+
run: |
26+
ref_name=$(echo ${{ github.ref_name }} | perl -pe 's/[^a-zA-Z0-9]+/-/g' | perl -pe 's/(\A-|-\Z)//g' | awk '{print tolower($0)}')
27+
echo "ref_name=${ref_name}" >> $GITHUB_OUTPUT
28+
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v2
31+
32+
- name: Build Image
33+
id: build-image
34+
uses: redhat-actions/buildah-build@v2
35+
with:
36+
image: ${{ env.IMAGE_NAME }}
37+
tags: latest ${{ github.sha }} ${{ steps.cleaned_ref_name.outputs.ref_name }}
38+
archs: amd64, arm64, ppc64le, s390x
39+
containerfiles: |
40+
./Dockerfile
41+
42+
- name: Push To quay.io
43+
if: github.ref == 'refs/heads/main'
44+
id: push-to-quay
45+
uses: redhat-actions/push-to-registry@v2
46+
with:
47+
image: ${{ steps.build-image.outputs.image }}
48+
tags: ${{ steps.build-image.outputs.tags }}
49+
registry: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}
50+
username: ${{ secrets.QUAY_USER }}
51+
password: ${{ secrets.QUAY_TOKEN }}
52+
53+
- name: Print image URL
54+
if: steps.push-to-quay.outcome == 'success'
55+
run: echo "Images pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
# https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml
21+
22+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
23+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
24+
25+
name: Python package
26+
27+
on:
28+
push:
29+
pull_request:
30+
workflow_dispatch:
31+
32+
jobs:
33+
34+
test:
35+
runs-on: ubuntu-latest
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
40+
python-version: ["3.8", "3.9", "3.10", "3.11"]
41+
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- name: Set up Python ${{ matrix.python-version }}
46+
uses: actions/setup-python@v4
47+
id: python
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
51+
- name: Install dependencies
52+
run: |
53+
${{ steps.python.outputs.python-path }} -m pip install --upgrade pip
54+
${{ steps.python.outputs.python-path }} -m pip install python-qpid-proton
55+
${{ steps.python.outputs.python-path }} -m pip install pytest pytest-timeout
56+
57+
- name: Prepare test environment
58+
run: |
59+
mkdir -p ${PWD}/artemis-data/override
60+
mkdir -p ${PWD}/qpid-dispatch
61+
cp ${PWD}/tests/.broker-00.xml ${PWD}/artemis-data/override/broker-00.xml
62+
cp ${PWD}/tests/.qdrouterd.conf ${PWD}/qpid-dispatch/qdrouterd.conf
63+
docker pull vromero/activemq-artemis
64+
docker pull rhmessagingqe/qpid-dispatch:ubuntu1804
65+
docker run -v ${PWD}/artemis-data/override:/var/lib/artemis/etc-override:Z -p 5672:5672 -d vromero/activemq-artemis:2-latest
66+
docker run -v ${PWD}/qpid-dispatch:/var/lib/qdrouterd:Z -p 5673:5673 -d rhmessagingqe/qpid-dispatch:ubuntu1804
67+
docker ps -a
68+
69+
- name: Install
70+
run: ${{ steps.python.outputs.python-path }} -m pip install .
71+
72+
- name: Test
73+
run: |
74+
cd tests
75+
${{ steps.python.outputs.python-path }} test_integration.py
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
# https://github.com/actions/starter-workflows/blob/main/ci/python-publish.yml
21+
22+
# This workflow will upload a Python Package using Twine when a release is created
23+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
24+
25+
# This workflow uses actions that are not certified by GitHub.
26+
# They are provided by a third-party and are governed by
27+
# separate terms of service, privacy policy, and support
28+
# documentation.
29+
30+
name: Upload Python Package
31+
32+
on:
33+
release:
34+
types: [published]
35+
workflow_dispatch:
36+
37+
permissions:
38+
contents: read
39+
40+
jobs:
41+
deploy:
42+
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- uses: actions/checkout@v3
47+
- name: Set up Python
48+
uses: actions/setup-python@v3
49+
with:
50+
python-version: '3.x'
51+
- name: Install dependencies
52+
run: |
53+
python -m pip install --upgrade pip
54+
pip install build
55+
- name: Build package
56+
run: python -m build
57+
- name: Publish package
58+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
59+
with:
60+
user: __token__
61+
password: ${{ secrets.PYPI_API_TOKEN }}

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ before_install:
2525
- docker ps -a
2626

2727
script:
28-
- python -m pip install pytest pytest-timeout
29-
- cd tests; python -m pytest --timeout=10 -v -s test_integration.py
28+
- cd tests; python test_integration.py

0 commit comments

Comments
 (0)