forked from jpochyla/psst
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (113 loc) · 4.26 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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Install ImageMagick on Windows
if: ${{ runner.os == 'Windows' }}
run: |
choco install -y imagemagick.app --no-progress
$IMFolder = Get-ChildItem -Path "${env:ProgramFiles}" | Where-Object {($_.Name -Like 'ImageMagick*')} | Select-Object "Name"
$IMAbsolutePath = Join-Path -Path "${env:ProgramFiles}" -ChildPath $IMFolder.Name
$IMAbsolutePath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo $IMAbsolutePath
- name: Generate Icon for Windows
if: ${{ runner.os == 'Windows' }}
run: |
magick convert .\logo_32.png -colors 256 logo_32_8bpp.png
magick convert .\logo_32.png -colors 16 logo_32_4bpp.png
magick convert .\logo_32.png -resize 16x16 -extent 16x16 logo_16.png
magick convert .\logo_32.png -resize 16x16 -extent 16x16 -colors 256 logo_16_8bpp.png
magick convert .\logo_32.png -resize 16x16 -extent 16x16 -colors 16 logo_16_4bpp.png
magick convert .\logo_256.png .\logo_128.png .\logo_64.png .\logo_32.png .\logo_32_8bpp.png .\logo_32_4bpp.png .\logo_16.png .\logo_16_8bpp.png .\logo_16_4bpp.png .\logo.ico
working-directory: psst-gui\assets
- uses: Swatinem/rust-cache@v1
- name: Update Linux Repositories
run: sudo apt-get update
if: ${{ runner.os == 'Linux' }}
- name: Install Linux Dependencies
run: sudo apt-get install -y libgtk-3-dev libssl-dev libasound2-dev
if: ${{ runner.os == 'Linux' }}
- name: Check Formatting
run: cargo fmt --all -- --check
- name: Run Tests
run: cargo test
continue-on-error: true
- name: Build Release
run: cargo build --release
- name: Bundle macOS Release
run: |
cargo install cargo-bundle
cargo bundle --release
working-directory: psst-gui
if: ${{ runner.os == 'macOS' }}
- name: Create .dmg File
run: |
hdiutil create Psst-uncompressed.dmg -volname "Psst" -srcfolder target/release/bundle/osx
hdiutil convert Psst-uncompressed.dmg -format UDZO -o Psst-x64.dmg
if: ${{ runner.os == 'macOS' }}
- name: Make Linux Binary Executable
run: chmod +x target/release/psst-gui
if: ${{ runner.os == 'Linux' }}
- uses: actions/upload-artifact@v2
with:
name: psst-gui
path: target/release/psst-gui
if: ${{ runner.os == 'Linux' }}
- uses: actions/upload-artifact@v2
with:
name: Psst-x64.dmg
path: ./Psst-x64.dmg
if: ${{ runner.os == 'macOS' }}
- uses: actions/upload-artifact@v2
with:
name: Psst.exe
path: target/release/psst-gui.exe
if: ${{ runner.os == 'Windows' }}
deb:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v2
with:
name: psst-gui
path: ${{runner.workspace}}
- name: Move executable
run: mkdir -p ${{runner.workspace}}/pkg/usr/bin/; mv ${{runner.workspace}}/psst-gui $_
- name: Move desktop
run: mkdir -p ${{runner.workspace}}/pkg/usr/share/applications/; mv .pkg/psst.desktop $_
- name: Set permissions
run: chmod 755 ${{runner.workspace}}/pkg/usr/bin/psst-gui
- name: Move license
run: mkdir -p ${{runner.workspace}}/pkg/usr/share/doc/psst-gui/; mv .pkg/copyright $_
- name: Move package config
run: mkdir -p ${{runner.workspace}}/pkg/; mv .pkg/DEBIAN $_/
- name: Set version
run: "echo Version: $(git rev-list --count HEAD) >> ${{runner.workspace}}/pkg/DEBIAN/control"
- name: Build package
run: cat ${{runner.workspace}}/pkg/DEBIAN/control && dpkg-deb -b ${{runner.workspace}}/pkg/ psst_$(git rev-list --count HEAD)_amd64.deb
- uses: actions/upload-artifact@v2
with:
name: psst-deb
path: "*.deb"