Skip to content

Collection of fixes to get CI running. #5430

Collection of fixes to get CI running.

Collection of fixes to get CI running. #5430

Workflow file for this run

# Copyright (c) 2022 Swift Navigation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---
name: main
'on':
push:
branches:
- 'main'
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:
env:
PIP_CACHE_DIR: ~/.cache/pip
RUST_CACHE_DIRS: "~/.cargo/registry\n~/.cargo/git\ntarget\n"
LIBCLANG_PATH_WIN: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/Llvm/x64/bin"
CODE_SIGNER_PATH_WIN: "%win10sdk%/x64/signtool.exe"
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0"
APP_NAME: swift-console
APP_BUNDLE_ID: com.swift-nav.SwiftConsole
jobs:
backend_bench:
name: Backend Benchmarks
strategy:
matrix:
os: [ubuntu-20.04, macos-12, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
submodules: recursive
ssh-key: ${{ secrets.SSH_KEY }}
ssh-strict: false
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
- name: Run ssh-keyscan
run: ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Setup SSH for Windows Git LFS
run: |
& "C:\\Program Files\\Git\\bin\\sh.exe" -c "ssh-keyscan github.com >> ~/.ssh/known_hosts"
& "C:\\Program Files\\Git\\bin\\sh.exe" -c "echo '${{ secrets.SSH_KEY }}' >> ~/.ssh/id_rsa"
if: matrix.os == 'windows-2019'
- name: Install ${{ runner.os }} Dependencies.
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update && sudo apt-get install -y capnproto libudev-dev libssl-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install capnp llvm
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install -y capnproto
echo "LIBCLANG_PATH=${{ env.LIBCLANG_PATH_WIN }}" >> $GITHUB_ENV
fi
- name: Pull Git LFS objects
run: git lfs pull
env:
GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
with:
key: ${{ secrets.CACHE_VERSION }}
- uses: davidB/rust-cargo-make@v1
- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ env.PIP_CACHE_DIR }}
key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }}
- name: Install ImageMagick
shell: bash
run: cargo make install-imagemagick
- name: Set up python builder
shell: bash
run: cargo make setup-builder
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Backend Benchmarks
run: cargo make backend-benches
checks:
name: Code Quality Checks
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
submodules: recursive
ssh-key: ${{ secrets.SSH_KEY }}
ssh-strict: false
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
- name: Pull Git LFS objects
run: git lfs pull
env:
GIT_SSH_COMMAND: ssh -o StrictHostKeyChecking=no
- name: Install stable Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
with:
key: ${{ secrets.CACHE_VERSION }}
- uses: davidB/rust-cargo-make@v1
- name: Install Dependencies.
run: sudo apt-get update && sudo apt-get install -y capnproto libudev-dev libssl-dev
- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ env.PIP_CACHE_DIR }}
key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }}
- name: Install ImageMagick
shell: bash
run: cargo make install-imagemagick
- name: Set up python builder
run: cargo make setup-builder
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Qt
uses: jurplel/install-qt-action@910f37ee23653fd4b243fe5c7f81ff26a8a6a64e
with:
version: '6.4.3'
setup-python: false
aqtversion: '==3.1.6'
- name: Run Checks
run: cargo make check-all
# TODO Fix qmllint warnings [CPP-798]
- name: Run qmllint
continue-on-error: true
run: cargo make qml-lint
- name: Run Tests
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
retry_on: error
command: cargo make tests
frontend_distribute:
name: Run frontend benchmarks, build, sign and distribute
needs: [checks, backend_bench]
runs-on: ubuntu-latest
steps:
- shell: bash
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
run: echo "SHOULD_RELEASE=true" >> $GITHUB_ENV
- shell: bash
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- uses: convictional/[email protected]
with:
owner: swift-nav
repo: swift-toolbox-ci
ref: main
workflow_file_name: distribute.yml
client_payload: '{
"branch": "${{ github.head_ref || github.ref_name }}",
"run_id": "${{ github.run_id }}",
"should_release": "${{ env.SHOULD_RELEASE || false}}",
"version": "${{ env.VERSION }}",
"pr_number": "${{ github.event.number }}"
}'
github_user: ${{ secrets.GH_NAME }}
github_token: ${{ secrets.GH_TOKEN }}
propagate_failure: true
wait_workflow: true
trigger_workflow: true
wait_interval: 120