ci #526
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: ci | |
on: | |
push: | |
branches: [main] | |
tags: ["v*.*.*"] | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: "0 0 * * 3" # 00:00 every Wednesday | |
workflow_dispatch: | |
defaults: | |
run: | |
# See https://github.com/marketplace/actions/setup-miniconda#important | |
shell: bash -el {0} | |
env: | |
# Increase this to manually reset the conda environment cache | |
CONDA_CACHE_NUMBER: 0 | |
jobs: | |
validate: | |
strategy: | |
matrix: | |
cppVersion: [17, 20] | |
name: Validate C++${{ matrix.cppVersion }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure environment | |
uses: ./.github/actions/configure-environment | |
- name: Build and test | |
run: just cpp_version=${{ matrix.cppVersion }} matlab=enabled validate-with-no-changes | |
buildBinaries: | |
name: Build yardl binaries | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21.3" | |
cache-dependency-path: tooling/go.sum | |
- name: Build yardl binaries for multiple platforms | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
version: v1.13.0 | |
args: release --rm-dist --snapshot | |
- name: Upload yardl binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
smoketestWindows: | |
name: Run smoke test on Windows | |
runs-on: windows-latest | |
needs: buildBinaries | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download yardl binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
- name: Set path | |
shell: pwsh | |
run: Add-Content $env:GITHUB_PATH "${{github.workspace}}\yardl_windows_amd64_v1" | |
- name: Run smoke test | |
shell: pwsh | |
run: smoketest\run-smoketest.ps1 | |
smoketestMac: | |
name: Run smoke test on macOS | |
if: false # Disabling until this is fixed: https://github.com/Homebrew/homebrew-core/issues/159691 | |
runs-on: macos-latest | |
needs: buildBinaries | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download yardl binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
- name: Set path | |
run: | | |
chmod +x "${{github.workspace}}/yardl_darwin_amd64_v1/yardl" | |
echo "${{github.workspace}}/yardl_darwin_amd64_v1" >> $GITHUB_PATH | |
- name: Run smoke test | |
run: ./smoketest/run-smoketest-macos.sh | |
codeQL: | |
name: CodeQL | |
runs-on: ubuntu-latest | |
if: github.repository == 'microsoft/yardl' | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
language: [ 'cpp', 'go', 'python' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure environment | |
uses: ./.github/actions/configure-environment | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: ${{ matrix.language }} | |
- name: Build | |
run: | | |
just build-all | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
with: | |
category: "/language:${{matrix.language}}" | |
noticeCheck: | |
name: Check NOTICE.txt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21.3" | |
cache-dependency-path: tooling/go.sum | |
- name: Set variables | |
run: | | |
gobin="${RUNNER_TEMP}/bin" | |
echo "GOBIN=${gobin}" >> $GITHUB_ENV | |
echo "${gobin}" >> $GITHUB_PATH | |
- name: Generate notice | |
run: | | |
scripts/generate-notice.sh | |
if [[ `git status --porcelain` ]]; then | |
git diff | |
echo "ERROR: NOTICE.txt needs to be regenerated using scripts/generate-notice.sh" | |
exit 1 | |
fi | |
publishDocs: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'microsoft/yardl' | |
needs: | |
- validate | |
- smoketestWindows | |
# - smoketestMac # Disabling until this is fixed: https://github.com/Homebrew/homebrew-core/issues/159691 | |
- noticeCheck | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build static page | |
run: | | |
cd docs | |
npm install | |
npm run docs:build | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
# Upload entire repository | |
path: 'docs/.vitepress/dist' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
release: | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
needs: | |
- validate | |
- smoketestWindows | |
# - smoketestMac # Disabling until this is fixed: https://github.com/Homebrew/homebrew-core/issues/159691 | |
- noticeCheck | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: git fetch --force --tags | |
- name: Configure environment | |
uses: ./.github/actions/configure-environment | |
- name: Set PATH | |
run: | | |
dirname $(which go) >> $GITHUB_PATH | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
version: v1.13.0 | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |