Store packages as artefacts and not as releases #243
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CLIgen CI | |
on: | |
push: | |
branches: | |
- master | |
- test-actions | |
pull_request: | |
branches: [ master ] | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
ubuntu-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: install expect | |
run: sudo apt install -y expect | |
- name: configure | |
run: ./configure | |
- name: make | |
run: make | |
- name: make install | |
run: sudo make install | |
- name: ldconfig | |
run: sudo ldconfig | |
- name: make test | |
run: make test | |
ubuntu-coverage: | |
needs: ubuntu-build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: install expect | |
run: sudo apt install -y expect | |
- name: configure w coverage | |
run: ./configure CPPFLAGS="-fprofile-arcs -ftest-coverage -O0" CFLAGS="" LDFLAGS="-fprofile-arcs -lgcov" | |
- name: make | |
run: make | |
- name: make install | |
run: sudo make install | |
- name: ldconfig | |
run: sudo ldconfig | |
- name: make test | |
run: make test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
reset-run-number: | |
needs: ubuntu-coverage | |
runs-on: ubuntu-latest | |
outputs: | |
run-number: ${{ steps.get-build.outputs.build-number }} | |
steps: | |
- name: Get build number and reset it | |
id: get-build | |
uses: mlilback/build-number@v1 | |
with: | |
base: 0 # Update this number to reset counter | |
run-id: ${{ github.run_number }} | |
create_deb_packet: | |
needs: reset-run-number | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
env: | |
VERSION: "7.1.0" | |
RUN_NUMBER: ${{ needs.reset-run-number.outputs.run-number }} | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- run: sudo apt update && sudo apt install build-essential flex fakeroot bison lsb-release make debhelper libnghttp2-dev libssl-dev -y | |
- name: create dir for build | |
run: mkdir ${{ github.workspace }}/build | |
- name: configure | |
run: ./configure | |
- name: make | |
run: make | |
- name: install | |
run: sudo make install DESTDIR=${{ github.workspace }}/build | |
- name: copy file for build deb packet dev | |
run: cp -r ${{ github.workspace }}/debian ${{ github.workspace }}/build | |
- name: add change log | |
run: cd ${{ github.workspace }}/build/debian && export NAME_VERSION="cligen (${{env.VERSION}}-${{env.RUN_NUMBER}})" && git --no-pager log --no-walk --encoding=utf-8 --expand-tabs=4 --pretty=format:"${NAME_VERSION} stable; urgency=medium%n%n * %w(,,2)%B%w()%n -- %an <%ae> %aD%n" > changelog && cat changelog | |
- name: run build packet lib and dev | |
run: cd ${{ github.workspace }}/build && dpkg-buildpackage -us -uc | |
- name: show directory | |
run: ls -l ${{ github.workspace }} | |
- name: Create deb packet | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{env.VERSION}}_${{env.RUN_NUMBER}} | |
release_name: cligen_${{env.VERSION}}-${{env.RUN_NUMBER}} | |
draft: false | |
prerelease: false | |
- name: Upload artefact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libcligen-dev_${{env.VERSION}}-${{env.RUN_NUMBER}}_amd64.deb | |
path: ${{ github.workspace }}/libcligen-dev_${{env.VERSION}}-${{env.RUN_NUMBER}}_amd64.deb | |
- name: Upload artefact (cligen) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libcligen7_${{env.VERSION}}-${{env.RUN_NUMBER}}_amd64.deb | |
path: ${{ github.workspace }}/libcligen7_${{env.VERSION}}-${{env.RUN_NUMBER}}_amd64.deb |