-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (71 loc) · 2.24 KB
/
alpine_x86_64_release.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
on:
push:
tags:
- "v*.*.*"
# branches:
# - master
jobs:
build:
runs-on: ubuntu-latest
container:
image: crystallang/crystal:latest-alpine
steps:
- name: Cache shards
uses: actions/cache@v2
with:
path: ~/.cache/shards
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
restore-keys: ${{ runner.os }}-shards-
- name: install common dependencies
run: |
apk add \
curl \
gc-dev \
gcc \
git \
libevent-static \
musl-dev \
openssl-dev \
openssl-libs-static \
pcre-dev \
sqlite-static \
tzdata \
yaml-static \
zlib-dev \
zlib-static \
cmake \
g++ \
libffi-dev \
libxml2-dev \
llvm-dev \
llvm-static \
make
- name: Download source
uses: actions/checkout@v4
- name: Install shards
run: shards check || shards install --without-development
- name: Check formatting
run: crystal tool format --check
- name: Run tests
run: crystal spec --order=random
- name: package information
run: |
echo "BINARY_NAME=bin/$(cat shard.yml |grep targets -A1|tail -n1 |sed 's#[ :]##g')" >> $GITHUB_ENV
echo "PKG_ARCH=x86_64" >> $GITHUB_ENV
echo "PLATFORM=unknown-linux-musl.tar.gz" >> $GITHUB_ENV
echo "BUILD_ARGS=--static --link-flags=\"-s -Wl,-z,relro,-z,now\"" >> $GITHUB_ENV
- name: set asset name
run: |
echo "ASSERT_NAME=${{env.BINARY_NAME}}-${{github.ref_name}}-${{env.PKG_ARCH}}-${{env.PLATFORM}}" >> $GITHUB_ENV
- name: release binary
id: release
run: |
echo "ASSERT_NAME=${{env.ASSERT_NAME}}" >> $GITHUB_OUTPUT
shards build --production --release --progress --no-debug -Dstrict_multi_assign -Dno_number_autocast ${{env.BUILD_ARGS}}
tar zcvf ${{env.ASSERT_NAME}} ${{env.BINARY_NAME}} LICENSE
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{steps.release.outputs.ASSERT_NAME}}