Skip to content

Pipeline

Pipeline #126

Workflow file for this run

name: Build, test, upload
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
tests:
strategy:
matrix:
host: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.host }}
env:
TESTS_PATH: ./Tests
TESTS_CONFIGURATION: Debug
steps:
- name: Fix line endings
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Tests
run: dotnet test ${{ env.TESTS_PATH }} -c ${{ env.TESTS_CONFIGURATION }}
build:
needs: [tests]
strategy:
matrix:
host: [ubuntu-latest]
os: [win, linux, osx]
arch: [x86, x64, arm, arm64]
sc: [no-self-contained, self-contained]
exclude:
- os: linux
arch: x86
- os: osx
arch: x86
- os: osx
arch: arm
runs-on: ${{ matrix.host }}
env:
APP_NAME: nestiler
PROJECT_PATH: ./NesTiler
OUTPUT_DIR: output
CONFIGURATION: Interim
OUTPUT_SUBDIR: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.sc }}
OUTPUT_FILE: nestiler-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.sc == 'self-contained' && '-self-contained' || '' }}.${{ matrix.os == 'win' && 'zip' || 'tar.gz' }}
steps:
- name: Fix line endings
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Build
env:
SC_OPS: ${{ matrix.sc == 'self-contained' && '--self-contained true' || '--no-self-contained' }}
run: dotnet publish ${{ env.PROJECT_PATH }} -c ${{ env.CONFIGURATION }} -r ${{ matrix.os }}-${{ matrix.arch }} ${{ env.SC_OPS }} -o ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_SUBDIR }}/${{ env.APP_NAME }}
- name: Archive
working-directory: ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_SUBDIR }}
env:
CMD: ${{ matrix.os == 'win' && 'zip -r9' || 'tar -czvf' }}
run: |
${{ env.CMD }} ../../${{ env.OUTPUT_FILE }} ${{ env.APP_NAME }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.OUTPUT_SUBDIR }}
path: ${{ env.OUTPUT_FILE }}
upload-to-pages:
needs: [build, tests]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Move files to the root
run: find -mindepth 2 -exec mv {} . \;
- name: Remove empty directories
run: find -mindepth 1 -type d -delete
- name: Generate index.html
run: "(echo \"<html><head><title>NesTiler</title></head><body>Updated: `date`<br/><br/>\" ; for file in nestiler-* ; do echo \"<a href='$file'>$file</a><br/>\" ; done ; echo \"</body></html>\") > index.html"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1