-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yaml
63 lines (58 loc) · 2.13 KB
/
action.yaml
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
name: Test aqua registry
description: Test aqua registry
inputs:
goos:
required: true
goarch:
required: true
go_version:
required: false
default: "1.23.3"
runs:
using: composite
steps:
- name: Remove aqua.yaml to avoid unneeded installation
shell: bash
run: "rm aqua.yaml || :"
- name: Run ci-info and update environment variables
shell: bash
# TODO Run the command without `aqua exec`.
# We don't know the cause, but `ci-info run | sed -E "s/^export //" >> "$GITHUB_ENV"` doesn't work on Windows.
# So we run ci-info via `aqua exec`.
run: aqua exec -- ci-info run | sed -E "s/^export //" >> "$GITHUB_ENV"
env:
AQUA_CONFIG: aqua/ci-info.yaml
- name: Update aqua/test.yaml
shell: bash
run: |
if grep -E "target:" "$CI_INFO_TEMP_DIR/labels.txt" > /dev/null 2>&1; then
grep -E "target:" "$CI_INFO_TEMP_DIR/labels.txt" | sed "s|^target:\(.*\)| - import: ../pkgs/\1/pkg.yaml|" >> aqua/test.yaml
fi
pkgs=$(mktemp)
grep -E "^pkgs/.*\.yaml" < "$CI_INFO_TEMP_DIR/pr_files.txt" | grep -v -E "^pkgs/crates\.io/" > "$pkgs" || :
if [ -s "$pkgs" ]; then
sed "s/registry\.yaml/pkg.yaml/" "$pkgs" | sort -u | sed "s|^| - import: ../|" >> aqua/test.yaml
fi
echo "[INFO] aqua/test.yaml" >&2
cat aqua/test.yaml >&2
- name: Check if go is required
shell: bash
id: go_required
run: |
if grep '\- import:' aqua/test.yaml | sed 's| - import: ../\(.*\)/pkg.yaml|\1/registry.yaml|' | xargs cat | grep "type: go" > /dev/null 2>&1; then
echo "value=true" >> "$GITHUB_OUTPUT"
else
echo "value=false" >> "$GITHUB_OUTPUT"
fi
- name: Install Go
if: steps.go_required.outputs.value == 'true'
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: ${{ inputs.go_version }}
- name: Install packages for testing
shell: bash
run: aqua i --test
env:
AQUA_GOOS: ${{ inputs.goos }}
AQUA_GOARCH: ${{ inputs.goarch }}
AQUA_CONFIG: aqua/test.yaml