summaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: 60c50314d5e807bf063aaa7821eae564c1d294c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: CI

# Controls when the action will run.
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ github-actions ]
  pull_request:
    branches: [ github-actions ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

  build-sim:
    name: Build and test libffi in containers
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
       include:
         - HOST: "powerpc-eabisim"
           RUNTESTFLAGS: "--target_board powerpc-eabisim"
         - HOST: "or1k-elf"
           RUNTESTFLAGS: "--target_board or1k-sim"
         - MEVAL: "export PATH=/opt/moxielogic/bin:$PATH && CC=moxie-elf-gcc && CXX=moxie-elf-g++"
           HOST: "moxie-elf"
           LDFLAGS: "-Tsim.ld"
           RUNTESTFLAGS: "--target_board moxie-sim"

    steps:
      - uses: actions/checkout@v2

      - env:
          MEVAL: ${{ matrix.MEVAL }}
          HOST: ${{ matrix.HOST }}
          LDFLAGS: ${{ matrix.LDFLAGS }}
          RUNTESTFLAGS: ${{ matrix.RUNTESTFLAGS }}
        run: |
          set -x
          if test x"$MEVAL" != x; then eval ${MEVAL}; fi
          echo $HOST
          echo $MEVAL
          env
          pwd
          ./.ci/install.sh
          ./.ci/build.sh

  build:
    name: Build and test libffi on cygwin
    runs-on: windows-latest

    strategy:
      fail-fast: false
      matrix:
        platform: [windows-latest]

    steps:
      - uses: actions/checkout@v2

      - name: Set up Cygwin
        uses: egor-tensin/setup-cygwin@v3
        with:
          platform: x64
          packages: wget gcc-core make dejagnu automake autoconf libtool texinfo dos2unix unzip

      - run: |
          cd $(cygpath $RUNNER_WORKSPACE)/libffi
          wget https://rl.gl/cli/rlgl-windows-amd64.zip
          unzip rlgl-windows-amd64.zip
          find . -name \*.m4|xargs dos2unix
          find . -name \*.ac|xargs dos2unix
          find . -name \*.am|xargs dos2unix
          find . -name \*.host|xargs dos2unix
          autoreconf -f -v -i
          ./configure
          find . -name libtool\*|xargs dos2unix
          make -j 4
          TERM=none export DEJAGNU=$(pwd)/.ci/site.exp BOARDSDIR=$(pwd)/.ci make check || true
          ./rlgl/rlgl.exe l --key=0LIBFFI-0LIBFFI-0LIBFFI-0LIBFFI https://rl.gl
          ID=$(./rlgl/rlgl.exe start)
          ./rlgl/rlgl.exe e --id=$ID --policy=https://github.com/libffi/rlgl-policy.git $(find . -name libffi.log)
        shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'

  build-msvc:
    name: Build and test libffi with Visual C++
    runs-on: windows-latest

    strategy:
      fail-fast: false
      matrix:
        platform: [windows-latest]

    steps:
      - uses: actions/checkout@v2
      - uses: egor-tensin/setup-cygwin@v3
        with:
          platform: x64
          packages: wget make dejagnu automake autoconf libtool texinfo unzip dos2unix
      - uses: ilammy/msvc-dev-cmd@v1.8.1
      - uses: microsoft/setup-msbuild@v1.0.2

      - name: Build and test
        run: |
          set -x
          echo "===================================================="
          dos2unix $(cygpath $RUNNER_WORKSPACE)/libffi/.ci/msvs-detect
          $(cygpath $RUNNER_WORKSPACE)/libffi/.ci/msvs-detect --arch=x64 --with-assembler
          echo "===================================================="
          find "/cygdrive/c/Program Files (x86)/Microsoft Visual Studio" -name \*.exe
          export PATH=$PATH:"/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64"
          cd $(cygpath $RUNNER_WORKSPACE)/libffi
          wget https://rl.gl/cli/rlgl-windows-amd64.zip
          unzip rlgl-windows-amd64.zip
          find . -name \*.sh|xargs dos2unix
          find . -name \*.m4|xargs dos2unix
          find . -name \*.ac|xargs dos2unix
          find . -name \*.am|xargs dos2unix
          find . -name \*.host|xargs dos2unix
          dos2unix .ci/ar-lib
          autoreconf -f -v -i
          ./configure CC="$(pwd)/msvcc.sh -m64" CXX="$(pwd)/msvcc.sh -m64" LD='link' CPP='cl -nologo -EP' CXXCPP='cl -nologo -EP' CPPFLAGS='-DFFI_BUILDING_DLL' AR='$(pwd)/.ci/ar-lib lib' NM='dumpbin -symbols' STRIP=':' --build=$BUILD --host=$HOST $DEBUG_ARG $SHARED_ARG || cat */config.log
          find . -name libtool\*|xargs dos2unix
          env
          make
          cp $(find . -name 'libffi-?.dll') x86_64-pc-cygwin/testsuite/
          TERM=none DEJAGNU=$(pwd)/.ci/site.exp BOARDSDIR=$(pwd)/.ci make check || true
          ./rlgl/rlgl.exe l --key=0LIBFFI-0LIBFFI-0LIBFFI-0LIBFFI https://rl.gl
          ID=$(./rlgl/rlgl.exe start)
          ./rlgl/rlgl.exe e --id=$ID --policy=https://github.com/libffi/rlgl-policy.git $(find . -name libffi.log)
        shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'