Skip to content

Commit

Permalink
move ubuntu-builder to reusable workflow; use matrix action config to…
Browse files Browse the repository at this point in the history
… parallelize and simplify workflow
  • Loading branch information
James-Mart committed Aug 14, 2023
1 parent bfb8d53 commit 4d27105
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 109 deletions.
84 changes: 0 additions & 84 deletions .github/workflows/ubuntu-2004.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: Ubuntu 22.04
name: Ubuntu builds

on:
workflow_dispatch:
push:
branches:
- main
- "release/*"
pull_request:
types: [assigned, opened, synchronize, reopened, labeled]

env:
UBUNTU_2204_IMAGE: "ghcr.io/gofractally/psibase-builder-ubuntu-2204:7e3c6e5739df95ba33943789d2cdf5472f91111a"
workflow_call:

jobs:
ubuntu-2204-build:
name: Ubuntu 22.04 | Build
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- builder-image: "ghcr.io/${{ github.repository_owner }}/psibase-builder-ubuntu-2004:b70111acc20bdc6990e756a855fdbf428112c059"
ubuntu-version: "2004"
- builder-image: "ghcr.io/${{ github.repository_owner }}/psibase-builder-ubuntu-2204:7e3c6e5739df95ba33943789d2cdf5472f91111a"
ubuntu-version: "2204"
steps:
- name: Timestamp
id: ccache_cache_timestamp
Expand All @@ -28,9 +28,9 @@ jobs:
uses: actions/cache@v3
with:
path: .caches
key: $ubuntu-22.04-caches-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
key: $ubuntu-${{ matrix.ubuntu-version }}-caches-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
$ubuntu-22.04-caches-
$ubuntu-${{ matrix.ubuntu-version }}-caches-
- name: Build
run: |
set -e
Expand All @@ -46,9 +46,9 @@ jobs:
echo log_file = ${GITHUB_WORKSPACE}/ccache.log >>${GITHUB_WORKSPACE}/ccache.conf
export SCCACHE_CACHE_SIZE=200M
export RUSTC_WRAPPER=sccache
export DOCKER="docker run --rm -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} -w ${GITHUB_WORKSPACE} -e CCACHE_DIR -e CCACHE_CONFIGPATH -e SCCACHE_DIR -e SCCACHE_CACHE_SIZE -e RUSTC_WRAPPER --user $(id -u):$(id -g) ${UBUNTU_2204_IMAGE}"
export DOCKER_ROOT="docker run --rm -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} -w ${GITHUB_WORKSPACE} -e CCACHE_DIR -e CCACHE_CONFIGPATH -e SCCACHE_DIR -e SCCACHE_CACHE_SIZE -e RUSTC_WRAPPER ${UBUNTU_2204_IMAGE}"
docker pull ${UBUNTU_2204_IMAGE}
export DOCKER="docker run --rm -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} -w ${GITHUB_WORKSPACE} -e CCACHE_DIR -e CCACHE_CONFIGPATH -e SCCACHE_DIR -e SCCACHE_CACHE_SIZE -e RUSTC_WRAPPER --user $(id -u):$(id -g) ${{ matrix.builder-image }}"
export DOCKER_ROOT="docker run --rm -v ${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE} -w ${GITHUB_WORKSPACE} -e CCACHE_DIR -e CCACHE_CONFIGPATH -e SCCACHE_DIR -e SCCACHE_CACHE_SIZE -e RUSTC_WRAPPER ${{ matrix.builder-image }}"
docker pull ${{ matrix.builder-image }}
echo =====
${DOCKER} ccache -s
echo =====
Expand All @@ -68,16 +68,16 @@ jobs:
echo =====
${DOCKER} sccache -s
echo =====
${DOCKER} bash -c "cd build && cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=psidk-ubuntu-2204"
${DOCKER} bash -c "cd build && cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=psidk-ubuntu-${{ matrix.ubuntu-version }}"
echo =====
${DOCKER} bash -c "cd build && mv book psidk-book && tar czf ../psidk-book.tar.gz psidk-book"
- name: Upload psidk-ubuntu-2204
${DOCKER} bash -c "cd build && mv book psidk-book && tar czf ../psidk-book-${{ matrix.ubuntu-version }}.tar.gz psidk-book"
- name: Upload psidk-ubuntu-${{ matrix.ubuntu-version }}
uses: actions/upload-artifact@v1
with:
name: psidk-ubuntu-2204
path: build/psidk-ubuntu-2204.tar.gz
- name: Upload psidk-book
name: psidk-ubuntu-${{ matrix.ubuntu-version }}
path: build/psidk-ubuntu-${{ matrix.ubuntu-version }}.tar.gz
- name: Upload psidk-book-${{ matrix.ubuntu-version }}
uses: actions/upload-artifact@v1
with:
name: psidk-book
path: psidk-book.tar.gz
name: psidk-book-${{ matrix.ubuntu-version }}
path: psidk-book-${{ matrix.ubuntu-version }}.tar.gz

0 comments on commit 4d27105

Please sign in to comment.