Repository navigation
65 lines (63 loc) · 2.17 KB
/
Copy path_run-example.yml
File metadata and controls
65 lines (63 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Reusable workflow that runs an example's CI steps inside the ICP dev-env container.
#
# This is the single source of truth for the dev-env image version used in CI.
# It is kept in sync with .devcontainer/devcontainer.json by dev-env-version-check.yml.
#
# Callers provide the language (which selects the image variant), the working
# directory, and the commands to run. Example:
#
# jobs:
# motoko-hello_world:
# uses: ./.github/workflows/_run-example.yml
# with:
# language: motoko
# working-directory: motoko/hello_world
# run: |
# icp network start -d
# icp deploy
# bash test.sh
#
# Examples that need a PocketIC server for integration tests set
# install-pocketic: true (optionally overriding pocketic-version).
name: run-example
on:
workflow_call:
inputs:
language:
description: "Dev-env image variant to run in: motoko | rust | all"
type: string
required: true
working-directory:
description: "Path to the example directory to run the commands in"
type: string
required: true
run:
description: "Commands to execute inside the dev-env container"
type: string
default: |
icp network start -d
icp deploy
install-pocketic:
description: "Install the PocketIC server before running the commands"
type: boolean
default: false
pocketic-version:
description: "PocketIC server version to install when install-pocketic is true"
type: string
default: "15.0.0"
jobs:
run:
runs-on: ubuntu-24.04
container: ghcr.io/dfinity/icp-dev-env-${{ inputs.language }}:v2.2.1
env:
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Install PocketIC server
if: ${{ inputs.install-pocketic }}
uses: dfinity/pocketic@a980c334fab1b21b0b8a6bba38e1a10836e7258b # main
with:
pocket-ic-server-version: ${{ inputs.pocketic-version }}
- name: Run
working-directory: ${{ inputs.working-directory }}
run: ${{ inputs.run }}