This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
103 lines (102 loc) · 3.31 KB
/
native-compile.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
name: Cross compile
on: [push]
jobs:
build:
name: Compile
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# https://help.github.com/ja/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
file-name: windows.exe
- os: ubuntu-latest
file-name: ubuntu
- os: macos-latest
file-name: macos
steps:
- name: Checkout
uses: actions/checkout@v1
# https://dart.dev/get-dart
- name: Install Dart(windows)
if: matrix.os == 'windows-latest'
run: |
choco install dart-sdk
- name: Install Dart(ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
sudo apt-get install dart
- name: Install Dart(macos)
if: matrix.os == 'macos-latest'
run: |
brew tap dart-lang/dart
brew install dart
- name: Build(windows)
if: matrix.os == 'windows-latest'
run: |
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.."
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
pub get
dart2native bin/main.dart -o bin/${{ matrix.file-name }}
- name: Build(ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.profile
source ~/.profile
pub get
dart2native bin/main.dart -o bin/${{ matrix.file-name }}
- name: Build(macos)
if: matrix.os == 'macos-latest'
run: |
pub get
dart2native bin/main.dart -o bin/${{ matrix.file-name }}
- name: Upload artifact
uses: actions/upload-artifact@v1
# with:
# name: bin
# path: bin
execute:
name: Run artifact
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
file-name: windows.exe
- os: ubuntu-latest
file-name: ubuntu
- os: macos-latest
file-name: macos
steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: bin
- name: Run(windows)
if: matrix.os == 'windows-latest'
run: |
cd bin
# .\${{ matrix.file-name }}
- name: Run(ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
cd bin
chmod 755 ${{ matrix.file-name }}
# ./${{ matrix.file-name }}
- name: Run(macos)
if: matrix.os == 'macos-latest'
run: |
cd bin
chmod 755 ${{ matrix.file-name }}
# ./${{ matrix.file-name }}