-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (87 loc) · 2.83 KB
/
main.yml
File metadata and controls
102 lines (87 loc) · 2.83 KB
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
name: Main Release
on:
push:
branches: [ main ]
jobs:
build:
name: Tests, Build & Deploy
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v6
- name: Get Pubspec Version
run: |
VERSION=$(grep 'version:' pubspec.yaml | cut -c 10- | cut -f 1 -d '+')
sed -i "s/dev/$VERSION/g" bin/check.dart
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check if version is used
run: |
URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/${{ env.VERSION }}
CODE=$(curl -s -H "Authorization: Bearer ${{ github.token }}" -o /dev/null -w "%{http_code}" "$URL")
if [ "$CODE" != 404 ]; then
echo "Release '$VERSION' already exists. ($CODE)"
exit 1
fi
- name: Flutter Environment
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: false
- name: Install lcov
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update -y
sudo apt install -y lcov
- name: Dart Pub Get
timeout-minutes: 3
run: dart pub get
- name: Dart Test
run: |
dart test \
--coverage=coverage \
--concurrency=$(grep -c processor /proc/cpuinfo)
- name: Dart Compile
run: |
mkdir -p build
dart compile exe bin/check.dart -o build/check
- name: Creating package filter
run: dart run helpers/package.dart
- name: Creating lcov.info
run: |
dart run coverage:format_coverage \
--packages=coverage/package.json \
--lcov \
-i coverage \
-o coverage/lcov.info
- name: Creating Test Coverage HTML
run: |
genhtml coverage/lcov.info \
--ignore-errors empty \
--output-directory coverage/html/coverage \
--title "check" \
--show-details
- name: Creating package filter.
run: dart run helpers/create_index.dart README.md coverage/html/index.html
- name: Publishing to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
publish_dir: ./coverage/html
github_token: ${{ secrets.GITHUB_TOKEN }}
cname: check.testainers.com
- name: Creating a GitHub Tag
uses: mathieudutour/github-tag-action@v6.2
with:
custom_tag: ${{ env.VERSION }}
tag_prefix: ''
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
artifacts: build/*