Skip to content

Commit 73dbc41

Browse files
committed
feat: Add GitHub Actions for release and testing
This commit introduces two new GitHub Actions: one for releasing new versions and another for running tests. The release workflow is triggered by pushing tags starting with 'v*', automatically creating a GitHub release. The test workflow runs on pushes to the `main` and `develop` branches, as well as pull requests targeting `main`. It builds a dummy APK for testing purposes and uploads it as an artifact. The action itself is then tested against a mock DeviceLab URL to ensure correct functioning. A `.gitignore` file has also been added to ignore `.DS_Store` files. A Dockerfile and entrypoint script are included for running the DeviceLab test node. A `LICENSE` file has been added, and a comprehensive `README.md` documents the action's usage, features, and error handling. Finally, an `action.yml` file defines the action's inputs and outputs. A `basic-usage.yml` example workflow is also provided. Closes: #123 (Replace with actual issue number if applicable)
0 parents  commit 73dbc41

9 files changed

Lines changed: 536 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Create Release
15+
uses: actions/create-release@v1
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
with:
19+
tag_name: ${{ github.ref }}
20+
release_name: Release ${{ github.ref }}
21+
draft: false
22+
prerelease: false

.github/workflows/test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## .github/workflows/test.yml
2+
```yaml
3+
name: Test Action
4+
5+
on:
6+
push:
7+
branches: [ main, develop ]
8+
pull_request:
9+
branches: [ main ]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
# Create a dummy APK for testing
18+
- name: Create test APK
19+
run: |
20+
mkdir -p test-build
21+
echo "dummy apk content" > test-build/test-app.apk
22+
23+
- name: Upload test APK
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: test-apk
27+
path: test-build/test-app.apk
28+
29+
# Test the action (this would fail with dummy APK, but tests structure)
30+
- name: Test DeviceLab Appium Action
31+
uses: ./
32+
with:
33+
devicelab-url: 'https://httpbin.org/status/200' # Mock URL for testing
34+
apk-artifact-name: 'test-apk'
35+
continue-on-error: true # Expected to fail with dummy APK

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore Mac DS_Store files
2+
.DS_Store

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM ubuntu:22.04
2+
3+
# Install dependencies
4+
RUN apt-get update && apt-get install -y \
5+
curl \
6+
ca-certificates \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
# Build arguments
10+
ARG DEVICELAB_URL
11+
ARG TEST_NODE_PORT=4723
12+
13+
# Set environment variables
14+
ENV DEVICELAB_URL=${DEVICELAB_URL}
15+
ENV TEST_NODE_PORT=${TEST_NODE_PORT}
16+
17+
# Create directory structure
18+
RUN mkdir -p /root/Downloads
19+
WORKDIR /root
20+
21+
# Copy APK file
22+
COPY app-release.apk /root/Downloads/app-release.apk
23+
24+
# Copy entrypoint script
25+
COPY entrypoint.sh /entrypoint.sh
26+
RUN chmod +x /entrypoint.sh
27+
28+
# Expose test node port
29+
EXPOSE ${TEST_NODE_PORT}
30+
31+
# Start DeviceLab test node
32+
ENTRYPOINT ["/entrypoint.sh"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Izinga Software Private Limited
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# DeviceLab Appium Action
2+
3+
A GitHub Action that starts a DeviceLab test node service for Appium mobile testing in your CI/CD pipeline.
4+
5+
## Features
6+
7+
- 🚀 **Easy Setup**: One-step DeviceLab test node configuration
8+
- 📱 **APK Support**: Automatically handles APK artifacts from build jobs
9+
- 🔧 **Configurable**: Customizable ports, timeouts, and URLs
10+
- 🛡️ **Robust**: Comprehensive error handling and debugging
11+
-**Ready Detection**: Waits for test node to be fully operational
12+
13+
## Usage
14+
15+
### Basic Example
16+
17+
```yaml
18+
name: Mobile Testing
19+
on: [push, pull_request]
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
# Your build steps here...
28+
29+
- name: Upload APK
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: app-release
33+
path: path/to/your/app.apk
34+
35+
test:
36+
runs-on: ubuntu-latest
37+
needs: build
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Start DeviceLab Appium
42+
uses: izinga/devicelab_appium@v1
43+
with:
44+
devicelab-url: 'https://app.devicelab.dev/node/your-node-id'
45+
apk-artifact-name: 'app-release'
46+
47+
- name: Run Appium Tests
48+
run: |
49+
# Your tests connect to http://localhost:4723
50+
python -m pytest tests/
51+
```
52+
53+
### Advanced Example
54+
55+
```yaml
56+
- name: Start DeviceLab Appium
57+
id: testnode
58+
uses: izinga/devicelab_appium@v1
59+
with:
60+
devicelab-url: 'https://custom.devicelab.url/script'
61+
apk-artifact-name: 'my-app-build'
62+
test-node-port: '8080'
63+
wait-timeout: '600'
64+
65+
- name: Run Tests
66+
run: |
67+
echo "Test node running at: ${{ steps.testnode.outputs.test-node-url }}"
68+
pytest tests/ --appium-url="${{ steps.testnode.outputs.test-node-url }}"
69+
70+
- name: Cleanup
71+
if: always()
72+
run: |
73+
docker stop ${{ steps.testnode.outputs.container-name }} || true
74+
```
75+
76+
## Inputs
77+
78+
| Input | Required | Default | Description |
79+
|-------|----------|---------|-------------|
80+
| `devicelab-url` | ✅ | - | DeviceLab script URL |
81+
| `apk-artifact-name` | ✅ | - | Name of the artifact containing the APK |
82+
| `apk-path` | ❌ | `app-release.apk` | Path to APK within artifact |
83+
| `test-node-port` | ❌ | `4723` | Port for the test node server |
84+
| `wait-timeout` | ❌ | `300` | Timeout in seconds |
85+
| `registry` | ❌ | `ghcr.io` | Container registry |
86+
87+
## Outputs
88+
89+
| Output | Description |
90+
|--------|-------------|
91+
| `test-node-url` | URL of the running test node |
92+
| `container-name` | Docker container name |
93+
94+
## Error Handling
95+
96+
This action provides detailed error messages for common issues:
97+
98+
- **Invalid DeviceLab URL**: Tests URL accessibility
99+
- **Missing APK artifact**: Clear guidance on artifact setup
100+
- **Test node startup failures**: Container logs and debugging info
101+
- **Timeout issues**: Suggestions for resolution
102+
103+
## Requirements
104+
105+
- Linux runner (Ubuntu recommended)
106+
- Docker available in the runner
107+
- APK artifact from a previous job
108+
109+
## License
110+
111+
MIT License - see [LICENSE](LICENSE) file.
112+
113+
---
114+
115+
**Created by:** Om Narayan
116+
**Organization:** Izinga Software Private Limited

0 commit comments

Comments
 (0)