-
Notifications
You must be signed in to change notification settings - Fork 3
145 lines (136 loc) · 4.31 KB
/
Copy pathworkflow.yml
File metadata and controls
145 lines (136 loc) · 4.31 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: open-ACN sanity checks and tests
on:
push:
branches:
- develop
- main
pull_request:
jobs:
common_checks_1:
continue-on-error: False
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25.7"
- name: Install dependencies (ubuntu-latest)
run: |
sudo apt-get update --fix-missing
sudo apt-get autoremove
sudo apt-get autoclean
- name: Golang code style check (libp2p_node)
uses: golangci/golangci-lint-action@v9
with:
version: v2.12.2
args: --timeout=5m
working-directory: ./
golang_checks:
continue-on-error: True
needs:
- common_checks_1
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25.7"
- name: Golang unit tests (libp2p_node)
working-directory: ./
run: make test
libp2p_coverage:
name: libp2p_coverage
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.24.0
uses: actions/setup-go@v5
with:
go-version: "1.25.7"
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Install dependencies (ubuntu-latest)
run: |
sudo apt-get update --fix-missing
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install make -y
- name: Get dependencies
working-directory: ./
run: |
make install
- name: Generate coverage report
working-directory: ./
run: |
make test
- name: Print coverage report
working-directory: ./
run: |
go tool cover -func=coverage.txt
docker:
needs:
- libp2p_coverage
runs-on: ubuntu-latest
if:
contains('refs/heads/main', github.ref)
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# Disable the build summary emitted by docker/build-push-action@v6.
# The summary embeds commit metadata in a blob that the GHA runner
# rescans for legacy workflow commands; any commit message that
# happens to contain literal text like "::set-output" (e.g. when
# describing a migration away from that deprecated syntax) then
# triggers a spurious ##[error] and fails the step *after* the
# image has already been built and pushed.
DOCKER_BUILD_SUMMARY: "false"
DOCKER_BUILD_RECORD_UPLOAD: "false"
steps:
- name: Confirm Image
run: echo "Building image for ${{env.BRANCH_NAME}}"
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Declare Env Vars
id: vars
shell: bash
run: |
echo "branch=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT"
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
# Publish both the commit-pinned tag (for reproducible pins in
# downstream repos) and a ``:latest`` alias tracking main, so
# consumers that just want "the current image" don't have to
# bump a SHA on every ACN release.
tags: |
valory/${{ github.event.repository.name }}:${{ steps.vars.outputs.sha_short }}
valory/${{ github.event.repository.name }}:latest
all_checks_passed:
name: All checks passed
if: always()
needs:
- common_checks_1
- golang_checks
- libp2p_coverage
runs-on: ubuntu-latest
steps:
- name: Verify all dependencies succeeded
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
- run: echo "All required checks passed."