Build #250
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: ['*', '!main'] | |
pull_request: | |
workflow_dispatch: | |
workflow_call: | |
secrets: | |
ALPINE_KEY: | |
required: true | |
schedule: | |
- cron: "0 6 * * 6" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [macos-13, ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
- run: make | |
- run: make test COVERAGE=1 | |
- run: make smoke-test-encrypt | |
- run: make lint | |
# We don't have swift-format on Linux yet | |
if: runner.os == 'macOS' | |
# Packaging | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.22.0' | |
if: runner.os == 'macOS' | |
- name: Package | |
run: make package | |
if: runner.os != 'Windows' | |
- name: Package (Alpine) | |
run: | | |
echo "$ALPINE_KEY" > Scripts/alpine/[email protected] | |
make package-linux | |
env: | |
TOOLCHAINS: swift | |
ALPINE_KEY: ${{ secrets.ALPINE_KEY }} | |
if: runner.os == 'macOS' | |
- name: Upload packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages-${{matrix.os}} | |
path: | | |
.build/age-plugin-se-*.tgz | |
.build/age-plugin-se-*.zip | |
.build/age-plugin-se-*.apk | |
include-hidden-files: true | |
# Build & upload site artifacts | |
# Deploy happens in the `build-main` workflow, which only runs on main | |
- name: Package site artifacts | |
run: | | |
mkdir -p .build/site/ci | |
cp .build/coverage.svg .build/coverage.html .build/site/ci | |
shell: bash | |
- name: Upload site artifacts | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: .build/site | |
if: runner.os == 'macOS' | |
# Running swift from the Makefile doesn't work (yet), so we have a separate | |
# build procedure for windows. | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
- run: swift build | |
# Unit tests don't seem to work yet | |
# - run: swift test | |
- name: Run smoke test | |
run: | | |
$Env:Path += ";" + (swift build --show-bin-path) | |
echo "test" | age --encrypt --recipient age1se1qgg72x2qfk9wg3wh0qg9u0v7l5dkq4jx69fv80p6wdus3ftg6flwg5dz2dp -o secret.txt.age | |
# Packaging | |
- name: Package (Windows) | |
run: | | |
$VERSION = Select-String -Path "Sources/CLI.Swift" -Pattern "^let version" | % {$_ -replace '.*"v(.*)"', "`$1" } | |
swift build -c release --static-swift-stdlib | |
$BINPATH = swift build -c release --static-swift-stdlib --show-bin-path | |
$ARCH = $Env:PROCESSOR_ARCHITECTURE.ToLower() | |
7z a -tzip ".build\age-plugin-se-v${VERSION}-${ARCH}-windows.zip" "$BINPATH\age-plugin-se.exe" | |
if: runner.os == 'Windows' | |
- name: Upload packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages-windows-latest | |
path: .build/age-plugin-se-*.zip | |
include-hidden-files: true |