forked from MLton/mlton
-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (139 loc) · 5.77 KB
/
ci.yml
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: CI
# Controls when the workflow will run
on:
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-test:
strategy:
fail-fast: false
matrix:
runner: [ubuntu-24.04, macos-13, macos-14, windows-2022]
cc: ["gcc", "clang"]
codegen: ["amd64", "c", "llvm"]
exclude:
- runner: macos-13
cc: "gcc"
- runner: macos-14
cc: "gcc"
- runner: macos-14
codegen: "amd64"
- runner: windows-2022
cc: "clang"
- runner: windows-2022
codegen: "llvm"
- cc: "gcc"
codegen: "llvm"
# The type of runner that the job will run on
runs-on: ${{ matrix.runner }}
defaults:
run:
shell: ${{ (startsWith(matrix.runner, 'windows') && 'msys2 {0}') || 'bash' }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Configure git (windows)
if: ${{ startsWith(matrix.runner, 'windows') }}
run: git config --global core.autocrlf false
shell: bash
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies (ubuntu)
if: ${{ startsWith(matrix.runner, 'ubuntu') }}
run: |
sudo apt-get update
sudo apt-get install libgmp-dev
if [[ "${{ matrix.codegen }}" == "llvm" ]]; then sudo apt-get install llvm; fi
mkdir boot && cd boot
curl -O -L https://github.com/MLton/mlton/releases/download/on-20210117-release/mlton-20210117-1.amd64-linux-glibc2.31.tgz
tar xzf mlton-20210117-1.amd64-linux-glibc2.31.tgz --exclude='*/share'
mv mlton-20210117-1.amd64-linux-glibc2.31/* .
rmdir mlton-20210117-1.amd64-linux-glibc2.31
- name: Install dependencies (macos (amd64))
if: ${{ matrix.runner == 'macos-13' }}
run: |
# brew update
brew install -q gmp
echo "WITH_GMP_DIR=/usr/local" >> $GITHUB_ENV
if [[ "${{ matrix.codegen }}" == "llvm" ]]; then brew install llvm; echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH; fi
mkdir boot && cd boot
curl -O -L https://github.com/MLton/mlton/releases/download/on-20210117-release/mlton-20210117-1.amd64-darwin-19.6.gmp-homebrew.tgz
tar xzf mlton-20210117-1.amd64-darwin-19.6.gmp-homebrew.tgz --exclude='*/share'
mv mlton-20210117-1.amd64-darwin-19.6.gmp-homebrew/* .
rmdir mlton-20210117-1.amd64-darwin-19.6.gmp-homebrew
- name: Install dependencies (macos (arm64))
if: ${{ matrix.runner == 'macos-14' }}
run: |
# brew update
brew install -q gmp
echo "WITH_GMP_DIR=/opt/homebrew" >> $GITHUB_ENV
if [[ "${{ matrix.codegen }}" == "llvm" ]]; then brew install llvm; echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH; fi
mkdir boot && cd boot
curl -O -L https://projects.laas.fr/tina/software/mlton-20210117-1.arm64-darwin-21.6-gmp-static.tgz
tar xzf mlton-20210117-1.arm64-darwin-21.6-gmp-static.tgz --exclude='*/share'
mv mlton-20210117-1.arm64-darwin-21.6-gmp-static/* .
rmdir mlton-20210117-1.arm64-darwin-21.6-gmp-static
- name: Install msys2 (windows)
if: ${{ startsWith(matrix.runner, 'windows') }}
uses: msys2/setup-msys2@v2
with:
update: false
install: >-
base-devel
git
pactoys
- name: Install dependencies (windows)
if: ${{ startsWith(matrix.runner, 'windows') }}
run: |
pacboy --noconfirm -S --needed gcc:p gmp-devel:
mkdir boot && cd boot
curl -O -L https://github.com/MLton/mlton/releases/download/on-20200817-release/mlton-20200817-amd64-mingw.tgz
tar xzf mlton-20200817-amd64-mingw.tgz --exclude='*/share'
mv mlton-20200817-amd64-mingw/* .
rmdir mlton-20200817-amd64-mingw
- name: Check versions
run: |
PATH=$(pwd)/boot/bin:$PATH mlton
echo
make -version
echo
${{ matrix.cc }} --version
echo
if [[ "${{ matrix.codegen }}" == "llvm" ]]; then llvm-as -version; opt -version; llc -version; fi
- name: Build
run: |
PATH=$(pwd)/boot/bin:$PATH \
make \
CC=${{ matrix.cc }} \
OLD_MLTON_RUNTIME_ARGS="ram-slop 0.90" \
MLTON_RUNTIME_ARGS="ram-slop 0.90" \
MLTON_COMPILE_ARGS="-codegen ${{ matrix.codegen }}" \
$( if [[ -n "$WITH_GMP_DIR" ]]; then echo "WITH_GMP_DIR=$WITH_GMP_DIR"; fi ) \
WITH_ALL_RUNTIME=true \
WITH_DBG_RUNTIME=false \
MLTON_BINARY_RELEASE_SUFFIX=".${{ matrix.runner }}_${{ matrix.cc }}_${{ matrix.codegen }}" \
all
- name: Test
run: ./bin/regression -codegen ${{ matrix.codegen }}
- name: Status
run: |
git status
- name: Package
run: |
make \
CC=${{ matrix.cc }} \
OLD_MLTON_RUNTIME_ARGS="ram-slop 0.90" \
MLTON_RUNTIME_ARGS="ram-slop 0.90" \
MLTON_COMPILE_ARGS="-codegen ${{ matrix.codegen }}" \
$( if [[ -n "$WITH_GMP_DIR" ]]; then echo "WITH_GMP_DIR=$WITH_GMP_DIR"; fi ) \
WITH_ALL_RUNTIME=true \
WITH_DBG_RUNTIME=false \
MLTON_BINARY_RELEASE_SUFFIX=".${{ matrix.runner }}_${{ matrix.cc }}_${{ matrix.codegen }}" \
binary-release
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: mlton.${{ matrix.runner }}_${{ matrix.cc }}_${{ matrix.codegen }}
path: ./*.tgz