Skip to content

Commit 5ca7382

Browse files
addnabFuseteam
authored andcommitted
1 parent 5650ba6 commit 5ca7382

File tree

7 files changed

+157
-609
lines changed

7 files changed

+157
-609
lines changed

Diff for: .github/workflows/tests.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Docker Run Action Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
smoke-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Run docker action and set output for testing
15+
uses: ./
16+
id: run-docker
17+
with:
18+
image: docker:20.10.3
19+
run: |
20+
echo "::set-output name=docker-version::`echo $DOCKER_VERSION`"
21+
- name: Test the output
22+
uses: actions/github-script@v3
23+
with:
24+
script: |
25+
const dockerVersion = '${{ steps.run-docker.outputs.docker-version }}';
26+
if (dockerVersion !== '20.10.3') {
27+
core.setFailed(`Smoke Test Failed`);
28+
}
29+
volume-mount-test:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Create File to be mounted
34+
run: echo "some text" > someFile
35+
- name: Run docker action with mounted workspace
36+
uses: ./
37+
id: run-docker
38+
with:
39+
image: docker
40+
options: -v ${{ github.workspace }}:/work
41+
run: |
42+
echo "::set-output name=file-contents::`cat /work/someFile`"
43+
- name: Check if file contents match
44+
uses: actions/github-script@v3
45+
with:
46+
script: |
47+
const fileContents = '${{ steps.run-docker.outputs.file-contents }}';
48+
if (fileContents !== 'some text') {
49+
core.setFailed(`Unable to mount workspace volume`);
50+
}
51+
container-network-test:
52+
runs-on: ubuntu-latest
53+
services:
54+
postgres:
55+
image: postgres
56+
env:
57+
POSTGRES_PASSWORD: test
58+
POSTGRES_USER: test
59+
POSTGRES_DB: test
60+
ports:
61+
- 5432:5432
62+
options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10
63+
steps:
64+
- uses: actions/checkout@v2
65+
- name: Run docker action and test network connection
66+
uses: ./
67+
with:
68+
image: postgres
69+
run: >
70+
pg_isready -d test -U test -h postgres -p ${{ job.services.postgres.ports[5432] }}
71+
options: >
72+
-e PGPASSWORD=test

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

Diff for: Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM docker:20.10
2+
3+
RUN apk add bash
4+
5+
COPY entrypoint.sh /entrypoint.sh
6+
7+
ENTRYPOINT ["/entrypoint.sh"]

Diff for: LICENSE.md

+21-595
Large diffs are not rendered by default.

Diff for: README.md

+38-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,48 @@
11
# README
22

3-
A GitHub Action for building packages
3+
A GitHub Action for building packages for ubuntu touch
44

55
## Usage
66

7-
Customize following example workflow and save as `.github/workflows/wbuilder.yml` on your source repository.
7+
Customize following example workflow and save as `.github/workflows/clickable.yml` on your source repository.
88

9+
## Examples
910

1011
```yaml
11-
name: arm64
12-
13-
on: [push]
14-
15-
jobs:
16-
wbuilder:
17-
runs-on: ubuntu-22.04
12+
build-armhf:
13+
name: Build .click package for armhf
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2 # Required to mount the Github Workspace to a volume
18+
- name: build package
19+
uses: tuxecure/[email protected]
20+
with:
21+
image: clickable/ci-16.04-armhf
22+
run: |
23+
cd /tmp/clickable_base; \
24+
clickable build
25+
- name: Upload .click package for armhf
26+
uses: actions/[email protected]
27+
with:
28+
path: |
29+
build/*/app/*.click
30+
build-arm64:
31+
name: Build .click package for arm64
32+
runs-on: ubuntu-latest
1833
steps:
19-
- uses: actions/checkout@v3
20-
- uses: tuxecure/clickable
21-
- name: arm64
22-
run: clickable build
34+
- name: Checkout
35+
uses: actions/checkout@v2 # Required to mount the Github Workspace to a volume
36+
- name: build package
37+
uses: tuxecure/[email protected]
38+
with:
39+
image: clickable/ci-16.04-arm64
40+
run: |
41+
cd /tmp/clickable_base; \
42+
clickable build
43+
- name: Upload .click package for arm64
44+
uses: actions/[email protected]
45+
with:
46+
path: |
47+
build/*/app/*.click
2348
```

Diff for: action.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
name: "clickable"
22
description: "Build arm64 applications for Ubuntu Touch"
3+
inputs:
4+
image:
5+
description: 'Image'
6+
required: true
7+
workspace:
8+
description: 'workspace mount'
9+
default: ${{ github.workspace }}:/tmp/clickable_base
10+
required: false
11+
network:
12+
description: 'Docker Network ID'
13+
default: ${{ job.container.network }}
14+
required: false
15+
run:
16+
description: 'Run command in container'
17+
required: false
318
runs:
419
using: 'docker'
5-
image: 'clickable/ci-16.04-arm64'
20+
image: 'Dockerfile'

Diff for: entrypoint.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
exec docker run -v "/var/run/docker.sock":"/var/run/docker.sock" -v $INPUT_WORKSPACE --network $INPUT_NETWORK --entrypoint=sh $INPUT_IMAGE -c "${INPUT_RUN//$'\n'/;}"

0 commit comments

Comments
 (0)