Merge pull request #13 from gcarreno/update-ci-cd #30
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: Hex | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: [ master ] | |
tags: [ "*" ] | |
paths-ignore: [ "README.md", "LICENSE" ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-latest, windows-latest] | |
lazarus-versions: [ stable ] | |
include: | |
- operating-system: ubuntu-latest | |
folder: x86_64-linux | |
binary: Hex | |
- operating-system: windows-latest | |
folder: x86_64-win64 | |
binary: Hex.exe | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
clean: true | |
set-safe-directory: true | |
- name: Install Lazarus | |
uses: gcarreno/setup-lazarus@v3 | |
with: | |
lazarus-version: ${{ matrix.lazarus-versions }} | |
with-cache: false | |
- name: Build Test Application | |
run: lazbuild -B --bm=Release "tests/hex_tests_cli.lpi" | |
- name: Run Test Application | |
run: bin/hex_tests_cli --all --format=plain | |
- name: Build Application | |
run: lazbuild -B --bm=Release "source/Hex.lpi" | |
- name: Upload Application | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Hex-${{ matrix.operating-system }} | |
path: bin/${{ matrix.folder }}/${{ matrix.binary }} | |
release: | |
if: contains(github.ref_type, 'tag') | |
name: Release Application | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
clean: true | |
set-safe-directory: true | |
- name: Download the Release binaries | |
uses: actions/download-artifact@v4 | |
- name: Create archives | |
run: | | |
cd Hex-ubuntu-latest | |
mv Hex hex | |
chmod +x hex | |
tar zcvf ../Hex-ubuntu-x86_64-${{ github.ref_name }}.tgz hex | |
cd ../Hex-windows-latest | |
zip ../Hex-windows-x86_64-${{ github.ref_name }}.zip Hex.exe | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: Hex ${{ github.ref_name }} | |
body_path: release_notes.md | |
files: | | |
*.tgz | |
*.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |