Skip to content

Commit 665f6d5

Browse files
authored
ci: migrate to GitHub actions workflows (#134)
1 parent f385599 commit 665f6d5

7 files changed

Lines changed: 126 additions & 16 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Conventional Commit as PR title
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- reopened
9+
10+
jobs:
11+
lint-pr-title:
12+
# Prevent execution on forks
13+
if: github.repository_owner == 'iExecBlockchainComputing'
14+
permissions:
15+
pull-requests: read
16+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/conventional-commits.yml@conventional-commits-v1.1.0
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build and Push OCI Image
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
tags:
8+
- 'v*.*.*'
9+
# can only be executed by people with write access on repository
10+
workflow_dispatch:
11+
12+
jobs:
13+
prepare:
14+
name: Determine image tag
15+
runs-on: ubuntu-latest
16+
# Prevent execution on forks
17+
if: github.repository_owner == 'iExecBlockchainComputing'
18+
outputs:
19+
image_tag: ${{ steps.determine-tag.outputs.image_tag }}
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v6
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Determine Docker tag based on Git ref
27+
id: determine-tag
28+
run: |
29+
if [ "${{ github.ref_type }}" = "tag" ] ; then
30+
# Since this workflow only triggers on tags matching 'v*.*.*' we know we're always dealing with a version tag
31+
TAG_ON_MAIN=$(git branch -r --contains ${{ github.sha }} 'origin/main')
32+
33+
if [ -z "$TAG_ON_MAIN" ] ; then
34+
echo "Error: Tag ${{ github.ref_name }} is not on main branch"
35+
echo "Tags must be created on main branch to generate X.Y.Z image tags"
36+
exit 1
37+
fi
38+
39+
GITHUB_REF_NAME="${{ github.ref_name }}"
40+
echo "Processing tag on main branch: ${{ github.ref_name }}"
41+
echo "image_tag=${GITHUB_REF_NAME#v}" | tee -a $GITHUB_OUTPUT
42+
else
43+
if [ "${{ github.event_name }}" = "pull_request" ] ; then
44+
SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)
45+
else
46+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
47+
fi
48+
49+
if [ "${{ github.ref_name }}" = "main" ] ; then
50+
echo "Processing main branch"
51+
echo "image_tag=dev-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT
52+
else
53+
# This covers other branches
54+
echo "Processing feat/fix branch ${{ github.head_ref }}"
55+
echo "image_tag=feature-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT
56+
fi
57+
fi
58+
59+
build-oci-image:
60+
name: Build OCI image
61+
needs: prepare
62+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@docker-build-v3.3.0
63+
with:
64+
image-name: docker-regis.iex.ec/offchain-python-hello-world
65+
image-tag: ${{ needs.prepare.outputs.image_tag }}
66+
dockerfile: offchain-computing/Dockerfile
67+
context: offchain-computing
68+
registry: docker-regis.iex.ec
69+
push: true
70+
security-scan: true
71+
security-report: "comment"
72+
hadolint: true
73+
platform: linux/amd64
74+
secrets:
75+
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
76+
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN_PULL_ONLY }}
77+
username: ${{ secrets.NEXUS_USERNAME }}
78+
password: ${{ secrets.NEXUS_PASSWORD }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
issues: write
11+
pull-requests: write
12+
13+
jobs:
14+
release-please:
15+
# Prevent execution on forks
16+
if: github.repository_owner == 'iExecBlockchainComputing'
17+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/release-please.yml@release-please-v2.0.0
18+
secrets: inherit

.release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{".":"8.0.5"}

Jenkinsfile

Lines changed: 0 additions & 13 deletions
This file was deleted.

offchain-computing/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM python:3.7-alpine3.10
1+
FROM python:3.13-alpine3.23
2+
3+
RUN apk upgrade --no-cache
24

3-
### install needed python3 dependencies
4-
RUN apk add --no-cache gcc musl-dev
55
RUN pip3 install eth-abi==4.2.1
66

77
COPY ./src /app

release-please-config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"draft-pull-request": true,
4+
"include-component-in-tag": false,
5+
"include-v-in-tag": true,
6+
"release-type": "simple",
7+
"packages": {
8+
".": {}
9+
}
10+
}

0 commit comments

Comments
 (0)