diff --git a/.github/scripts/make_debian.sh b/.github/scripts/make_debian.sh index dd8bdf21a..53ba5c270 100644 --- a/.github/scripts/make_debian.sh +++ b/.github/scripts/make_debian.sh @@ -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() { @@ -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' ) @@ -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 \ No newline at end of file diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 988c6a22e..d777770f0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -88,7 +103,7 @@ jobs: tests-postgres: needs: build - runs-on: oracles-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -138,7 +153,7 @@ jobs: tests: needs: build - runs-on: oracles-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -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 @@ -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: @@ -198,7 +230,7 @@ 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 @@ -206,6 +238,7 @@ jobs: - 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 \ No newline at end of file