Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow-up cleanup of GitHub Actions migration #116

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
schedule:
- cron: "0 8,20 * * *"

jobs:
unit-tests:
name: Unit tests
uses: ./.github/workflows/unit_tests.yml
with:
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
16 changes: 10 additions & 6 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ jobs:

unit-tests:
name: Unit tests
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
uses: ./.github/workflows/unit_tests.yml
with:
linux_exclude_swift_versions: "[{\"swift_version\": \"5.8\"}]"
# since we don't have systemctl, we run the redis server manually in the background
linux_pre_build_command: apt-get update -y && apt-get install redis -y
linux_build_command: bash -c 'nohup redis-server & swift test'
enable_windows_checks: false
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

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

on:
workflow_call:
inputs:
linux_5_9_enabled:
type: boolean
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true."
default: true
linux_5_9_arguments_override:
type: string
description: "The arguments passed to swift test in the Linux 5.9 Swift version matrix job."
default: ""
linux_5_10_enabled:
type: boolean
description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true."
default: true
linux_5_10_arguments_override:
type: string
description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job."
default: ""
linux_6_0_enabled:
type: boolean
description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true."
default: true
linux_6_0_arguments_override:
type: string
description: "The arguments passed to swift test in the Linux 6.0 Swift version matrix job."
default: ""
linux_nightly_6_0_enabled:
type: boolean
description: "Boolean to enable the Linux nightly 6.0 Swift version matrix job. Defaults to true."
default: true
linux_nightly_6_0_arguments_override:
type: string
description: "The arguments passed to swift test in the Linux nightly 6.0 Swift version matrix job."
default: ""
linux_nightly_main_enabled:
type: boolean
description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true."
default: true
linux_nightly_main_arguments_override:
type: string
description: "The arguments passed to swift test in the Linux nightly main Swift version matrix job."
default: ""

jobs:
unit-tests:
name: Linux (${{ matrix.swift.swift_version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# We are specifying only the major and minor of the docker images to automatically pick up the latest patch release
swift:
- image: "swift:5.9-jammy"
swift_version: "5.9"
enabled: ${{ inputs.linux_5_9_enabled }}
- image: "swift:5.10-jammy"
swift_version: "5.10"
enabled: ${{ inputs.linux_5_10_enabled }}
- image: "swift:6.0-jammy"
swift_version: "6.0"
enabled: ${{ inputs.linux_6_0_enabled }}
- image: "swiftlang/swift:nightly-6.0-jammy"
swift_version: "nightly-6.0"
enabled: ${{ inputs.linux_nightly_6_0_enabled }}
- image: "swiftlang/swift:nightly-main-jammy"
swift_version: "nightly-main"
enabled: ${{ inputs.linux_nightly_main_enabled }}
steps:
- name: Checkout repository
if: ${{ matrix.swift.enabled }}
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: true
- name: Mark the workspace as safe
if: ${{ matrix.swift.enabled }}
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Run matrix job
if: ${{ matrix.swift.enabled }}
env:
SWIFT_VERSION: ${{ matrix.swift.swift_version }}
COMMAND: "swift test"
COMMAND_OVERRIDE_5_9: "swift test ${{ inputs.linux_5_9_arguments_override }}"
COMMAND_OVERRIDE_5_10: "swift test ${{ inputs.linux_5_10_arguments_override }}"
COMMAND_OVERRIDE_6_0: "swift test ${{ inputs.linux_6_0_arguments_override }}"
COMMAND_OVERRIDE_NIGHTLY_6_0: "swift test ${{ inputs.linux_nightly_6_0_arguments_override }}"
COMMAND_OVERRIDE_NIGHTLY_MAIN: "swift test ${{ inputs.linux_nightly_main_arguments_override }}"
REDIS_URL: redis
run: |
apt-get -qq update && apt-get -qq -y install curl
curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.sh | bash
container:
image: ${{ matrix.swift.image }}
services:
redis:
image: redis:7
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ docker run -d -p 6379:6379 --name redis redis:5

Otherwise, install Redis directly on your machine from [Redis.io](https://redis.io/download).

### Run CI checks locally

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).

### Submitting a Pull Request

A great PR that is likely to be merged quickly is:
Expand Down
28 changes: 0 additions & 28 deletions docker/Dockerfile

This file was deleted.

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

This file was deleted.

20 changes: 0 additions & 20 deletions docker/docker-compose.2204.510.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions docker/docker-compose.2204.57.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions docker/docker-compose.2204.58.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions docker/docker-compose.2204.59.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions docker/docker-compose.2204.main.yaml

This file was deleted.

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

This file was deleted.

Loading