Skip to content

Commit b48490f

Browse files
authored
Update CI (#208)
* use zondax runners * add permissions
1 parent fa39dd8 commit b48490f

3 files changed

Lines changed: 83 additions & 7 deletions

File tree

.github/workflows/lint.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414

1515
jobs:
1616
lint:
17-
runs-on: ubuntu-latest
17+
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
1818
steps:
1919
- uses: actions/checkout@v4
2020
with:
@@ -27,7 +27,8 @@ jobs:
2727
build-essential \
2828
cmake \
2929
clang-format \
30-
clang-tidy
30+
clang-tidy \
31+
wget
3132
3233
- name: Lint and format 💅
3334
uses: cpp-linter/cpp-linter-action@v2

.github/workflows/main.yml

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,101 @@
11
name: "Main workflow"
22
on: push
3+
permissions:
4+
contents: read
35

46
jobs:
57
configure:
6-
runs-on: ubuntu-latest
8+
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
79
outputs:
810
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
911
steps:
1012
- id: get-user
1113
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT
1214

15+
setup:
16+
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
submodules: true
22+
- name: Cache APT packages
23+
uses: actions/cache@v4
24+
with:
25+
path: /var/cache/apt/archives
26+
key: ${{ runner.os }}-apt-${{ hashFiles('**/main.yml') }}
27+
restore-keys: |
28+
${{ runner.os }}-apt-
29+
- name: Install dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y curl protobuf-compiler build-essential git wget unzip python3 python3-pip \
33+
libssl-dev libffi-dev libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev libncurses5-dev \
34+
libgdbm-dev libnss3-dev liblzma-dev libxml2-dev libxmlsec1-dev libffi-dev libyaml-dev
35+
- name: Cache CMake installation
36+
uses: actions/cache@v4
37+
id: cmake-cache
38+
with:
39+
path: /opt/cmake
40+
key: cmake-3.28.0-${{ runner.os }}
41+
- name: Install CMake 3.28
42+
if: steps.cmake-cache.outputs.cache-hit != 'true'
43+
run: |
44+
wget https://github.com/Kitware/CMake/releases/download/v3.28.0/cmake-3.28.0-linux-x86_64.sh
45+
sudo mkdir -p /opt/cmake
46+
sudo sh cmake-3.28.0-linux-x86_64.sh --skip-license --prefix=/opt/cmake
47+
- name: Setup CMake symlinks
48+
run: |
49+
sudo ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake
50+
sudo ln -sf /opt/cmake/bin/ctest /usr/local/bin/ctest
51+
- name: Verify CMake version
52+
run: cmake --version
53+
1354
build:
14-
runs-on: ubuntu-latest
55+
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
56+
needs: setup
1557
steps:
1658
- name: Checkout
1759
uses: actions/checkout@v4
1860
with:
1961
submodules: true
62+
- name: Restore APT cache
63+
uses: actions/cache@v4
64+
with:
65+
path: /var/cache/apt/archives
66+
key: ${{ runner.os }}-apt-${{ hashFiles('**/main.yml') }}
67+
restore-keys: |
68+
${{ runner.os }}-apt-
69+
- name: Install dependencies
70+
run: |
71+
sudo apt-get update
72+
sudo apt-get install -y curl protobuf-compiler build-essential git wget unzip python3 python3-pip \
73+
libssl-dev libffi-dev libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev libncurses5-dev \
74+
libgdbm-dev libnss3-dev liblzma-dev libxml2-dev libxmlsec1-dev libffi-dev libyaml-dev
75+
- name: Restore CMake cache
76+
uses: actions/cache@v4
77+
id: cmake-cache-restore
78+
with:
79+
path: /opt/cmake
80+
key: cmake-3.28.0-${{ runner.os }}
81+
- name: Install CMake 3.28 (if cache miss)
82+
if: steps.cmake-cache-restore.outputs.cache-hit != 'true'
83+
run: |
84+
wget https://github.com/Kitware/CMake/releases/download/v3.28.0/cmake-3.28.0-linux-x86_64.sh
85+
sudo mkdir -p /opt/cmake
86+
sudo sh cmake-3.28.0-linux-x86_64.sh --skip-license --prefix=/opt/cmake
87+
- name: Setup CMake symlinks
88+
run: |
89+
sudo ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake
90+
sudo ln -sf /opt/cmake/bin/ctest /usr/local/bin/ctest
91+
- name: Verify CMake version
92+
run: cmake --version
2093
- run: make build
2194
- name: Run C++ tests
2295
run: make test
2396

2497
check_version:
25-
runs-on: ubuntu-latest
98+
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
2699
outputs:
27100
version: ${{ steps.get-version.outputs.version }}
28101
exists: ${{ steps.get-version.outputs.exists }}
@@ -48,7 +121,9 @@ jobs:
48121
run: exit 1
49122

50123
tag:
51-
runs-on: ubuntu-latest
124+
runs-on: ${{ github.repository_owner == 'zondax' && 'zondax-runners' || 'ubuntu-latest' }}
125+
permissions:
126+
contents: write
52127
needs:
53128
- build
54129
- check_version

include/zxversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
#define ZXLIB_MAJOR 36
1919
#define ZXLIB_MINOR 0
20-
#define ZXLIB_PATCH 5
20+
#define ZXLIB_PATCH 6

0 commit comments

Comments
 (0)