Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 30 additions & 47 deletions .github/workflows/build_release_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,27 @@ jobs:
# FreeBSD is built on an additional VM
- os: ubuntu-latest
target: freebsd
vm_os: freebsd
vm_os_version: '14.4'

defaults:
run:
# cpa.sh comes with cross-platform-actions and delegates to the VM.
# Use it by default for all `run` steps below, i.e., run them in the VM (with a bash shell).
shell: ${{ matrix.vm_os && 'cpa.sh {0}' || 'bash' }}

steps:

- name: Start VM
if: matrix.vm_os
uses: cross-platform-actions/action@v1.5.0
with:
operating_system: ${{ matrix.vm_os }}
version: ${{ matrix.vm_os_version }}
shell: bash
memory: 12G
cpu_count: 4

#################################################################
# Install the system dependencies required to build and run
# the actual release scripts
Expand All @@ -148,7 +166,6 @@ jobs:
#
- name: Install dependencies for linux
if: matrix.target == 'linux'
shell: bash
run: |
set -euox pipefail

Expand Down Expand Up @@ -181,13 +198,17 @@ jobs:
# Save some space
sudo apt clean

- name: Install dependencies for FreeBSD
if: matrix.vm_os == 'freebsd'
run: sudo pkg install -y curl curlpp git gmake pkgconf gnupg rsync llvm19

#################################################################
# Install latest LDC used to compile the release scripts and to
# determine the currently available version number
#
- uses: dlang-community/setup-dlang@v1
name: Install latest LDC
if: matrix.target != 'freebsd'
name: 'Non-VM: Install latest LDC'
if: '!matrix.vm_os'
with:
compiler: ldc-latest

Expand All @@ -214,15 +235,19 @@ jobs:
#
- name: Fetch common resources and run build_all.d for ${{ matrix.target }}
id: build
if: matrix.target != 'freebsd'
shell: bash
run: |
set -euox pipefail

# Fetch GPG key used to sign the generated binaries
curl -fsS https://dlang.org/d-keyring.gpg -o d-keyring.gpg
gpg --import d-keyring.gpg

# VM: install and activate latest ldc
if ${{ matrix.vm_os && 'true' || 'false' }}; then
curl -fsS https://dlang.org/install.sh -o install.sh
source "$(bash install.sh ldc --activate)"
fi

# Compile release builder
cd create_dmd_release
ldmd2 -g -m64 --link-defaultlib-debug -version=NoVagrant -i build_all.d
Expand Down Expand Up @@ -261,48 +286,6 @@ jobs:
ren dmd-%ver%.exe dmd-%release%.exe || exit /b
copy dmd-*.exe ..\create_dmd_release\build || exit /b

#################################################################
# FREEBSD: Build for the current target using build_all.d from installer
#
- name: Setup FreeBSD VM
if: matrix.target == 'freebsd'
uses: cross-platform-actions/action@v1.3.0
with:
operating_system: freebsd
memory: 12G
cpu_count: 4
version: '14.4'

- name: Run build_all.d for FreeBSD in a dedicated VM
if: matrix.target == 'freebsd'
shell: cpa.sh {0}
run: |
set -eux

sudo pkg install -y curl curlpp git gmake pkgconf gnupg rsync llvm19

# Import key used to sign binaries
curl -fsS https://dlang.org/d-keyring.gpg -o d-keyring.gpg
gpg d-keyring.gpg

# Install ldc
curl -fsS https://dlang.org/install.sh -o install.sh
bash install.sh ldc -p .

# Use absolute paths because activate doesn't work correctly
LDC_BIN=$PWD/ldc-*/bin

# Determine installed LDC version
LDC=$($LDC_BIN/ldc2 --version | head -n 1 | cut -d'(' -f2 | cut -d')' -f1)

# Determine additional linker flags to make -lcurl work
EXTRA_FLAGS="-L$(pkg-config --libs-only-L libcurl)"

# Actually build the release
cd create_dmd_release
$LDC_BIN/ldmd2 -g -m64 --link-defaultlib-debug -version=NoVagrant -i build_all.d $EXTRA_FLAGS
./build_all --targets=${{ matrix.target }} "v$LDC" ${{ inputs.release_branch }}

#################################################################
# Save the target-specific release as a artifact s.t. the next
# job(s) have access to all generated releases
Expand Down
33 changes: 18 additions & 15 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
build: dmd.${{ github.base_ref || github.ref_name }}.linux.tar.xz
- host: ubuntu-latest
os: freebsd
vm_os: freebsd
vm_os_version: '14.4'
build: dmd.${{ github.base_ref || github.ref_name }}.freebsd-64.tar.xz

runs-on: ${{ matrix.host }}
Expand All @@ -48,6 +50,12 @@ jobs:
OS: ${{ matrix.os }}
BUILD: ${{ matrix.build }}

defaults:
run:
# cpa.sh comes with cross-platform-actions and delegates to the VM.
# Use it by default for all `run` steps below, i.e., run them in the VM (with a bash shell).
shell: ${{ matrix.vm_os && 'cpa.sh {0} --environment-variables OS BUILD' || 'bash' }}

steps:
- name: Download generated releases from the artifacts
id: download-release
Expand All @@ -60,24 +68,19 @@ jobs:
with:
path: installer

- name: Check ${{ matrix.os }} artifacts
id: check
if: ${{ matrix.os != 'freebsd' }}
shell: bash
run: source ./installer/test/release/validate_release.sh

- name: Check ${{ matrix.os }} artifacts in a VM
if: ${{ matrix.os == 'freebsd' }}
uses: cross-platform-actions/action@v1.3.0
- name: Start VM
if: matrix.vm_os
uses: cross-platform-actions/action@v1.5.0
with:
operating_system: freebsd
hypervisor: qemu
operating_system: ${{ matrix.vm_os }}
version: ${{ matrix.vm_os_version }}
shell: bash
memory: 12G
cpu_count: 4
version: '14.4'
environment_variables: OS BUILD
shell: bash
run: source ./installer/test/release/validate_release.sh

- name: Check ${{ matrix.os }} artifacts
id: check
run: source ./installer/test/release/validate_release.sh

validate_build_metadata:
name: Validate outputs of build_release_template.yml
Expand Down
Loading