-
Notifications
You must be signed in to change notification settings - Fork 15
140 lines (131 loc) · 4.12 KB
/
ci.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
134
135
136
137
138
139
140
on:
push:
branches: [main]
tags:
- "v*"
pull_request:
name: CI
jobs:
check-commit-style:
name: Check Commit Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: webiny/[email protected]
typos:
name: Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: crate-ci/typos@master
with:
config: ./.typos.toml
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- name: Create blank versions of configured file
run: echo -e "" >> src/config.rs
- name: Run cargo fmt
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-43
options: --privileged
steps:
- uses: actions/checkout@v3
- name: Create dummy versions of configured file
run: |
sed \
-e 's/str =.*;/str = "";/g' \
-e 's/i32 =.*;/i32 = 0;/g' \
src/config.rs.in \
> src/config.rs
- name: Build dependencies
run: |
flatpak-builder \
--disable-rofiles-fuse \
--install-deps-from=flathub \
--keep-build-dirs \
--stop-at=pods \
flatpak_app build-aux/com.github.marhkb.Pods.Devel.json
- name: Run clippy
run: |
flatpak-builder \
--run \
flatpak_app build-aux/com.github.marhkb.Pods.Devel.json \
cargo clippy -- -D warnings
flatpak:
name: Flatpak
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-43
options: --privileged
strategy:
matrix:
arch: [x86_64]
# Don't fail the whole workflow if one architecture fails
fail-fast: false
needs: [check-commit-style, typos, rustfmt, clippy]
steps:
- uses: actions/checkout@v3
# Docker is required by the docker/setup-qemu-action which enables emulation
- name: Install dependencies
if: ${{ matrix.arch != 'x86_64' }}
run: dnf -y install docker
- name: Set up QEMU
if: ${{ matrix.arch != 'x86_64' }}
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v5
with:
bundle: pods.flatpak
manifest-path: build-aux/com.github.marhkb.Pods.Devel.json
run-tests: true
arch: ${{ matrix.arch }}
release:
if: startsWith(github.ref, 'refs/tags/')
name: Release
runs-on: ubuntu-latest
needs: [flatpak]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create vendored sources
run: build-aux/dist-vendor.sh ../ src
shell: bash
- name: Archive repository
run: git archive --format tar HEAD > pods-${{ github.ref_name }}.tar
- name: Add vendored sources and cargo config to tarball
run: tar -rf pods-${{ github.ref_name }}.tar .cargo vendor
- name: Compress tarball
run: xz -z pods-${{ github.ref_name }}.tar
- name: Generate checksum
run: sha256sum pods-${{ github.ref_name }}.tar.xz > pods-${{ github.ref_name }}.tar.xz.sha256sum
- name: Install xmllint
run: sudo apt-get install -y libxml2-utils
- name: Extract release notes
run: |
echo 'RELEASE_NOTES<<EOF' >> $GITHUB_ENV
xmllint --xpath '//release[1]/description' data/com.github.marhkb.Pods.metainfo.xml.in.in | xmllint --format - >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
body: ${{ env.RELEASE_NOTES }}
prerelease: ${{ contains(github.ref, 'beta') }}
files: |
pods-${{ github.ref_name }}.tar.xz
pods-${{ github.ref_name }}.tar.xz.sha256sum