Open p0nce opened 3 years ago
setup-dlang
is more or less doing what the official install script is doing (only using Typescript + GH Actions builtins, instead of bash).
The main blocker is having prebuilt GDC packages, like LDC and DMD provide. IMO this should be done upstream either by the @D-Programming-GDC or @dlang organizations.
That said, technically nothing prevents someone for setting up a GitHub Action pipeline here that would do the same. Here's a starting point for a CI pipeline: https://github.com/D-Programming-GDC/gcc/blob/5ff6ab4f88164b4c8939a8780da42dc39bd2a7ff/.semaphore/semaphore.yml#L1
Thanks. Maybe I'm being stupid: is there maybe a way to just invocate sudo apt install gdc
in the user Action? Any GDC version would do.
If you are fine with any version and only interested in Linux, literally running apt install gdc
in your action should do the trick - and take roughly same amount of yml config :)
For setup-dlang there both needs to be some way to switch between version and support for all of Win-Linux-MacOS triplet. It should be possible to do, probably with some enhancements to GDC own CI, but it is a fair bit of work, much more than was needed for dmd/ldc, so it was not originally implemented.
Fine! Thanks :)
I think it would be better to keep this ticket open - both because it is a necessary feature request and because the same question is likely to come up again. I can create a new one if you prefer of course.
We could just mention in the README how to use GDC.
Do you have any best practice suggestions? (other than apt install
when applicable)
apt install
doesn't actually work in Gitub Actions for GDC.
On Ubuntu 20.04, the linker output an error that is:
dub: symbol lookup error: dub: undefined symbol: _D3std3net4curl4HTTP9__mixin376onSendMFNdDFAvZmZv
Similar to that thread: https://forum.dlang.org/post/rrqff0$21cf$1@digitalmars.com
Downgrading to Ubuntu 18.04, installing GDC removes dub
and ldc
packages.
But installing dub or ldc removes GDC:
So I haven't found a way to support GDC properly... Any idea? Would need both DUB and GDC ideally.
It may be a time to ask @ibuclaw for suggestions :)
Mmmm, I follow the suggestions in the debian thread and install DUB from Github instead. This file allows to dub test
with GDC:
name: gdc
on: [push, pull_request]
jobs:
test:
name: Dub Tests
strategy:
matrix:
os: [ubuntu-20.04]
dc:
- ldc-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install D compiler
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}
- name: Install DUB
run: |
wget https://github.com/dlang/dub/releases/download/v1.23.0/dub-v1.23.0-linux-x86_64.tar.gz
tar xvf dub-v1.23.0-linux-x86_64.tar.gz
- name: Install libcurl
run: sudo apt install libcurl4-gnutls-dev
- name: Install GDC
run: sudo apt install gdc
- name: Vanilla unittest
run: ./dub test -a x86_64 --compiler gdc -v
Not optimal but works for this single purpose.
It may be a time to ask @ibuclaw for suggestions :)
I only see that the package maintainers have shot themselves in both feet.
/usr/include/d
on 18.04?)/buildd
path, so each minor version update probably requires all downstream packages to be rebuilt).I was able to use gdc on ubuntu-latest with this change: https://github.com/mbierlee/poodinis/pull/38/commits/6e25ca74fd7516efec48a6c3df92f99f5c296a42
essentially you need something like:
jobs:
# On Ubuntu we can use GDC (so keep working for D version 2.076)
gdc-latest:
name: GDC on Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install DMD (so dub is available)
uses: dlang-community/setup-dlang@v1
with:
compiler: dmd-latest
- name: Install GDC
run: |
sudo apt-get update
sudo apt-get install gdc -y
gdc --version
- name: Build library
env:
DC: gdc
run: dub build --compiler=gdc --build=release
FWIW I can test both GDC 10 and GDC 12 in GH actions: https://github.com/AuburnSounds/intel-intrinsics/tree/master/.github/workflows
Likewise: https://github.com/dlang/dub/pull/2324
Note that I added support for dub: version
in this action, so you can simplify your configuration.
Can it be as simple as this?
- name: Install D compiler
uses: dlang-community/setup-dlang@v1
with:
compiler: gdc-latest
This won't work currently. But yes, it would be good to make it work.
Unrelated? The godbolt DMD compiler are a bit old. I don't think you can test on the newest DMD.
This won't work currently. But yes, it would be good to make it work.
As I see in compiler.ts, it's a matter of figuring out the URL for a specific GDC version, isn't it?. Is there an issue with this?
updated example for multiple gdc versions:
## On Ubuntu we can use GDC. The compatibility of gdc is:
## gcc gdc-10 -> D 2.076 (the default on Ubuntu 20.04 (ubuntu-latest), also available on 22.04)
## gcc gdc-11 -> D 2.076 (requires Ubuntu 22.04)
## gcc gdc-12 -> D 2.100 (requires Ubuntu 22.04)
## Note that Github's ubuntu-latest isn't actually the latest release. It's currently set to "ubuntu-20.04" despite github having "ubuntu-22.04" runners (similar situation with macos-latest)
## For this reason it's best to use ubuntu-22.04
jobs:
test-gdc:
name: ${{ matrix.compiler }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04 ]
compiler: [ gdc-10, gdc-11, gdc-12 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install DMD (so dub is available)
uses: dlang-community/setup-dlang@v1
with:
compiler: dmd-latest
- name: Install dependencies on Ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get update && sudo apt-get install libev-dev libevent-dev libsqlite3-dev -y
- name: Install ${{ matrix.compiler }}
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.compiler }} -y
- name: Show version
run: |
${{ matrix.compiler }} --version
dub --version
- name: Build library
env:
DC: ${{ matrix.compiler }}
run: dub build --compiler=${{ matrix.compiler }} --build=release
Just ran into this... Any help would be appreciated: https://github.com/dlang/undeaD/pull/56
SingingBush's example is the current way how to do it. We don't have it in setup-dlang yet because it isn't supported on platforms other than ubuntu-2022.
What we could do is just running apt install
on ubuntu and only allow that as the only supported GDC OS on setup-dlang for now though.
OK, so given that I already have a matrix of oses and compilers, how do I skip the invalid combinations? Or do I just make a new yml file?
you can use exclude
to exclude all the things that match (entire combinations or also just partial matches iirc)
What's about adding configuration?
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
dc: [dmd-latest, ldc-latest]
include:
- os: ubuntu-latest
dc: gdc-latest
you need to separate the installation step like for example D-Scanner does it then: https://github.com/dlang-community/D-Scanner/blob/5a53c538d0aa832f03840840271b6631fbbfc53d/.github/workflows/default.yml#L78-L89
where does DC get defined? I got the workflow running, it installs gdc (and dub from dmd), and then runs dub with dmd, because apparently DC is set to dmd.
oh yeah setup-dlang sets DC - you can manually set it (it's just an environment variable) - or use it to only install dub.
will setup-dlang set DC if I set it first? (hoping it doesn't)
you need to separate the installation step like for example D-Scanner does it then: https://github.com/dlang-community/D-Scanner/blob/5a53c538d0aa832f03840840271b6631fbbfc53d/.github/workflows/default.yml#L78-L89
Can setup-dlang take care of this? Even if it's restricted to ubuntu only, this would be very helpful.
So the way I had to do this kinda sucks: https://github.com/dlang/undeaD/blob/d9a6eaad18e5c64bf36609158f1c257f1162c071/.github/workflows/main.yml
I'd like to do it better, or have some of this taken care of without so many manual if conditions. Almost think it would have been better to run a separate task.
But it did work!
Can setup-dlang take care of this?
I think this was the original reasoning: I wanted to be able to just specify platform/compiler/version matrix and have things "just work". As GDC was (and looks like still is) only available through a distro package install, it was not fitting that pattern. What if you want to test a different GDC version? apt install gdc
is great for development but as much for testing coverage, should I maintain a list of older packages to directly download? Have a separate CI to build all relevant GDC versions from source and provide binaries?
So I ended up embracing laziness as a virtue and just ignored the whole thing in a hope things will become more obvious to some point. Which clearly has not happened :) Saved me from a headache though.
tl; dr is "yes, setup-dlang absolutely can take care of this but maybe it can also do better and the right thing is not 100% obvious for GDC".
Yeah, we really should make this work seamlessly. Especially as gdc has now joined the other compilers into the post-2.076 front end realm. People will expect to be able to test against various gdc releases.
What pre-built artifacts are there for gdc? Is there a way we can host them? I know windows is a specific problem, as there is no pre-built binaries that people maintain. downloads.dlang.org should probably be doing it. @ibuclaw is there a way we can fit this into the release process for gdc/dmd?
https://gdcproject.org/downloads#binary-releases implies this was an intentional decision to stop providing binaries, although it is not clear if motivation was to reduce CI load or @ibuclaw simply wanted it to be this way.
let's just implement it internally by doing apt install
and only being supported on linux for now
Using a recent GDC would be a boon to our linux testing. Any idea how to do it?