-
-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (127 loc) · 4.43 KB
/
blank.yml
File metadata and controls
156 lines (127 loc) · 4.43 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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# This is a basic workflow to help you get started with Actions
name: CI/CD
# Controls when the workflow will run
on:
pull_request:
branches:
- main
push:
tags:
- "v*"
workflow_dispatch:
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout test dependencies
uses: actions/checkout@v4
with:
repository: Dirack/shellunity
path: shellunity
ref: v0.3.1
- name: Install shellunity
run: sudo cp shellunity/src/shellunity /usr/bin
- name: Install shellinclude
run: sudo cp src/* /usr/bin
- name: Test shellinclude from cmd
run: cd test && for test in $(ls test_*.sh); do ./$test; done
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./infra/Dockerfile
tags: shellinclude
outputs: type=docker,dest=/tmp/testimage.tar
- name: Load Docker image
run: docker load --input /tmp/testimage.tar
- name: Run unit tests on docker with Madagascar 3.0
run: |
docker run -t shellinclude bash -c "cd test/docker; cp ../../src/* /usr/bin; ./test_img.sh"
docker run -t shellinclude bash -c "cd test/docker; cp ../../src/* /usr/bin; ./test_comp.sh"
build:
runs-on: ubuntu-latest
needs: unit-tests
steps:
- uses: actions/checkout@v4
- name: Create a debian package
run: |
cd infra/build
./debianize.sh
- name: Install debian package
run: cd infra/build; PACKAGE=$(ls *.deb) #; sudo dpkg -i ./$PACKAGE
- name: Test shellinclude from cmd
run: echo "[TODO] Build a debian package for shellinclude"
- name: Test shellinclude from script
run: echo "[TODO] Build a debian package for shellinclude"
- name: Test documentation installation
run: echo "[TODO] Build a debian package for shellinclude" #./infra/scripts/doc_install_check.sh
delivery:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Create a debian package
run: |
cd infra/build
./debianize.sh
mkdir debian; mv *.deb debian; mv debian /tmp
- name: Upload changelog artifact
uses: actions/upload-artifact@v4
with:
name: shellinclude_debian
path: /tmp/debian
retention-days: 0
deploy:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
needs: delivery
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 50
fetch-tags: true
- name: Check version
run: ./infra/scripts/version_check.sh
- name: Create a debian package
run: |
cd infra/build
./debianize.sh
zip --junk-paths debian.zip *.deb; mv debian.zip /tmp
- name: Build Release notes
run: |
git fetch origin +refs/tags/*:refs/tags/*
RELEASE_NAME=$(git tag -l --format='%(contents:subject)' ${{ github.ref_name }})
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
git tag -l --format='%(contents:body)' ${{ github.ref_name }} >> ./release.md
- name: Build a changelog
run: ./infra/scripts/prepare_release_msg.sh >> ./release.md
- name: Upload changelog artifact
uses: actions/upload-artifact@v4
with:
name: changelog
path: ./release.md
retention-days: 0
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }} - ${{ env.RELEASE_NAME }}
body_path: ./release.md
draft: true
prerelease: true
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /tmp/debian.zip
asset_name: shellinclude_${{github.ref_name}}.deb.zip
asset_content_type: application/zip