Skip to content

Compile up to v2.10

Compile up to v2.10 #8

name: Continuous Integration
on: [push]
jobs:
build-images:
name: Image
runs-on: ubuntu-latest
strategy:
matrix:
image-name: [linux-build, windows-build, osx-build, linux-test-compile, windows-test-compile, osx-test-compile, all-test-validate]
steps:
- name: Checkout Metadata
uses: actions/checkout@v2
- name: Setup Image Cache
id: cache-image
uses: actions/cache@v1
with:
path: docker-images
key: docker-image-${{ matrix.image-name }}-${{ hashFiles(format('build-scripts/containers/{0}.Dockerfile', matrix.image-name)) }}
- name: Build Image
if: steps.cache-image.outputs.cache-hit != 'true'
run: |
build-scripts/prepare-container.sh ${{ matrix.image-name }}
# Save to image to file
mkdir docker-images
docker save -o docker-images/docker-${{ matrix.image-name }}.tar xc16plusplus:${{ matrix.image-name }}
gzip docker-images/docker-${{ matrix.image-name }}.tar # compress it
- name: Propagate Image
uses: actions/upload-artifact@v1
with:
name: docker-image-${{ matrix.image-name }}
path: docker-images
build-xc16plusplus:
name: XC16++
needs: [build-images]
runs-on: ubuntu-latest
strategy:
matrix:
version: [v1.00, v1.10, v1.11, v1.20, v1.21, v1.22, v1.23, v1.24, v1.25, v1.26, v1.30, v1.31, v1.32, v1.33, v1.34, v1.35, v1.36, v1.40, v1.41, v1.49, v1.50, v1.59, v1.60, v1.61, v1.70, v2.00, v2.09, v2.10]
target-os: [linux, windows, osx]
steps:
- name: Install Prerequisites
run: sudo apt-get install -y dos2unix
- name: Checkout Metadata
uses: actions/checkout@v2
- name: Checkout Source Code
uses: actions/checkout@v2
with:
repository: 'fabio-d/xc16plusplus-source'
ref: xc16++-${{ matrix.version }}
path: xc16plusplus-source
- name: Receive "${{ matrix.target-os }}-build" Docker Image
uses: actions/download-artifact@v2
with:
name: docker-image-${{ matrix.target-os }}-build
path: docker-images
# Versions v1.49, v1.59, v2.09 cannot be tested because a nonfree XC16 license is required
- name: Receive "${{ matrix.target-os }}-test-compile" Docker Image
uses: actions/download-artifact@v2
id: download-test-compile-image
if: matrix.version != 'v1.49' && matrix.version != 'v1.59' && matrix.version != 'v2.09'
with:
name: docker-image-${{ matrix.target-os }}-test-compile
path: docker-images
- name: Load Docker Images
run: |
# Load the images retrieved by the previous steps
for IMAGE_FILE in docker-images/*;
do
docker load -i "$IMAGE_FILE"
done
- name: Build XC16++ Package
run: |
export XC16PLUSPLUS_SOURCE_REPO="$PWD/xc16plusplus-source"
build-scripts/build-in-container.sh ${{ matrix.version }} ${{ matrix.target-os }}
# Append the output package "xc16plusplus-vN.NNrXX-OS.tar.gz" (or .zip) to the
# "xc16plusplus-packages" artifact
- name: Propagate XC16++ Package
uses: actions/upload-artifact@v2
with:
name: xc16plusplus-packages
path: build-scripts/build-${{ matrix.version }}/xc16plusplus-*
- name: Compile Tests
id: compile-tests
if: steps.download-test-compile-image.outcome == 'success' # Some versions cannot be tested
continue-on-error: true
env:
TESTPACK_TOKEN: ${{ secrets.TESTPACK_TOKEN }}
run: |
cd build-scripts
# Retrieve the preinstalled environment from a private location
${{ secrets.TESTPACK_RETR }} xc16-${{ matrix.version }}-${{ matrix.target-os }}.tar.xz
unset TESTPACK_TOKEN
# Run the tests' compilation phase
if [ "${{ matrix.target-os }}" == "osx" ];
then
# set some kernel knobs for maloader
sudo ./test-compile-in-container-osx-host-init.sh
fi
./test-compile-in-container.sh ${{ matrix.version }} ${{ matrix.target-os }}
# Append the output package "test-bundle-vN.NN-OS.zip" (or .zip) to the
# "test-bundles" artifact
- name: Propagate Compiled Tests
uses: actions/upload-artifact@v2
if: steps.compile-tests.outcome == 'success'
with:
name: test-bundles
path: build-scripts/build-${{ matrix.version }}/test-bundle-*
validate-tests:
name: Validate Tests
runs-on: ubuntu-latest
needs: [build-images, build-xc16plusplus]
continue-on-error: true
steps:
- name: Checkout Metadata
uses: actions/checkout@v2
- name: Receive "all-test-validate" Docker Image
uses: actions/download-artifact@v2
with:
name: docker-image-all-test-validate
path: docker-images
- name: Load Docker Image
run: |
# Load the image retrieved by the previous step
for IMAGE_FILE in docker-images/*;
do
docker load -i "$IMAGE_FILE"
done
- name: Retrieve Compiled Tests
uses: actions/download-artifact@v2
with:
name: test-bundles
path: test-bundles
- name: Validate Tests
id: validate-tests
run: |
build-scripts/test-validate-in-container.sh test-report.zip test-bundles/*
- name: Propagate Test Report
if: always()
uses: actions/upload-artifact@v2
with:
name: test-report
path: test-report.zip