diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index 8ed1c029d54..00000000000 --- a/.cirrus.yml +++ /dev/null @@ -1,81 +0,0 @@ -common_steps_template: &COMMON_STEPS_TEMPLATE - clone_dmd_script: | - set -uexo pipefail - git clone --branch "${CIRRUS_BASE_BRANCH:-$CIRRUS_BRANCH}" --depth 1 https://github.com/dlang/dmd.git ../dmd - install_prerequisites_script: cd ../dmd && ./ci/cirrusci.sh - install_host_compiler_script: cd ../dmd && ./ci/run.sh install_host_compiler - setup_repos_script: | - set -uexo pipefail - ln -s $CIRRUS_WORKING_DIR ../phobos - cd ../dmd && ./ci/run.sh setup_repos "${CIRRUS_BASE_BRANCH:-$CIRRUS_BRANCH}" - build_script: cd ../dmd && ./ci/run.sh build - test_dmd_script: cd ../dmd && ./ci/run.sh test_dmd - test_druntime_script: cd ../dmd && ./ci/run.sh test_druntime - test_phobos_script: cd ../dmd && ./ci/run.sh test_phobos - -environment: - CIRRUS_CLONE_DEPTH: 1 - # for ci/run.sh: - MODEL: 64 - HOST_DMD: dmd - N: 4 - OS_NAME: linux - FULL_BUILD: false - -# Linux -linux_task: - name: Ubuntu 18.04 $TASK_NAME_SUFFIX - container: - image: ubuntu:18.04 - cpu: 4 - memory: 8G - timeout_in: 60m - environment: - matrix: - - TASK_NAME_SUFFIX: x86 - MODEL: 32 - - TASK_NAME_SUFFIX: x64 - install_git_script: apt-get -q update && apt-get install -yq git-core - << : *COMMON_STEPS_TEMPLATE - -# Mac -macos_task: - name: macOS 12.x x64 (M1) - macos_instance: - image: ghcr.io/cirruslabs/macos-monterey-xcode:latest - timeout_in: 60m - environment: - OS_NAME: darwin - # override Cirrus default OS (`darwin`) - OS: osx - << : *COMMON_STEPS_TEMPLATE - -# FreeBSD -freebsd13_task: - name: FreeBSD 13.0 x64 - freebsd_instance: - image_family: freebsd-13-0 - cpu: 4 - memory: 8G - timeout_in: 60m - environment: - OS_NAME: freebsd - CI_DFLAGS: -version=TARGET_FREEBSD13 - install_bash_and_git_script: pkg install -y bash git - << : *COMMON_STEPS_TEMPLATE - -freebsd12_task: - name: FreeBSD 12.3 x64 - freebsd_instance: - image_family: freebsd-12-3 - cpu: 4 - memory: 8G - timeout_in: 60m - environment: - OS_NAME: freebsd - HOST_DMD: dmd-2.095.0 - CI_DFLAGS: -version=TARGET_FREEBSD12 - install_bash_and_git_script: | - sed -i '' -e 's|pkg.FreeBSD.org|mirrors.xtom.com/freebsd-pkg|' /etc/pkg/FreeBSD.conf - pkg install -y bash git - << : *COMMON_STEPS_TEMPLATE diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000000..94d0d0b9c3b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,170 @@ +# very similar to the DMD script: https://github.com/dlang/dmd/blob/master/.github/workflows/main.yml + +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 + os: ubuntu-22.04 + - job_name: Ubuntu 22.04 x86 + os: ubuntu-22.04 + model: 32 + # macOS + - job_name: macOS 13 x64 + os: macos-13 + - job_name: macOS 12 x64 + os: macos-12 + 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: dmd + N: ${{ startsWith(matrix.os, 'macos') && '3' || '2' }} + FULL_BUILD: false + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 50 + # d_do_test.d's `$p:` is buggy and chokes on the default `/Users/runner/work/phobos/phobos` path... + - name: Move repo to parent dir (a workaround) + run: mv -f * ../ + - name: Clone DMD + run: | + set -uexo pipefail + cd .. + + ref='${{ github.ref }}' + if [[ "$ref" =~ ^refs/pull/ ]]; then + # PR: clone the DMD head with the same name as this Phobos PR's target branch + # e.g., DMD stable when targeting Phobos stable + REPO_BRANCH="$GITHUB_BASE_REF" + elif [[ "$ref" =~ ^refs/(heads|tags)/(.*)$ ]]; then + # no PR: clone the DMD head with the same name as this Phobos head + # e.g., DMD stable for a push to Phobos stable, or DMD v2.105.2 for Phobos tag v2.105.2 + REPO_BRANCH="${BASH_REMATCH[2]}" + else + echo "Error: unexpected GitHub ref '$ref'" >&2 + exit 1 + fi + + git clone --branch "$REPO_BRANCH" --depth 1 https://github.com/dlang/dmd.git ../dmd + - name: Install prerequisites + run: cd ../../dmd && ${{ runner.os == 'macOS' && 'ci/cirrusci.sh' || 'sudo -E ci/cirrusci.sh' }} + - name: Install host compiler + run: cd ../../dmd && ci/run.sh install_host_compiler + - name: Build + run: cd ../../dmd && ci/run.sh build + - name: Test dmd + run: cd ../../dmd && ci/run.sh test_dmd + - name: Test druntime + run: cd ../../dmd && ci/run.sh test_druntime + - name: Test phobos + run: cd ../../dmd && ci/run.sh test_phobos + + freebsd-vm: + strategy: + fail-fast: false + matrix: + include: + - job_name: FreeBSD 13.2 x64 + freebsd_version: '13.2' + - job_name: FreeBSD 12.4 x64 + freebsd_version: '12.4' + 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.0 + 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=dmd + export N=3 + export FULL_BUILD=false + 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 git' + sudo pkg install -y git + echo '::endgroup::' + + echo '::group::Move repo to parent dir (a workaround)' + mv -f * ../ + cd .. + echo '::endgroup::' + + echo '::group::Clone DMD' + 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 + + git clone --branch "$REPO_BRANCH" --depth 1 https://github.com/dlang/dmd.git ../dmd + echo '::endgroup::' + + cd ../dmd + + 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::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::'