Skip to content

Commit

Permalink
Update CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien-Chouteau committed Jun 7, 2022
1 parent c29c975 commit 6c8b316
Showing 1 changed file with 50 additions and 28 deletions.
78 changes: 50 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,60 @@
on:
push:
pull_request:
workflow_dispatch:
on: # Run the workflow for each of the following event:
push: # - A branch is pushed or updated.
pull_request: # - A pull-request is openned or updated.
workflow_dispatch: # - A manual run of the workflow is requested from the GitHub web interface.
release:
types: [created] # - A release is created.

jobs:
build:
main:
strategy:

fail-fast: false # Don't stop all the workflows when one of them fails.

matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
gnat_version: [^10, ^11]
gprbuild_version: [^21]
runs-on: ${{ matrix.os }}
os: [ubuntu-latest, windows-latest, macos-latest] # List of GitHuh Actions platform to run the workflow on

runs-on: ${{ matrix.os }} # Run the continous integration workflow on each OS listed in the matrix.

steps:
# Check-out the repository
- uses: actions/checkout@v2

# Install and setup Alire package manager
- uses: alire-project/setup-alire@v1
with:
toolchain: gprbuild${{ matrix.gprbuild_version }} gnat_native${{ matrix.gnat_version }} --disable-assistant

- name: Build
run: alr -q build
env:
USB_EMBEDDED_STYLE_CHECKS: enabled
USB_EMBEDDED_RUNTIME_CHECKS: enabled
USB_EMBEDDED_COMPILE_CHECKS: enabled
USB_EMBEDDED_CONTRACTS: enabled
# Build the project using the validation build profile to enforce static analysis and coding style.
- run: alr build --validation

# Run the testsuite
- run: cd tests && alr -q run

# Produce an Alire release manifest
- name: Make Release Manifest
run: |
# Set user GitHub login required for `alr publish`
alr config --set --global user.github_login ${{github.repository_owner}}
- name: Testsuite
run: cd tests && alr -q run
# Run Alire publish assistant
alr publish ${{github.server_url}}/${{github.repository}} ${{github.sha}}
# Save the path to the release manifest for the next step.
# This is a little trick to get around the fact that the actions/upload-release-asset doesn't allow globing pattern.
- name: Get Release Manifest PATH
shell: bash
run: |
export MANIFEST_PATHNAME=$(ls alire/releases/*.toml | head -n 1)
echo MANIFEST_PATHNAME=$MANIFEST_PATHNAME >> $GITHUB_ENV
echo MANIFEST_NAME=$(basename $MANIFEST_PATHNAME) >> $GITHUB_ENV
# If this worklow was triggered by a release event, upload the release manifest as a GitHub release asset.
- name: Upload release manifest
if: (github.event_name == 'release')
uses: actions/upload-release-asset@v1
env:
TESTS_STYLE_CHECKS: enabled
TESTS_RUNTIME_CHECKS: enabled
TESTS_COMPILE_CHECKS: enabled
TESTS_CONTRACTS: enabled
USB_EMBEDDED_STYLE_CHECKS: enabled
USB_EMBEDDED_RUNTIME_CHECKS: enabled
USB_EMBEDDED_COMPILE_CHECKS: enabled
USB_EMBEDDED_CONTRACTS: enabled
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.MANIFEST_PATHNAME }}
asset_name: ${{ env.MANIFEST_NAME }}
asset_content_type: application/toml

0 comments on commit 6c8b316

Please sign in to comment.