Skip to content

Commit f963eb7

Browse files
authored
Add GH Action for CI (#886)
* Add CI file * Update CI to run site for testing * add missing license headers * Make soundness check pass * Run correct CI on the OpenAPI spec * Use Docker compose * Numptie * Background and expose ports * Use local swift org * Remove download test for now
1 parent 9322b8d commit f963eb7

File tree

8 files changed

+108
-5
lines changed

8 files changed

+108
-5
lines changed

.github/workflows/ci.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: test
2+
concurrency:
3+
group: ${{ github.workflow }}-${{ github.ref }}
4+
cancel-in-progress: true
5+
on:
6+
pull_request: { types: [opened, reopened, synchronize, ready_for_review] }
7+
push: { branches: [ main ] }
8+
9+
jobs:
10+
soundness:
11+
name: Soundness Checks
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Run script
17+
run: ./scripts/soundness.sh
18+
19+
build-site:
20+
name: Build the Jekyll Site
21+
runs-on: ubuntu-latest
22+
container: ruby:3.3
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
- name: Build site
27+
run: bundle install && bundle exec jekyll build
28+
29+
test-openapi:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Check out
33+
uses: actions/checkout@v4
34+
- name: Run OpenAPI Tester
35+
working-directory: openapi/TestSwiftOrgClient
36+
env:
37+
DOWNLOADSWIFTORG_SERVER_NAME: local
38+
SWIFTORG_SERVER_NAME: local
39+
run: |
40+
docker compose -f ../../docker-compose.yaml run build
41+
docker compose -f ../../docker-compose.yaml run -d -p 4000:4000 website
42+
swift run swiftorgClient

docker-compose.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
# docker-compose up website
1515
#
1616

17-
version: "2"
18-
1917
services:
2018

2119
docker-setup:

openapi/TestSwiftOrgClient/Shared/Tester.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2025 Apple Inc. and the Swift.org project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of Swift.org project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
115
import Foundation
216

317
package struct Test: Sendable {

openapi/TestSwiftOrgClient/downloadswiftorgClient/Issue847Workaround.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2025 Apple Inc. and the Swift.org project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of Swift.org project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
115
import OpenAPIRuntime
216
import HTTPTypes
317
import Foundation

openapi/TestSwiftOrgClient/downloadswiftorgClient/Tool.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2025 Apple Inc. and the Swift.org project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of Swift.org project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
115
import OpenAPIURLSession
216
import Foundation
317
import Shared
418

519
enum DownloadSwiftOrgServerName: String {
620
case prod
21+
case local
722
}
823

924
@main
@@ -17,6 +32,8 @@ struct Tool {
1732
switch serverName {
1833
case .prod:
1934
serverURL = try Servers.Server1.url()
35+
case .local:
36+
serverURL = try Servers.Server2.url()
2037
}
2138
} else {
2239
serverURL = try Servers.Server1.url()

openapi/TestSwiftOrgClient/swiftorgClient/Tool.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2025 Apple Inc. and the Swift.org project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of Swift.org project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
115
import OpenAPIURLSession
216
import Foundation
317
import Shared

openapi/downloadswiftorg.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ info:
66
servers:
77
- url: https://download.swift.org
88
description: The production server.
9+
- url: http://127.0.0.1:4000/api/v1
10+
description: A local deployment.
911
tags:
1012
- name: Evolution
1113
description: Information about the Swift evolution process.

scripts/soundness.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1818

1919
function replace_acceptable_years() {
2020
# this needs to replace all acceptable forms with 'YEARS'
21-
sed -e 's/20[12][789012]-20[12][89012]/YEARS/' -e 's/20[12][89012]/YEARS/'
21+
sed -e 's/20[2][0123456789]-20[2][0123456789]/YEARS/' -e 's/20[2][0123456789]/YEARS/'
2222
}
2323

2424
printf "=> Checking for unacceptable language... "
@@ -45,11 +45,11 @@ tmp=$(mktemp /tmp/.swift-org-soundness_XXXXXX)
4545
for language in swift-or-c bash python; do
4646
declare -a matching_files
4747
declare -a exceptions
48-
expections=( )
48+
exceptions=( )
4949
matching_files=( -name '*' )
5050
case "$language" in
5151
swift-or-c)
52-
exceptions=( -name "" )
52+
exceptions=( -name "Package.swift" )
5353
matching_files=( -name '*.swift' -o -name '*.c' -o -name '*.h' )
5454
cat > "$tmp" <<"EOF"
5555
//===----------------------------------------------------------------------===//
@@ -68,6 +68,7 @@ for language in swift-or-c bash python; do
6868
EOF
6969
;;
7070
bash)
71+
exceptions=( -name "placeholder" )
7172
matching_files=( -name '*.sh' )
7273
cat > "$tmp" <<"EOF"
7374
#!/bin/bash
@@ -87,6 +88,7 @@ EOF
8788
EOF
8889
;;
8990
python)
91+
exceptions=( -name "placeholder" )
9092
matching_files=( -name '*.py' )
9193
cat > "$tmp" <<"EOF"
9294
#!/usr/bin/env python

0 commit comments

Comments
 (0)