This repository has been archived by the owner on Nov 25, 2023. It is now read-only.
fix dockerfile #63
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: Continuous Deployment | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
create-dockerimage: | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
env: | |
CC: clang-16 | |
CXX: clang++-16 | |
CLANG_DIR: '/usr/lib/llvm-16/lib/cmake/clang' | |
LLVM_DIR: '/usr/lib/llvm-16/lib/cmake/llvm' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Configure gcloud | |
run: | | |
gcloud config set project ${{ secrets.GCP_PROJECT_ID }} | |
gcloud auth configure-docker | |
- name: Write GCP Service Account Key to File | |
run: echo "$GCP_SA_KEY" > ./.github/terraform/gcp-sa-key.json | |
env: | |
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | |
- name: Authenticate with Google Cloud | |
run: gcloud auth activate-service-account --key-file=./.github/terraform/gcp-sa-key.json | |
- name: Install LLVM 16 | |
run: | | |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc | |
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | |
sudo apt update | |
sudo apt install llvm-16 llvm-16-dev llvm-16-tools clang-16 clang-tidy-16 clang-tools-16 libclang-16-dev -y | |
- name: Install static analyzers | |
if: matrix.os == 'ubuntu-22.04' | |
run: >- | |
sudo apt install cppcheck -y -q | |
sudo update-alternatives --install | |
/usr/bin/clang-tidy clang-tidy | |
/usr/bin/clang-tidy-16 160 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: { python-version: "3.11" } | |
- name: Install dependencies | |
shell: bash | |
run: | | |
pip3 install conan | |
sudo apt install libssl-dev -y | |
bash < .github/scripts/conan-profile.sh | |
conan install . -b missing | |
- name: Setup MultiToolTask | |
if: matrix.os == 'windows-2022' | |
run: | | |
Add-Content "$env:GITHUB_ENV" 'UseMultiToolTask=true' | |
Add-Content "$env:GITHUB_ENV" 'EnforceProcessCountAcrossBuilds=true' | |
- name: Configure | |
shell: pwsh | |
run: cmake "--preset=ci-$("${{ matrix.os }}".split("-")[0])" | |
- name: Build | |
run: cmake --build build --config Release -j 2 | |
- name: Install | |
run: cmake --install build --config Release --prefix prefix | |
- name: Create Dockerimage | |
run: docker build -t nutc-linter:latest . | |
- name: Push Docker image | |
run: | | |
docker tag nutc-linter:latest gcr.io/${{ secrets.GCP_PROJECT_ID }}/nutc-linter:latest | |
docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/nutc-linter:latest | |
- name: Deploy to Cloud Run | |
run: > | |
gcloud run deploy nutc-linter | |
--image gcr.io/${{ secrets.GCP_PROJECT_ID }}/nutc-linter:latest | |
--region us-central1 | |
--platform managed | |