]> git.lizzy.rs Git - rust.git/blob - .github/workflows/main.yml
Merge commit '05677b6bd6c938ed760835d9b1f6514992654ae3' into sync_cg_clif-2021-08-06
[rust.git] / .github / workflows / main.yml
1 name: CI
2
3 on:
4   - push
5   - pull_request
6
7 jobs:
8   build:
9     runs-on: ${{ matrix.os }}
10     timeout-minutes: 60
11
12     strategy:
13       fail-fast: false
14       matrix:
15         include:
16           - os: ubuntu-latest
17           - os: macos-latest
18           # cross-compile from Linux to Windows using mingw
19           - os: ubuntu-latest
20             env:
21               TARGET_TRIPLE: x86_64-pc-windows-gnu
22           - os: ubuntu-latest
23             env:
24               TARGET_TRIPLE: aarch64-unknown-linux-gnu
25
26     steps:
27     - uses: actions/checkout@v2
28
29     - name: Cache cargo installed crates
30       uses: actions/cache@v2
31       with:
32         path: ~/.cargo/bin
33         key: ${{ runner.os }}-cargo-installed-crates
34
35     - name: Cache cargo registry and index
36       uses: actions/cache@v2
37       with:
38         path: |
39             ~/.cargo/registry
40             ~/.cargo/git
41         key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
42
43     - name: Cache cargo target dir
44       uses: actions/cache@v2
45       with:
46         path: target
47         key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
48
49     - name: Install MinGW toolchain and wine
50       if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
51       run: |
52         sudo apt-get update
53         sudo apt-get install -y gcc-mingw-w64-x86-64 wine-stable
54         rustup target add x86_64-pc-windows-gnu
55
56     - name: Install AArch64 toolchain and qemu
57       if: matrix.os == 'ubuntu-latest' && matrix.env.TARGET_TRIPLE == 'aarch64-unknown-linux-gnu'
58       run: |
59         sudo apt-get update
60         sudo apt-get install -y gcc-aarch64-linux-gnu qemu-user
61
62     - name: Prepare dependencies
63       run: |
64         git config --global user.email "user@example.com"
65         git config --global user.name "User"
66         ./y.rs prepare
67
68     - name: Build
69       run: ./y.rs build --sysroot none
70
71     - name: Test
72       env:
73         TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
74       run: |
75         # Enable backtraces for easier debugging
76         export RUST_BACKTRACE=1
77
78         # Reduce amount of benchmark runs as they are slow
79         export COMPILE_RUNS=2
80         export RUN_RUNS=2
81
82         # Enable extra checks
83         export CG_CLIF_ENABLE_VERIFIER=1
84
85         ./test.sh
86
87     - name: Package prebuilt cg_clif
88       run: tar cvfJ cg_clif.tar.xz build
89
90     - name: Upload prebuilt cg_clif
91       if: matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
92       uses: actions/upload-artifact@v2
93       with:
94         name: cg_clif-${{ runner.os }}
95         path: cg_clif.tar.xz
96
97     - name: Upload prebuilt cg_clif (cross compile)
98       if: matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
99       uses: actions/upload-artifact@v2
100       with:
101         name: cg_clif-${{ runner.os }}-cross-x86_64-mingw
102         path: cg_clif.tar.xz
103
104   build_windows:
105     runs-on: windows-latest
106     timeout-minutes: 60
107
108     steps:
109     - uses: actions/checkout@v2
110
111     #- name: Cache cargo installed crates
112     #  uses: actions/cache@v2
113     #  with:
114     #    path: ~/.cargo/bin
115     #    key: ${{ runner.os }}-cargo-installed-crates
116
117     #- name: Cache cargo registry and index
118     #  uses: actions/cache@v2
119     #  with:
120     #    path: |
121     #        ~/.cargo/registry
122     #        ~/.cargo/git
123     #    key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
124
125     #- name: Cache cargo target dir
126     #  uses: actions/cache@v2
127     #  with:
128     #    path: target
129     #    key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
130
131     - name: Prepare dependencies
132       run: |
133         git config --global user.email "user@example.com"
134         git config --global user.name "User"
135         git config --global core.autocrlf false
136         rustup set default-host x86_64-pc-windows-gnu
137         rustc y.rs -o y.exe -g
138         ./y.exe prepare
139
140     - name: Build
141       #name: Test
142       run: |
143         # Enable backtraces for easier debugging
144         #export RUST_BACKTRACE=1
145
146         # Reduce amount of benchmark runs as they are slow
147         #export COMPILE_RUNS=2
148         #export RUN_RUNS=2
149
150         # Enable extra checks
151         #export CG_CLIF_ENABLE_VERIFIER=1
152
153         ./y.exe build
154
155     #- name: Package prebuilt cg_clif
156     #  run: tar cvfJ cg_clif.tar.xz build
157
158     #- name: Upload prebuilt cg_clif
159     #  uses: actions/upload-artifact@v2
160     #  with:
161     #    name: cg_clif-${{ runner.os }}
162     #    path: cg_clif.tar.xz