Skip to content

Commit 320e5e4

Browse files
ci: Migrate CI from Drone to GHA (#32)
* ci: add Conventional Commit checks * ci: api pr check * ci: watcher pr check * ci: add release-please * ci: automate docker publication * ci: update node version in GHA
1 parent def0260 commit 320e5e4

25 files changed

+589
-326
lines changed

.drone-consider

Lines changed: 0 additions & 1 deletion
This file was deleted.

.drone.yml

Lines changed: 0 additions & 232 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: API docker release
2+
description: Publish the API when a release is published
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
get-version:
10+
# only run for releases with tag 'iexec-market-api-v*' as created by release-please for API
11+
if: startsWith(github.ref_name,'iexec-market-api-v')
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: "22"
20+
- name: Set publish version
21+
id: set-publish-version
22+
working-directory: api
23+
run: |
24+
VERSION=$(npm pkg get version | tr -d '"')
25+
echo "VERSION=${VERSION}" | tee -a $GITHUB_OUTPUT
26+
outputs:
27+
version: ${{ steps.set-publish-version.outputs.VERSION }}
28+
29+
docker-publish:
30+
if: startsWith(github.ref_name,'iexec-market-api-v')
31+
needs: get-version
32+
uses: ./.github/workflows/reusable-api-docker.yml
33+
with:
34+
tag: ${{ needs.get-version.outputs.version }}
35+
secrets:
36+
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
37+
docker-password: ${{ secrets.DOCKERHUB_PAT }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: API docker publish staging
2+
description: Publish a staging version of the API on Docker Hub
3+
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
compute-staging-version:
9+
uses: ./.github/workflows/reusable-compute-staging-version.yml
10+
with:
11+
working-directory: api
12+
13+
docker-publish:
14+
needs: compute-staging-version
15+
uses: ./.github/workflows/reusable-api-docker.yml
16+
with:
17+
tag: ${{ needs.compute-staging-version.outputs.version }}
18+
secrets:
19+
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
docker-password: ${{ secrets.DOCKERHUB_PAT }}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: API PR checks
2+
description: check the API PR
3+
4+
on:
5+
pull_request:
6+
paths: ["api/**"]
7+
8+
concurrency:
9+
group: ${{ github.ref }}-api-pr-checks
10+
cancel-in-progress: true
11+
12+
jobs:
13+
check-code:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "22"
23+
cache: "npm"
24+
cache-dependency-path: "api/package-lock.json"
25+
26+
- name: Install dependencies
27+
working-directory: api
28+
run: npm ci
29+
30+
- name: Check format
31+
working-directory: api
32+
run: npm run check-format
33+
34+
- name: Lint
35+
working-directory: api
36+
run: npm run lint
37+
38+
test:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: "22"
47+
cache: "npm"
48+
cache-dependency-path: "api/package-lock.json"
49+
50+
- name: Install dependencies
51+
working-directory: api
52+
run: npm ci
53+
54+
- name: Start e2e test stack
55+
working-directory: api
56+
run: npm run start-test-stack
57+
58+
- name: Run tests
59+
working-directory: api
60+
run: npm test
61+
62+
docker-dry-run:
63+
uses: ./.github/workflows/reusable-api-docker.yml
64+
with:
65+
dry-run: true
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Conventional Commit Check Commits
2+
description: checks every commit in the PR respects the conventional commit
3+
4+
on: [pull_request]
5+
6+
jobs:
7+
check-conventional-commits:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Check Commit Conventions
12+
uses: webiny/[email protected]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Conventional Commit Check PR Title
2+
description: checks the PR title respects the conventional commit
3+
4+
on:
5+
pull_request_target:
6+
types:
7+
- opened
8+
- edited
9+
- reopened
10+
11+
jobs:
12+
lint-pr-title:
13+
permissions:
14+
pull-requests: read
15+
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]

0 commit comments

Comments
 (0)