-
Notifications
You must be signed in to change notification settings - Fork 12
149 lines (140 loc) · 4.64 KB
/
build.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
name: CRuby Dev Builds
on:
push:
tags:
- '*'
schedule:
- cron: '0 19 * * *'
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
if: github.event_name == 'schedule'
- name: Create tag
id: create_tag
run: |
if [[ "${{ github.event_name }}" == "schedule" ]]; then
tag=builds-$(date +%Y%m%d-%H%M%S)
else
tag=$(basename "${{ github.ref }}")
fi
echo "::set-output name=tag::$tag"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.create_tag.outputs.tag }}
release_name: ${{ steps.create_tag.outputs.tag }}
draft: true
prerelease: false
- name: Create artifact files
run: |
mkdir info
echo "${{ steps.create_release.outputs.id }}" > info/release_id
echo "${{ steps.create_release.outputs.upload_url }}" > info/upload_url
- uses: actions/upload-artifact@v1
with:
name: info
path: info
build:
needs: [release]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-16.04, ubuntu-18.04, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/download-artifact@v1
with:
name: info
- name: Set upload_url
id: upload_info
run: |
upload_url=$(cat info/upload_url)
echo "::set-output name=upload_url::$upload_url"
- name: apt-get update on Ubuntu
run: sudo apt-get update
if: startsWith(matrix.os, 'ubuntu')
- run: sudo apt-get install -y --no-install-recommends ruby bison libyaml-dev libgdbm-dev libreadline-dev libncurses5-dev
if: startsWith(matrix.os, 'ubuntu')
- run: brew install autoconf automake
if: matrix.os == 'macos-latest'
- name: Disable Firewall # Needed for TestSocket#test_udp_server in test-all
if: matrix.os == 'macos-latest'
run: |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
- name: Clone Ruby
uses: actions/checkout@v2
with:
repository: ruby/ruby
# Build
- run: chmod 755 $HOME # https://github.com/actions/virtual-environments/issues/267
- run: mkdir -p ~/.rubies
- run: autoconf
- run: ./configure --prefix=$HOME/.rubies/ruby-head --disable-install-doc
if: startsWith(matrix.os, 'ubuntu')
- run: ./configure --prefix=$HOME/.rubies/ruby-head --disable-install-doc --with-openssl-dir=$(brew --prefix [email protected]) --with-readline-dir=$(brew --prefix readline)
if: matrix.os == 'macos-latest'
- run: make -j4
- run: make update-gems
- run: make extract-gems
- run: make install
- name: Create archive
run: tar czf ruby-head-${{ matrix.os }}.tar.gz -C ~/.rubies ruby-head
# Test
- run: echo "::add-path::$HOME/.rubies/ruby-head/bin"
- uses: actions/checkout@v2
with:
path: test_files
- run: mv test_files/Gemfile .
- run: ruby --version
- run: gem --version
- run: rake --version
- run: ruby -ropen-uri -e 'puts open("https://rubygems.org/") { |f| f.read(1024) }'
- run: gem install json:2.2.0 --no-document
- run: bundle --version
- run: bundle install
- run: bundle exec rake --version
- name: Subprocess test
run: ruby -e 'p RbConfig::CONFIG["CPPFLAGS"]; def Warning.warn(s); raise s; end; system RbConfig.ruby, "-e", "p :OK"'
- run: make test-spec MSPECOPT=-j
- run: make test-all TESTS="-j8"
- name: Upload Built Ruby
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.upload_info.outputs.upload_url }}
asset_path: ruby-head-${{ matrix.os }}.tar.gz
asset_name: ruby-head-${{ matrix.os }}.tar.gz
asset_content_type: application/gzip
metadata:
name: Publish Release
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v1
with:
name: info
- name: Set publish_info
id: publish_info
run: |
release_id=$(cat info/release_id)
echo "::set-output name=release_id::$release_id"
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.publish_info.outputs.release_id }}
- uses: eregon/keep-last-n-releases@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
n: 3