Skip to content

Commit

Permalink
Set up Github Actions (#37)
Browse files Browse the repository at this point in the history
Motivation:

CI is moving to Github Actions

Modifications:

Create Github Actions workflows

Result:

GHA used for CI
  • Loading branch information
PeterAdams-A authored Nov 1, 2024
1 parent 9ca41a7 commit 50ff68f
Show file tree
Hide file tree
Showing 23 changed files with 213 additions and 596 deletions.
12 changes: 12 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[flake8]

ignore =
# These are needed to make our license headers pass the linting
E265,
E266,

# 10% larger than the standard 80 character limit. Conforms to the black
# standard and Bugbear's B950.
max-line-length = 88
exclude =
Sources/Clibuv/libuv
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Main

on:
push:
branches: [main]

jobs:
unit-tests:
name: Unit Tests
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
with:
name: "Unit tests"
matrix_linux_command: "I_AM_RUNNING_IN_CI=true ./scripts/gha_run_unit_tests.sh"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
31 changes: 31 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PR

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
license_header_check_project_name: "Swift Cassandra Client"
api_breakage_check_enabled: false
format_check_enabled: false

unit-tests:
name: Unit Tests
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
with:
name: "Unit tests"
matrix_linux_command: "I_AM_RUNNING_IN_CI=true ./scripts/gha_run_unit_tests.sh"

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main

swift-6-language-mode:
name: Swift 6 Language Mode
uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main
if: false # Disabled for now.
18 changes: 18 additions & 0 deletions .github/workflows/pull_request_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR label

on:
pull_request:
types: [labeled, unlabeled, opened, reopened, synchronize]

jobs:
semver-label-check:
name: Semantic Version label check
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Check for Semantic Version label
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main
14 changes: 14 additions & 0 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Scheduled

on:
schedule:
- cron: "0 8,20 * * *"

jobs:
unit-tests:
name: Unit Tests
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
with:
name: "Unit tests"
matrix_linux_command: "I_AM_RUNNING_IN_CI=true ./scripts/gha_run_unit_tests.sh"
52 changes: 52 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
.gitignore
**/.gitignore
.licenseignore
.unacceptablelanguageignore
.gitattributes
.git-blame-ignore-revs
.mailfilter
.mailmap
.spi.yml
.swift-format
.editorconfig
.github/*
*.md
*.txt
*.yml
*.yaml
*.json
Package.swift
**/Package.swift
Package@-*.swift
Package@*.swift
**/Package@-*.swift
Package.resolved
**/Package.resolved
Makefile
*.modulemap
**/*.modulemap
**/*.docc/*
*.xcprivacy
**/*.xcprivacy
*.symlink
**/*.symlink
Dockerfile
**/Dockerfile
Snippets/*
dev/git.commit.template
dev/update-benchmark-thresholds
*.crt
**/*.crt
*.pem
**/*.pem
*.der
**/*.der
.swiftformat
.gitmodules
.flake8
Sources/CDataStaxDriver/datastax-cpp-driver
Sources/Clibuv/libuv
Sources/Clibuv/include/uv
Sources/Clibuv/include/uv.h
Sources/CDataStaxDriver/custom/src/ssl/ssl_openssl_impl.cpp
Sources/CDataStaxDriver/extras/driver_config.hpp
25 changes: 25 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## ===----------------------------------------------------------------------===##
##
## This source file is part of the SwiftNIO open source project
##
## Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
## See CONTRIBUTORS.txt for the list of SwiftNIO project authors
##
## SPDX-License-Identifier: Apache-2.0
##
## ===----------------------------------------------------------------------===##

ignore: |
Sources/Clibuv/libuv/
Sources/CDataStaxDriver/datastax-cpp-driver
extends: default

rules:
line-length: false
document-start: false
truthy:
check-keys: false # Otherwise we get a false positive on GitHub action's `on` key
27 changes: 3 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,10 @@ We require that your commit messages match our template. The easiest way to do t

git config commit.template dev/git.commit.template

### Run `./scripts/soundness.sh`
### Run CI checks locally

The scripts directory contains a [soundness.sh script](https://github.com/apple/swift-cassandra-client/blob/main/scripts/soundness.sh)
that enforces additional checks, like license headers and formatting style.

Please make sure to `./scripts/soundness.sh` before pushing a change upstream, otherwise it is likely the PR validation will fail
on minor changes such as a missing `self.` or similar formatting issues.

> The script also executes the above mentioned `generate_linux_tests.rb`.
For frequent contributors, we recommend adding the script as a [git pre-push hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks), which you can do via executing the following command in the project root directory:

```bash
cat << EOF > .git/hooks/pre-push
#!/bin/bash
if [[ -f "scripts/soundness.sh" ]]; then
scripts/soundness.sh
fi
EOF
```

Which makes the script execute, and only allow the `git push` to complete if the check has passed.

In the case of formatting issues, you can then `git add` the formatting changes, and attempt the push again.
You can run the Github Actions workflows locally using
[act](https://github.com/nektos/act). For detailed steps on how to do this please see [https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally](https://github.com/swiftlang/github-workflows?tab=readme-ov-file#running-workflows-locally).

## How to contribute your work

Expand Down
27 changes: 0 additions & 27 deletions docker/Dockerfile

This file was deleted.

68 changes: 0 additions & 68 deletions docker/docker-compose-dev.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions docker/docker-compose.2004.54.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions docker/docker-compose.2004.55.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions docker/docker-compose.2004.56.yaml

This file was deleted.

Loading

0 comments on commit 50ff68f

Please sign in to comment.