Skip to content

Commit

Permalink
Try to modernize CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrahams committed Jan 11, 2024
1 parent 07a1ffa commit 353e587
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 51 deletions.
4 changes: 4 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ARG SWIFT_VERSION

FROM swift:${SWIFT_VERSION}

46 changes: 46 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "Swift",
"build": {
"dockerfile": "Dockerfile",
"args": {
"SWIFT_VERSION" : "5.8"
}
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "false",
"username": "vscode",
"userUid": "1000",
"userGid": "1000",
"upgradePackages": "false"
},
"ghcr.io/devcontainers/features/git:1": {
"version": "os-provided",
"ppa": "false"
}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"lldb.library": "/usr/lib/liblldb.so"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"sswg.swift-lang"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
89 changes: 89 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
name: Build and test

"on":
push:
branches: [main]
pull_request:
branches: ["**"]

jobs:

devcontainer:
name: "Devcontainer: ${{ matrix.os }}/${{ matrix.configuration }}"
strategy:
matrix:
os: [ubuntu-latest]
configuration: [debug]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
show-progress: false

- name: Build and Test
uses: devcontainers/[email protected]
with:
runCmd: swift test --explicit-target-dependency-import-check=error -c ${{ matrix.configuration }}

xcode:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
show-progress: false

- name: Build and Test
run: xcrun xcodebuild -skipPackagePluginValidation -scheme Lotsawa -destination 'platform=macOS' test

native:
name: "Native: ${{ matrix.os }}/${{ matrix.configuration }}"
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

configuration: [debug]

include:
# Default values to add
- shell: 'bash -eo pipefail {0}'
- build-options: '--explicit-target-dependency-import-check=error'

# Overrides for the defaults
- shell: pwsh
os: windows-latest

runs-on: ${{ matrix.os }}

defaults:
run:
shell: ${{ matrix.shell }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false


- name: Setup Swift (Unices)
if: ${{ matrix.os != 'windows-latest' }}
uses: 'swift-actions/setup-swift@v1'
with:
version: 5.9

- name: Setup Swift (Windows)
if: ${{ matrix.os == 'windows-latest' }}
uses: 'compnerd/gha-setup-swift@main'
with:
github-repo: thebrowsercompany/swift-build
release-asset-name: installer-amd64.exe
release-tag-name: 20231010.3
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Test (${{ matrix.configuration }})
run: >
swift test -c ${{ matrix.configuration }} ${{ matrix.build-options }}
--explicit-target-dependency-import-check=error
32 changes: 32 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Code Coverage

on:
push:
branches: [ main ]
pull_request:
branches: [ "**" ]

jobs:

codecov:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
with:
submodules: true
show-progress: false


- name: Test and generate code coverage report
run: xcrun xcodebuild -skipPackagePluginValidation -enableCodeCoverage YES -scheme Lotsawa -destination 'platform=macOS' test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
env_vars: OS
fail_ci_if_error: true
flags: unittests
swift: true
name: codecov-umbrella
verbose: true
51 changes: 0 additions & 51 deletions .github/workflows/swift.yml

This file was deleted.

0 comments on commit 353e587

Please sign in to comment.