-
Notifications
You must be signed in to change notification settings - Fork 4
154 lines (137 loc) · 6.39 KB
/
upcoming.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
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
146
147
148
149
150
151
152
153
154
name: Upcoming
on:
push:
branches:
- upcoming/**
jobs:
upcoming:
runs-on: ubuntu-24.04
permissions:
contents: write
issues: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Env variables
id: env
run: |
sudo apt install yq -y
TAG_NAME=$(echo ${{ github.ref }} | sed 's/refs\/heads\///')
FOLDER=$(echo $TAG_NAME | sed 's/^[^\/]*\///')
if [ ! -d "$TAG_NAME" ]; then
# if the folder does not exist we switched to merge
echo "Switching to before merge"
TAG_NAME="releases/$FOLDER"
fi
if [ ! -d "$TAG_NAME" ]; then
echo "TAG_NAME folder does not exist. Neither with upcoming or releases"
exit 1
fi
# Extract the second and third directories from the tag name
CODENAME=$(echo $TAG_NAME | cut -d'/' -f2)
TARGET_ARCH=$(echo $TAG_NAME | cut -d'/' -f3)
PACKAGE_NAME=$(echo $TAG_NAME | cut -d'/' -f4)
BUILD_ARCH=$(tomlq '.build_env.arch' $TAG_NAME/pkg-builder.toml | sed 's/"//g')
VERSION_NUMBER=$(echo $TAG_NAME | cut -d'/' -f5)
VERSION_NUMBER_WITHOUT_REVISON=$(echo $VERSION_NUMBER | cut -d'-' -f1)
BUILD_DIR=$(echo "/home/runner/.pkg-builder/packages/$CODENAME/$PACKAGE_NAME-$VERSION_NUMBER")
# Write outputs to GITHUB_OUTPUT environment file
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
echo "codename=$CODENAME" >> $GITHUB_OUTPUT
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
echo "version_number=$VERSION_NUMBER" >> $GITHUB_OUTPUT
echo "version_number_without_revision=$VERSION_NUMBER_WITHOUT_REVISON" >> $GITHUB_OUTPUT
echo "build_dir=$BUILD_DIR" >> $GITHUB_OUTPUT
echo "build_arch=$BUILD_ARCH" >> $GITHUB_OUTPUT
echo "target_arch=$TARGET_ARCH" >> $GITHUB_OUTPUT
# values
echo "tag_name=$TAG_NAME"
echo "codename=$CODENAME"
echo "build_arch=$BUILD_ARCH"
echo "target_arch=$TARGET_ARCH"
echo "package_name=$PACKAGE_NAME"
echo "version_number=$VERSION_NUMBER"
echo "version_number_without_revision=$VERSION_NUMBER_WITHOUT_REVISON"
echo "build_dir=$BUILD_DIR"
- name: Sbuild setup
run: |
sudo apt update
# Note this is an older version of sbuild, no need to patch it, yet
sudo apt install -y debhelper schroot ubuntu-dev-tools autopkgtest vmdb2 qemu-system-x86
sudo apt install -y pkg-config libssl-dev uidmap
sudo apt install -y libfilesys-df-perl libmime-lite-perl
# change this into actually built version and cache it
wget https://github.com/eth-pkg/sbuild-ubuntu/releases/download/0.85-6-1/sbuild_0.85.6_all.deb
wget https://github.com/eth-pkg/sbuild-ubuntu/releases/download/0.85-6-1/libsbuild-perl_0.85.6_all.deb
sudo dpkg -i sbuild_0.85.6_all.deb libsbuild-perl_0.85.6_all.deb || true
- name: Checkout dependency repository
uses: actions/checkout@v4
with:
repository: eth-pkg/pkg-builder
ref: main
path: pkg-builder
- name: Install pkg-builder
run: |
cd pkg-builder
cargo build --release
mkdir -p ${HOME}/.local/bin
mv target/release/pkg-builder ${HOME}/.local/bin
# add to path the prebuilt debcrafter binaries as well
cp bin_dependencies/debcrafter_* ${HOME}/.local/bin
chmod +x ${HOME}/.local/bin/pkg-builder
chmod +x ${HOME}/.local/bin/debcrafter_*
echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Create chroot env
run: |
cd ${{ steps.env.outputs.tag_name }}
#sudo ln -s /usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/noble || true
pkg-builder env create
echo "${HOME}/.cache/sbuild/${{ steps.env.outputs.codename }}-amd64.tar.gz" >> $GITHUB_PATH
- name: package
run: |
cd ${{ steps.env.outputs.tag_name }}
pkg-builder package --run-piuparts false --run-autopkgtest false --run-lintian true
echo "${HOME}/.pkg-builder/packages/${{steps.env.outputs.codename}}/${{steps.env.outputs.package_name}}-${{steps.env.outputs.version_number}}" >> $GITHUB_PATH
- name: Save .deb
uses: actions/upload-artifact@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: ${{ steps.env.outputs.build_dir }}/${{steps.env.outputs.package_name}}_${{steps.env.outputs.version_number}}_${{steps.env.outputs.target_arch}}.deb
name: ${{steps.env.outputs.package_name}}_${{steps.env.outputs.version_number}}_${{steps.env.outputs.target_arch}}.deb
compression-level: 0
# - name: piuparts
# if: steps.env.outputs.codename != 'noble'
# run: |
# # installing debian-archive-keyring fails on ubuntu LTS, not sure why, but it says it is already installed
# # sudo apt install -y debian-archive-keyring
# sudo apt install piuparts
# cd ${{ steps.env.outputs.tag_name }}
# ${HOME}/.local/bin/pkg-builder piuparts
# - name: autopkgtest
# # also does not work, keeps failing on ubuntu noble
# # TODO will need to add package caching for autopkgtest, but this is a huge task, delaying, and releasing for now
# if: ${{ steps.env.outputs.codename != 'noble' && steps.env.outputs.package_name != 'ethereum-genesis-generator' }}
# run: |
# sudo cp -R ${HOME}/.pkg-builder /root
# apt list --installed autopkgtest
# cd ${{ steps.env.outputs.tag_name }}
# sudo ${HOME}/.local/bin/pkg-builder autopkgtest
- name: verify
run: |
cd ${{ steps.env.outputs.tag_name }}
${HOME}/.local/bin/pkg-builder verify --no-package true