Skip to content

Commit 15ed75b

Browse files
Add github actions workflows (#1)
Signed-off-by: Kathryn Baldauf <[email protected]>
1 parent b7588bd commit 15ed75b

File tree

7 files changed

+273
-0
lines changed

7 files changed

+273
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Build containerization template
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
release:
7+
type: boolean
8+
description: "Create a release"
9+
default: false
10+
version:
11+
type: string
12+
description: Version of containerization
13+
default: test
14+
15+
jobs:
16+
buildAndTest:
17+
name: Build and Test repo
18+
timeout-minutes: 90
19+
runs-on: [self-hosted, macos, sequoia, ARM64]
20+
permissions:
21+
contents: read
22+
packages: write
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
- name: Activate Swiftly
29+
run: |
30+
source /opt/swiftly/env.sh
31+
cat /opt/swiftly/env.sh
32+
- name: Check formatting
33+
run: |
34+
./scripts/install-hawkeye.sh
35+
make fmt
36+
git diff
37+
if ! git diff --quiet ; then echo the following files require formatting or license headers: ; git diff --name-only ; false ; fi
38+
env:
39+
DEVELOPER_DIR: "/Applications/Xcode_16.3.app/Contents/Developer"
40+
- name: Check protobufs
41+
run: |
42+
make protos
43+
if ! git diff --quiet ; then echo the following files require formatting or license headers: ; git diff --name-only ; false ; fi
44+
env:
45+
DEVELOPER_DIR: "/Applications/Xcode_16.3.app/Contents/Developer"
46+
CURRENT_SDK: y
47+
- name: Make containerization and docs
48+
run: |
49+
make clean containerization docs
50+
tar cfz _site.tgz _site
51+
env:
52+
DEVELOPER_DIR: "/Applications/Xcode_16.3.app/Contents/Developer"
53+
CURRENT_SDK: y
54+
- name: Make vminitd image
55+
run: |
56+
source /opt/swiftly/env.sh
57+
make -C vminitd linux-sdk
58+
make init
59+
env:
60+
CURRENT_SDK: y
61+
- name: Test containerization
62+
run: |
63+
make test integration
64+
env:
65+
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
REGISTRY_USERNAME: ${{ github.actor }}
67+
DEVELOPER_DIR: "/Applications/Xcode_16.3.app/Contents/Developer"
68+
CURRENT_SDK: y
69+
- name: Push vminitd image
70+
if: ${{ inputs.release }}
71+
run: |
72+
bin/cctl images tag vminit:latest ghcr.io/apple-uat/containerization/vminit:${{ inputs.version }}
73+
bin/cctl images push ghcr.io/apple-uat/containerization/vminit:${{ inputs.version }}
74+
env:
75+
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
REGISTRY_USERNAME: ${{ github.actor }}
77+
REGISTRY_HOST: ghcr.io
78+
- name: Create image tar
79+
if: ${{ inputs.release }} != true
80+
run: |
81+
bin/cctl images save vminit:latest -o vminit.tar
82+
- name: Save vminit artifact
83+
if: ${{ inputs.release }} != true
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: vminit
87+
path: vminit.tar
88+
- name: Save documentation artifact
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: api-docs
92+
path: "./_site.tgz"
93+
retention-days: 14
94+
uploadPages:
95+
# Separate upload step required because upload-pages-artifact needs
96+
# gtar which is not on the macOS runner.
97+
name: Upload artifact for GitHub Pages
98+
needs: buildAndTest
99+
timeout-minutes: 5
100+
runs-on: ubuntu-latest
101+
102+
steps:
103+
- name: Setup Pages
104+
uses: actions/configure-pages@v5
105+
- name: Download a single artifact
106+
uses: actions/download-artifact@v4
107+
with:
108+
name: api-docs
109+
- name: Add API docs to documentation
110+
run: |
111+
tar xfz _site.tgz
112+
- name: Upload Artifact
113+
uses: actions/upload-pages-artifact@v3
114+
with:
115+
path: "./_site"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Build containerization
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
push:
7+
branches:
8+
- main
9+
- release/*
10+
11+
jobs:
12+
containerization:
13+
permissions:
14+
contents: read
15+
packages: write
16+
pages: write
17+
uses: ./.github/workflows/containerization-build-template.yml
18+
secrets: inherit
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Deploy application website
2+
on:
3+
push:
4+
tags:
5+
- "[0-9]+.[0-9]+.[0-9]+"
6+
permissions:
7+
contents: read
8+
packages: write
9+
pages: write
10+
11+
jobs:
12+
buildSite:
13+
name: Build application website
14+
uses: ./.github/workflows/containerization-build-template.yml
15+
secrets: inherit
16+
17+
deploy:
18+
runs-on: ubuntu-latest
19+
needs: buildSite
20+
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
25+
steps:
26+
- name: Deploy to GitHub Pages
27+
id: deployment
28+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Release containerization
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
8+
jobs:
9+
containerization:
10+
permissions:
11+
contents: read
12+
packages: write
13+
uses: ./.github/workflows/containerization-build-template.yml
14+
with:
15+
release: true
16+
version: ${{ github.ref_name }}
17+
secrets: inherit

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.DS_Store
2+
bin
3+
libexec
4+
.build
5+
.local
6+
xcuserdata/
7+
DerivedData/
8+
.swiftpm/
9+
.netrc
10+
.swiftpm
11+
workdir/
12+
installer/
13+
.xcode/
14+
.vscode/
15+
.venv/
16+
test_results/
17+
*.pid
18+
*.log
19+
*.zip
20+
*.o
21+
*.ext4
22+
*.pkg
23+
*.swp
24+
25+
# API docs for local preview only.
26+
_site/

.swift-format

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"fileScopedDeclarationPrivacy" : {
3+
"accessLevel" : "private"
4+
},
5+
"indentation" : {
6+
"spaces" : 4
7+
},
8+
"indentConditionalCompilationBlocks" : false,
9+
"indentSwitchCaseLabels" : false,
10+
"lineBreakAroundMultilineExpressionChainComponents" : false,
11+
"lineBreakBeforeControlFlowKeywords" : false,
12+
"lineBreakBeforeEachArgument" : false,
13+
"lineBreakBeforeEachGenericRequirement" : false,
14+
"lineLength" : 180,
15+
"maximumBlankLines" : 1,
16+
"multiElementCollectionTrailingCommas" : true,
17+
"noAssignmentInExpressions" : {
18+
"allowedFunctions" : [
19+
"XCTAssertNoThrow"
20+
]
21+
},
22+
"prioritizeKeepingFunctionOutputTogether" : false,
23+
"respectsExistingLineBreaks" : true,
24+
"rules" : {
25+
"AllPublicDeclarationsHaveDocumentation" : false,
26+
"AlwaysUseLowerCamelCase" : true,
27+
"AmbiguousTrailingClosureOverload" : false,
28+
"BeginDocumentationCommentWithOneLineSummary" : false,
29+
"DoNotUseSemicolons" : true,
30+
"DontRepeatTypeInStaticProperties" : true,
31+
"FileScopedDeclarationPrivacy" : true,
32+
"FullyIndirectEnum" : true,
33+
"GroupNumericLiterals" : true,
34+
"IdentifiersMustBeASCII" : true,
35+
"NeverForceUnwrap" : true,
36+
"NeverUseForceTry" : true,
37+
"NeverUseImplicitlyUnwrappedOptionals" : true,
38+
"NoAccessLevelOnExtensionDeclaration" : true,
39+
"NoAssignmentInExpressions" : true,
40+
"NoBlockComments" : false,
41+
"NoCasesWithOnlyFallthrough" : true,
42+
"NoEmptyTrailingClosureParentheses" : true,
43+
"NoLabelsInCasePatterns" : true,
44+
"NoLeadingUnderscores" : false,
45+
"NoParensAroundConditions" : true,
46+
"NoPlaygroundLiterals" : true,
47+
"NoVoidReturnOnFunctionSignature" : true,
48+
"OmitExplicitReturns" : true,
49+
"OneCasePerLine" : true,
50+
"OneVariableDeclarationPerLine" : true,
51+
"OnlyOneTrailingClosureArgument" : true,
52+
"OrderedImports" : true,
53+
"ReplaceForEachWithForLoop" : true,
54+
"ReturnVoidInsteadOfEmptyTuple" : true,
55+
"TypeNamesShouldBeCapitalized" : true,
56+
"UseEarlyExits" : true,
57+
"UseLetInEveryBoundCaseVariable" : true,
58+
"UseShorthandTypeNames" : true,
59+
"UseSingleLinePropertyGetter" : true,
60+
"UseSynthesizedInitializer" : true,
61+
"UseTripleSlashForDocumentationComments" : true,
62+
"UseWhereClausesInForLoops" : false,
63+
"ValidateDocumentationComments" : true
64+
},
65+
"spacesAroundRangeFormationOperators" : false,
66+
"tabWidth" : 2,
67+
"version" : 1
68+
}

.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.1.0

0 commit comments

Comments
 (0)