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

QE-12061 add publish gh actions #520

Merged
merged 54 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
746fb9d
add lint gh action
ddl-cedricyoung Aug 14, 2024
2e3a0f9
add poetry
ddl-cedricyoung Aug 14, 2024
545dd4b
use pre-commit action
ddl-cedricyoung Aug 14, 2024
9c2e5f5
install poetry
ddl-cedricyoung Aug 14, 2024
3e2c543
install hooks
ddl-cedricyoung Aug 14, 2024
b93e865
install cucu
ddl-cedricyoung Aug 14, 2024
5c562a1
remove lint from circle
ddl-cedricyoung Aug 14, 2024
bae92b7
add unit test
ddl-cedricyoung Aug 14, 2024
243a944
combine workflows
ddl-cedricyoung Aug 14, 2024
84f8753
add filepath
ddl-cedricyoung Aug 15, 2024
0e67303
add ui tests
ddl-cedricyoung Aug 15, 2024
ea49af6
add option to selenium docker
ddl-cedricyoung Aug 15, 2024
ec0b507
better names
ddl-cedricyoung Aug 15, 2024
a32e7f4
fix checkout
ddl-cedricyoung Aug 15, 2024
30f84f7
bump versions
ddl-cedricyoung Aug 15, 2024
7617c05
fix permissions
ddl-cedricyoung Aug 15, 2024
1e7e935
comment and isolate
ddl-cedricyoung Aug 15, 2024
813209b
disable circle
ddl-cedricyoung Aug 15, 2024
a12f727
run selenium directly
ddl-cedricyoung Aug 15, 2024
1571fc9
disable chrome install
ddl-cedricyoung Aug 15, 2024
61d13eb
wait for selenium
ddl-cedricyoung Aug 15, 2024
f3bea5d
single worker
ddl-cedricyoung Aug 15, 2024
c550c56
disable service
ddl-cedricyoung Aug 15, 2024
3fbd170
use browser action
ddl-cedricyoung Aug 16, 2024
9ab61ae
install manually
ddl-cedricyoung Aug 16, 2024
e6478d4
disable UI tests
ddl-cedricyoung Aug 16, 2024
878dd38
re-enable circle tests
ddl-cedricyoung Aug 16, 2024
2fa779f
update package info
ddl-cedricyoung Aug 20, 2024
6b0e6d6
re-enable UI build
ddl-cedricyoung Aug 20, 2024
f76a325
update ports node
ddl-cedricyoung Aug 20, 2024
6d113c5
disable circleci
ddl-cedricyoung Aug 20, 2024
0cc4042
save output
ddl-cedricyoung Aug 20, 2024
e873efb
enable full run
ddl-cedricyoung Aug 20, 2024
0d35ee1
tweaks
ddl-cedricyoung Aug 20, 2024
d9b1c3d
limit scope
ddl-cedricyoung Aug 21, 2024
14bb127
add junit test publish and tar up
ddl-cedricyoung Aug 21, 2024
1836e43
enable full with single worker
ddl-cedricyoung Aug 21, 2024
21caecc
rename run
ddl-cedricyoung Aug 21, 2024
c3ba50d
always tar results
ddl-cedricyoung Aug 21, 2024
7b22151
enable unit tests
ddl-cedricyoung Aug 21, 2024
b186719
set python version
ddl-cedricyoung Aug 21, 2024
4ce3470
shorten names
ddl-cedricyoung Aug 21, 2024
c48212b
add matrix option
ddl-cedricyoung Aug 21, 2024
9946891
enable coverage
ddl-cedricyoung Aug 21, 2024
cb71a3f
enable firefox and edge
ddl-cedricyoung Aug 21, 2024
5651a9f
increase the shared memory size
ddl-cedricyoung Aug 21, 2024
f00ac24
re-enable CircleCI
ddl-cedricyoung Aug 21, 2024
f4d64c3
add auto publish to test.pypi.org
ddl-cedricyoung Aug 21, 2024
c9dd619
undo GH Actions badge
ddl-cedricyoung Aug 21, 2024
ba8ab35
add prod publish
ddl-cedricyoung Aug 21, 2024
8742ad8
update comment
ddl-cedricyoung Aug 21, 2024
ca3fbbf
undo test_core change
ddl-cedricyoung Aug 21, 2024
3c04785
Merge branch 'main' into QE-12061-migrate-to-GH-actions
ddl-cedricyoung Aug 21, 2024
bec712c
bump version
ddl-cedricyoung Aug 21, 2024
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
34 changes: 7 additions & 27 deletions .circleci/config.yml
ddl-cedricyoung marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,6 @@
---
version: 2.1

parameters:
python_version:
type: string
default: '3.11.7'
selenium_version:
type: string
default: '124.0'
se_node_max_sessions:
type: integer
default: 12
se_node_session_timeout:
type: integer
default: 300
screen_width:
type: integer
default: 1366
screen_height:
type: integer
default: 768

workflows:
build-test-publish:
jobs:
Expand All @@ -46,7 +26,7 @@ workflows:
jobs:
pre-commit:
docker:
- image: cimg/python:<<pipeline.parameters.python_version>>
- image: cimg/python:3.11.7
resource_class: medium
steps:
- checkout
Expand Down Expand Up @@ -79,13 +59,13 @@ jobs:
type: string
default: "chrome"
docker:
- image: cimg/python:<<pipeline.parameters.python_version>>
- image: selenium/standalone-<<parameters.browser>>:<<pipeline.parameters.selenium_version>>
- image: cimg/python:3.11.7
- image: selenium/standalone-<<parameters.browser>>:124.0
environment:
SE_NODE_MAX_SESSIONS: <<pipeline.parameters.se_node_max_sessions>>
SE_NODE_SESSION_TIMEOUT: <<pipeline.parameters.se_node_session_timeout>>
SCREEN_WIDTH: <<pipeline.parameters.screen_width>>
SCREEN_HEIGHT: <<pipeline.parameters.screen_height>>
SE_NODE_MAX_SESSIONS: 12
SE_NODE_SESSION_TIMEOUT: 300
SCREEN_WIDTH: 1366
SCREEN_HEIGHT: 768
resource_class: xlarge
steps:
- setup_remote_docker
Expand Down
123 changes: 123 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: build
# This is a beta version of migrating the CircleCI build to GH Actions
# TODO: Figure out and prevent firefox and edge tests getting auto-cancelled (out of memory?)
# TODO: Combine coverage reports in another job

on:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install depedencies
run: |
pip install poetry
poetry install --no-ansi
- uses: pre-commit/[email protected]

unit:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install depedencies
run: |
pip install poetry
poetry install --no-ansi
- name: unit tests
run: |
poetry run coverage run -m pytest --junit-xml=output/unit-tests.xml
- name: package results
if: always()
run: |
mkdir -p output
mv .coverage.* output/
tar cvfz output.tgz output
- name: save output
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-tests
path: output.tgz
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: "unit results"
files: |
output/unit-tests.xml

cucu:
needs: unit
runs-on: ubuntu-latest
strategy:
matrix:
browser: ["chrome", "firefox", "edge"]
permissions: # to publish junit results - see https://github.com/EnricoMi/publish-unit-test-result-action?tab=readme-ov-file#permissions
contents: read
issues: read
checks: write
pull-requests: write
services:
webserver:
image: selenium/standalone-${{ matrix.browser }}:124.0
ports:
- 4444:4444
options: --shm-size=4gb
env:
SE_NODE_MAX_SESSIONS: 12
SE_NODE_SESSION_TIMEOUT: 300
SCREEN_WIDTH: 1366
SCREEN_HEIGHT: 768

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install depedencies
run: |
pip install poetry
poetry install --no-ansi
- name: wait_for_selenium
# retry connection every 2s x 60 which is a total of 2 minutes
run: curl --retry 60 --retry-delay 2 --retry-connrefused http://localhost:4444
- name: UI tests
run: |
poetry run cucu run features --browser "${{ matrix.browser }}" --workers 1 --generate-report --report output/report --junit output/junit --selenium-remote-url http://localhost:4444
env:
COVERAGE_PROCESS_START: pyproject.toml
SE_NODE_MAX_SESSIONS: 12
SE_NODE_SESSION_TIMEOUT: 300
SCREEN_WIDTH: 1366
SCREEN_HEIGHT: 768
DISPLAY: :99 # Needed for headless mode
SELENIUM_HOST: localhost
SELENIUM_PORT: 4444
- name: package results
if: always()
run: |
mkdir -p output
mv .coverage.* output/
tar cvfz output.tgz output
- name: save output
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.browser }}-tests
path: output.tgz
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: "${{ matrix.browser }} results"
files: |
output/junit/**/*.xml
10 changes: 9 additions & 1 deletion .github/workflows/create_a_new_release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Create a New Release
# The following job is run when a commit changes pyproject.toml file:
# * Checks if the version of the project is the same of the latest release
# * If not, create a new release
# * If not, create a new release and then start the publishing
# * to test.pypi.org job

on:
push:
Expand Down Expand Up @@ -35,3 +36,10 @@ jobs:
-F prerelease=false \
-F generate_release_notes=true
fi
- name: trigger publish-test workflow
run: |
curl -X POST \
-H "Authorization: token ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/dispatches \
-d '{"event_type": "trigger_publish_test"}'
30 changes: 30 additions & 0 deletions .github/workflows/publish-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: publish-production
# publish to test.pypi.org on merge to default branch

on:
workflow_dispatch:

jobs:
publish-production-main:
environment: cucu-publish-production # match name in www.PyPI.org OIDC
runs-on: ubuntu-latest
permissions:
id-token: write # Required for connection to pypi OIDC
steps:
- name: checkout main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install depedencies
run: |
pip install poetry
poetry install --no-ansi
- name: build package
run: |
poetry build
- name: publish to test.pypi.org
uses: pypa/gh-action-pypi-publish@release/v1
34 changes: 34 additions & 0 deletions .github/workflows/publish-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: publish-test
# publish to test.pypi.org on merge to default branch

on:
workflow_dispatch:
repository_dispatch:
types: [trigger_publish_test]

jobs:
publish-test-main:
environment: cucu-publish-test # match name in test.PyPI.org OIDC
runs-on: ubuntu-latest
permissions:
id-token: write # Required for connection to pypi OIDC
steps:
- name: checkout main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install depedencies
run: |
pip install poetry
poetry install --no-ansi
- name: build package
run: |
poetry build
- name: publish to test.pypi.org
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project closely adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.204.0
- chore - add gh workflows for publishing
- chore - fix project metadata

## 0.203.0
- chore - move repo GH org locations
- chore - remove sonarqube
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[tool.poetry]
name = "cucu"
version = "0.203.0"
license = "MIT"
version = "0.204.0"
description = "Easy BDD web testing"
authors = ["Domino Data Lab <[email protected]>"]
readme = "README.md"
license = "The Clear BSD License"
keywords = ["cucumber", "selenium", "behave"]
homepage = "https://github.com/dominodatalab/cucu"
repository = "https://github.com/dominodatalab/cucu"
keywords = ["cucumber", "selenium"]
authors = ["Domino Data Lab <[email protected]>"]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
Expand All @@ -18,7 +18,6 @@ classifiers = [
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down