WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 3dbf13c

Browse files
committed
ci: add workflows, add Rakefile
1 parent a172dc2 commit 3dbf13c

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

.github/workflows/main.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This CI job installs Crystal and shard dependencies, then executes `crystal spec` to run the test suite
2+
# More configuration options are available at https://crystal-lang.github.io/install-crystal/configurator.html
3+
4+
name: Matrix Build
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
push:
10+
branches:
11+
- master
12+
- dev
13+
14+
concurrency:
15+
group: ${{ github.sha }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
test:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- os: ubuntu-latest
25+
- os: macos-latest
26+
- os: windows-latest
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- name: Download source
30+
uses: actions/checkout@v4
31+
- name: Install Crystal
32+
uses: crystal-lang/install-crystal@v1
33+
- name: Install shards
34+
run: shards install
35+
- name: Build
36+
run: rake upload
37+
- name: Upload Artifact
38+
uses: actions/upload-artifact@v5
39+
with:
40+
name: choose-dev-${{ matrix.os }}.zip
41+
path: "upload/*"
42+
- name: Upload to Release
43+
if: startsWith(github.ref, 'refs/tags/v')
44+
uses: softprops/action-gh-release@v2
45+
with:
46+
files: "upload/*"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
/bin/
44
/.shards/
55
*.dwarf
6+
/upload/
7+
/target/

Rakefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
task default: []
2+
3+
task :dirs do
4+
sh "mkdir -p upload"
5+
end
6+
7+
task :debug do
8+
sh "shards build"
9+
end
10+
11+
task :release do
12+
sh "shards build --release"
13+
end
14+
15+
task :upload => [:dirs, :release] do
16+
file = "choose_v0.1.0_#{platform}"
17+
sum = file + ".sha256sum"
18+
sh "cp bin/choose upload/#{file}"
19+
sh "sha256sum #{file} > #{sum}"
20+
end
21+
22+
def platform
23+
if defined?(Gem::Platform)
24+
Gem::Platform.local.os
25+
else
26+
case RUBY_PLATFORM
27+
when /darwin/
28+
'macos'
29+
when /linux/
30+
'linux'
31+
when /mswin|mingw|cygwin/
32+
'windows'
33+
else
34+
'unknown'
35+
end
36+
end
37+
end

0 commit comments

Comments
 (0)