-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (90 loc) · 2.81 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
name: GNU GCC Build Matrix
on:
push:
pull_request:
release:
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows Latest MinGW",
os: windows-latest,
artifact: "windows_mingw.7z",
archiver: "7z a",
}
- {
name: "Ubuntu_Latest_GCC",
os: ubuntu-latest,
artifact: "ubuntu_gcc.7z",
archiver: "7z a",
}
- {
name: "macOS Latest GCC",
os: macos-latest,
artifact: "macos_gcc.7z",
archiver: "7za a",
}
steps:
- uses: actions/checkout@v2
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
run: |
choco install mingw
gcc --version
- name: Install dependencies on ubuntu
if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
run: |
sudo apt-get update
sudo apt-get install build-essential
gcc --version
- name: Install dependencies on macos
if: startsWith(matrix.config.os, 'macos')
run: |
brew install p7zip gcc
gcc --version
- name: Build
shell: bash
run: |
g++ main.cpp -o output
- name: List file
run: |
ls
- name: Make build diractory
run: |
mkdir -p build
- name: Move to build on WIndows
if: startsWith(matrix.config.os, 'windows')
run: mv ./output.exe ./build/output.exe
- name: Move to build on Ubuntu and MacOS
if: startsWith(matrix.config.os, 'macos') || startsWith(matrix.config.name, 'Ubuntu_Latest_GCC')
run: mv ./output ./build/output
- name: Pack
shell: bash
working-directory: build
run: |
ls -laR
${{ matrix.config.archiver }} ../${{ matrix.config.artifact }} .
- name: Upload
uses: actions/upload-artifact@v1
with:
path: ./${{ matrix.config.artifact }}
name: ${{ matrix.config.artifact }}
- name: Upload release asset
if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'created')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ matrix.config.artifact }}
asset_name: ${{ matrix.config.artifact }}.zip
asset_content_type: application/zip