mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
201 lines
6.5 KiB
YAML
201 lines
6.5 KiB
YAML
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
|
|
|
|
name: Main
|
|
on:
|
|
- pull_request # without merge conflicts
|
|
- push # branch or tag
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
posix:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
# Linux
|
|
- job_name: Ubuntu 22.04 x64, DMD (latest)
|
|
os: ubuntu-22.04
|
|
host_dmd: dmd
|
|
# Enable this to replace coverage tests on CircleCI
|
|
# - job_name: Ubuntu 22.04 x64, DMD (coverage)
|
|
# os: ubuntu-22.04
|
|
# host_dmd: dmd
|
|
# coverage: true
|
|
- job_name: Ubuntu 22.04 x64, DMD (bootstrap)
|
|
os: ubuntu-22.04
|
|
host_dmd: dmd-2.079.0
|
|
- job_name: Ubuntu 22.04 x86, DMD (latest)
|
|
os: ubuntu-22.04
|
|
model: 32
|
|
host_dmd: dmd
|
|
- job_name: Ubuntu 22.04 x86, DMD (coverage)
|
|
os: ubuntu-22.04
|
|
model: 32
|
|
host_dmd: dmd
|
|
coverage: true
|
|
- job_name: Ubuntu 22.04 x86, DMD (bootstrap)
|
|
os: ubuntu-22.04
|
|
model: 32
|
|
host_dmd: dmd-2.097.1
|
|
- job_name: Ubuntu 22.04 x64, LDC
|
|
os: ubuntu-22.04
|
|
host_dmd: ldc
|
|
- job_name: Ubuntu 22.04 x64, GDC
|
|
os: ubuntu-22.04
|
|
host_dmd: gdmd-9
|
|
# macOS
|
|
- job_name: macOS 13 x64, DMD (latest)
|
|
os: macos-13
|
|
host_dmd: dmd
|
|
- job_name: macOS 13 x64, DMD (coverage)
|
|
os: macos-13
|
|
host_dmd: dmd
|
|
coverage: true
|
|
- job_name: macOS 12 x64, DMD (bootstrap)
|
|
os: macos-12
|
|
# de-facto bootstrap version on OSX
|
|
# See: https://github.com/dlang/dmd/pull/13890
|
|
host_dmd: dmd-2.099.1
|
|
name: ${{ matrix.job_name }}
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 40
|
|
env:
|
|
# for ci/run.sh:
|
|
OS_NAME: ${{ startsWith(matrix.os, 'ubuntu') && 'linux' || (startsWith(matrix.os, 'macos') && 'darwin' || '') }}
|
|
MODEL: ${{ matrix.model || '64' }}
|
|
HOST_DMD: ${{ matrix.host_dmd }}
|
|
N: ${{ startsWith(matrix.os, 'macos') && '3' || '2' }}
|
|
FULL_BUILD: true
|
|
# for coverage:
|
|
DMD_TEST_COVERAGE: ${{ matrix.coverage && '1' || '0' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 50
|
|
- name: Install prerequisites
|
|
run: ${{ runner.os == 'macOS' && 'ci/cirrusci.sh' || 'sudo -E ci/cirrusci.sh' }}
|
|
- name: Install host compiler
|
|
run: ci/run.sh install_host_compiler
|
|
- name: Set up repos
|
|
run: |
|
|
set -uexo pipefail
|
|
|
|
ref='${{ github.ref }}'
|
|
if [[ "$ref" =~ ^refs/pull/ ]]; then
|
|
# PR: clone the Phobos head with the same name as this DMD PR's target branch
|
|
# e.g., Phobos stable when targeting DMD stable
|
|
REPO_BRANCH="$GITHUB_BASE_REF"
|
|
elif [[ "$ref" =~ ^refs/(heads|tags)/(.*)$ ]]; then
|
|
# no PR: try to clone the Phobos head with the same name as this DMD head, falling back to master
|
|
# e.g., Phobos stable for a push to DMD stable, or Phobos v2.105.2 for DMD tag v2.105.2
|
|
REPO_BRANCH="${BASH_REMATCH[2]}"
|
|
else
|
|
echo "Error: unexpected GitHub ref '$ref'" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ci/run.sh setup_repos "$REPO_BRANCH"
|
|
- name: Build
|
|
run: ci/run.sh build
|
|
- name: Rebuild dmd (with enabled coverage)
|
|
if: matrix.coverage
|
|
run: ENABLE_RELEASE=0 ENABLE_DEBUG=1 ENABLE_COVERAGE=1 ${{ runner.os == 'macOS' && 'OS_NAME=osx' || '' }} ci/run.sh rebuild
|
|
- name: Test dmd
|
|
run: ci/run.sh test_dmd
|
|
- name: Test druntime
|
|
if: '!matrix.coverage'
|
|
run: ci/run.sh test_druntime
|
|
- name: Test phobos
|
|
if: '!matrix.coverage'
|
|
run: ci/run.sh test_phobos
|
|
- name: Upload coverage report
|
|
if: matrix.coverage
|
|
run: ci/run.sh codecov
|
|
|
|
freebsd-vm:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- job_name: FreeBSD 13.2 x64, DMD (latest)
|
|
freebsd_version: '13.2'
|
|
host_dmd: dmd
|
|
- job_name: FreeBSD 12.4 x64, DMD (bootstrap)
|
|
freebsd_version: '12.4'
|
|
host_dmd: dmd-2.095.0
|
|
name: ${{ matrix.job_name }}
|
|
runs-on: macos-latest
|
|
timeout-minutes: 60
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 50
|
|
- name: Run in VM
|
|
uses: cross-platform-actions/action@v0.21.1
|
|
with:
|
|
operating_system: freebsd
|
|
hypervisor: qemu
|
|
memory: 8G
|
|
sync_files: runner-to-vm
|
|
version: ${{ matrix.freebsd_version }}
|
|
shell: bash
|
|
run: |
|
|
set -uexo pipefail
|
|
|
|
freebsd_version='${{ matrix.freebsd_version }}'
|
|
freebsd_major="${freebsd_version:0:2}"
|
|
|
|
export OS_NAME=freebsd
|
|
export MODEL=64
|
|
export HOST_DMD='${{ matrix.host_dmd }}'
|
|
export N=3
|
|
export FULL_BUILD=true
|
|
export CI_DFLAGS="-version=TARGET_FREEBSD${freebsd_major}"
|
|
|
|
#if [[ "$freebsd_major" == 12 ]]; then
|
|
# sudo sed -i '' -e 's|pkg.FreeBSD.org|mirrors.xtom.com/freebsd-pkg|' /etc/pkg/FreeBSD.conf
|
|
#fi
|
|
|
|
bash --version
|
|
|
|
echo '::group::Install prerequisites'
|
|
sudo -E ci/cirrusci.sh
|
|
echo '::endgroup::'
|
|
|
|
echo '::group::Install host compiler'
|
|
ci/run.sh install_host_compiler
|
|
echo '::endgroup::'
|
|
|
|
echo '::group::Set up repos'
|
|
|
|
ref='${{ github.ref }}'
|
|
if [[ "$ref" =~ ^refs/pull/ ]]; then
|
|
REPO_BRANCH="$GITHUB_BASE_REF"
|
|
elif [[ "$ref" =~ ^refs/(heads|tags)/(.*)$ ]]; then
|
|
REPO_BRANCH="${BASH_REMATCH[2]}"
|
|
else
|
|
echo "Error: unexpected GitHub ref '$ref'" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ci/run.sh setup_repos "$REPO_BRANCH"
|
|
echo '::endgroup::'
|
|
|
|
echo '::group::Build'
|
|
ci/run.sh build
|
|
echo '::endgroup::'
|
|
|
|
echo '::group::Test dmd'
|
|
ci/run.sh test_dmd
|
|
echo '::endgroup::'
|
|
|
|
echo '::group::Test druntime'
|
|
ci/run.sh test_druntime
|
|
echo '::endgroup::'
|
|
|
|
echo '::group::Test phobos'
|
|
ci/run.sh test_phobos
|
|
echo '::endgroup::'
|