-
Notifications
You must be signed in to change notification settings - Fork 5
/
action.yml
89 lines (82 loc) · 3.65 KB
/
action.yml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
name: "Test custom"
description: "Custom test step to run during a pull request"
# this inputs are always provided by flowzone, so they must always be defined on the composite action
inputs:
json:
description: "JSON stringified object containing all the inputs from the calling workflow"
required: true
secrets:
description: "JSON stringified object containing all the secrets from the calling workflow"
required: true
variables:
description: "JSON stringified object containing all the variables from the calling workflow"
required: true
runs:
using: "composite"
steps:
- name: Dump context
shell: bash
env:
GITHUB: ${{ toJSON(github) }}
INPUTS: ${{ inputs.json }}
SECRETS: ${{ inputs.secrets }}
VARIABLES: ${{ toJSON(inputs.variables) }}
run: |
echo "${GITHUB}"
echo "${INPUTS}"
echo "${SECRETS}"
echo "${VARIABLES}"
echo "matrix_value=${matrix_value}"
echo "os_value=${os_value}"
- name: Check vars from environment
shell: bash
run: |
echo "environment=${environment}"
echo "FLOWZONE_TEST_VAR=${{ fromJSON(inputs.variables).FLOWZONE_TEST_VAR }}"
echo "FLOWZONE_TEST_SECRET=${{ fromJSON(inputs.secrets).FLOWZONE_TEST_SECRET }}"
test "${{ fromJSON(inputs.variables).FLOWZONE_TEST_VAR }}" = "Flowzone says hi!"
# Resolve tag, semver, sha, and description of current git working copy.
- name: Describe git state
id: git_describe
shell: bash
run: |
set -x
tag="$(git tag --points-at HEAD | tail -n1)"
npx -q -y -- semver -c -l "${tag}"
git describe --tags --always --dirty | cat
git rev-parse HEAD
git submodule
git --no-pager tag --list --sort=-version:refname "v*.*.*" --merged
# https://github.com/marketplace/actions/github-app-token
- name: Generate GitHub App installation token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
if: ${{ fromJSON(inputs.json).app_id }}
id: gh_app_installation_token
with:
app_id: ${{ fromJSON(inputs.json).app_id }}
installation_retrieval_mode: organization
installation_retrieval_payload: ${{ github.repository_owner }}
private_key: ${{ fromJSON(inputs.secrets).GH_APP_PRIVATE_KEY }}
permissions: ${{ fromJSON(inputs.json).token_scope }}
# https://github.com/actions/runner-images/discussions/7191#discussioncomment-8351370
# https://github.com/reactivecircus/android-emulator-runner?tab=readme-ov-file#running-hardware-accelerated-emulators-on-linux-runners
# https://github.com/ankidroid/Anki-Android/commit/3a5ecaa9837691817022d11b0dbe383b8e82d9fe
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
- name: Enable KVM group perms
if: contains(fromJSON(env.os_value),'ubuntu-latest') || contains(fromJSON(env.os_value),'ubuntu-22.04')
shell: bash
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger -v --name-match=kvm
- name: Test KVM
if: contains(fromJSON(env.os_value),'ubuntu-latest') || contains(fromJSON(env.os_value),'ubuntu-22.04')
shell: bash
run: |
set -x
sudo apt-get update
sudo apt-get install -y --no-install-recommends cpu-checker
ls -al /dev/kvm
test -w /dev/kvm
kvm-ok