From ad851b082d334a6ade4934334fd36df845e5e8de Mon Sep 17 00:00:00 2001 From: Fabian Boemer Date: Tue, 13 Aug 2024 07:14:11 -0700 Subject: [PATCH] Add CI (#7) --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 4 ++-- README.md | 2 +- 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5186efc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +# Copyright 2024 Apple Inc. and the Swift Homomorphic Encryption project authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: CI +permissions: + contents: read +on: + workflow_dispatch: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + types: [opened, reopened, synchronize, ready_for_review] +# Pushing changes to PR stops currently-running CI +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + pre-commit: + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install pre-commit + run: pip install pre-commit + - name: Pre-commit checks + # CI will commit to `main` + run: > + SKIP=no-commit-to-branch + pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c85fc94..fe6c56e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,9 +51,9 @@ repos: - copyright-header.txt - --allow-past-years - repo: https://github.com/bufbuild/buf - rev: v1.34.0 + rev: v1.36.0 hooks: - id: buf-lint - id: buf-format - id: buf-breaking - args: [--against, '.git#branch=main'] + args: [--against, 'https://github.com/apple/swift-homomorphic-encryption-protobuf.git#branch=main'] diff --git a/README.md b/README.md index 44761a0..a9703ac 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,4 @@ To install `pre-commit`, follow instructions in https://pre-commit.com/. We reco ### Pull Requests: Before making a commit for a pull request, please run `pre-commit install`. -Then on each commit some basic formatting checks will be run. \ No newline at end of file +Then on each commit some basic formatting checks will be run.