Skip to content

Commit

Permalink
Move away from Ubuntu 20.04 (#952)
Browse files Browse the repository at this point in the history
* Macpie/bye bye 20.04 (#1)

* Run on ubuntu latest and package in container on 20.04

* Do not use cache on build release

* Fix image name

* Make it so we can run release manually

* Add curl

* Add release for even faster

* Add build-essential

* Add build-essential pkg-config libssl-dev unzip

* Fix tz stuff

* Fix format

* Update to release in diff workflow

* Do not sudo anymore

* Do not use sudo in script

* Add public_suffix

* Add dotenv

* Rename RELEASE.yml to Release.yml

* Free some disk

* Move free disk

* Show before and after

* remore free disk in release

* Remove rustflag

* Collapse back to one workflow until we tested release
  • Loading branch information
macpie authored Feb 24, 2025
1 parent a276699 commit 7aeb5d1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 17 deletions.
18 changes: 12 additions & 6 deletions .github/scripts/make_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ set -euo pipefail

cd $GITHUB_WORKSPACE

if [ -z "$GITHUB_REF" ]; then
# If a release version is provided via workflow_dispatch, use it
if [ -n "$RELEASE_VERSION" ]; then
VERSION="$RELEASE_VERSION"
elif [ -z "$GITHUB_REF" ]; then
git config --global --add safe.directory "$GITHUB_WORKSPACE"
VERSION=$(git describe)
else
VERSION=$(echo "$GITHUB_REF" | sed 's|refs/tags/||')
fi

echo "Building Debian package with version: $VERSION"

write_unit_template()
{
Expand Down Expand Up @@ -96,10 +100,12 @@ run_fpm()
}

# install fpm
sudo apt update
sudo apt install --yes ruby
sudo gem install rchardet -v 1.8.0
sudo gem install fpm -v 1.14.2 # current as of 2022-11-08
apt update
apt install --yes ruby
gem install public_suffix -v 5.1.1
gem install rchardet -v 1.8.0
gem install dotenv -v 2.8.1
gem install fpm -v 1.14.2 # current as of 2022-11-08
echo "ruby deps installed"

for config_path in $( find . -name 'settings-template.toml' )
Expand All @@ -122,4 +128,4 @@ do
-F "package[distro_version_id]=210" \
-F "package[package_file]=@$deb" \
https://packagecloud.io/api/v1/repos/helium/oracles/packages.json
done
done
55 changes: 44 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ on:
push:
branches: ["main"]
tags: ["*"]

workflow_dispatch: # Allows manual triggering
inputs:
release_version:
description: "Release Version (e.g., 1.0.0)"
required: true
type: string
env:
CARGO_INCREMENTAL: 0 # this setting is automatically applied by rust-cache but documented here for explicitness
CARGO_NET_RETRY: 10
Expand All @@ -15,13 +20,23 @@ env:
RUSTUP_MAX_RETRIES: 10

jobs:

build:
runs-on: oracles-20.04
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build
cancel-in-progress: true
steps:
- name: Free Up Disk Space
run: |
echo "Freeing up disk space..."
echo "Disk space before cleanup:"
df -h
sudo apt-get clean
sudo rm -rf /usr/local/lib/android /usr/lib/jvm /usr/local/share/boost /opt/hostedtoolcache
docker system prune -a -f
echo "Disk space after cleanup:"
df -h
- name: Checkout
uses: actions/checkout@v4

Expand All @@ -48,7 +63,7 @@ jobs:
run: cargo build --all --tests

fmt:
runs-on: oracles-20.04
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-fmt
cancel-in-progress: true
Expand All @@ -65,7 +80,7 @@ jobs:
run: cargo fmt -- --check

clippy:
runs-on: oracles-20.04
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-clippy
cancel-in-progress: true
Expand All @@ -88,7 +103,7 @@ jobs:

tests-postgres:
needs: build
runs-on: oracles-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -138,7 +153,7 @@ jobs:

tests:
needs: build
runs-on: oracles-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -174,12 +189,28 @@ jobs:

build-release:
needs: [fmt, clippy, tests, tests-postgres]
runs-on: oracles-20.04
runs-on: ubuntu-latest
container:
image: ubuntu:20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-build-release
cancel-in-progress: true
if: contains(github.ref, 'refs/tags/')
if: >
(github.event_name == 'workflow_dispatch') || (contains(github.ref, 'refs/tags/'))
steps:
- name: Show Inputs
run: |
echo "Release Version: ${{ github.event.inputs.release_version }}"
- name: Install Dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y tzdata
ln -fs /usr/share/zoneinfo/UTC /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
apt-get install -y curl build-essential pkg-config libssl-dev unzip
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
Expand All @@ -189,6 +220,7 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

# TODO: update key when we retire 20.04
- name: Cache
uses: actions/cache@v4
with:
Expand All @@ -198,14 +230,15 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ubuntu-20.04-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build Release
run: cargo build --all --release

- name: Debian packaging
env:
PACKAGECLOUD_API_KEY: ${{ secrets.PACKAGECLOUD_API_KEY }}
RELEASE_VERSION: ${{ github.event.inputs.release_version }}
run: |
chmod +x ./.github/scripts/make_debian.sh
./.github/scripts/make_debian.sh
./.github/scripts/make_debian.sh

0 comments on commit 7aeb5d1

Please sign in to comment.