Update runs swift.yml #9
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
# This workflow will build a Swift project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift | |
name: Swift | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Download and Install Latest Swift Snapshot | |
run: | | |
# Fetch the latest snapshot URL for Ubuntu 22.04 | |
SNAPSHOT_URL=$(curl -s https://www.swift.org/builds/development/ubuntu2204/latest-build.yml \ | |
| grep 'download:' | grep 'ubuntu22.04' | awk '{print $2}') | |
# Download the snapshot | |
wget $SNAPSHOT_URL -O swift-latest.tar.gz | |
# Extract and install Swift | |
tar xzf swift-latest.tar.gz | |
sudo mv swift-*-ubuntu22.04 /usr/local/swift | |
echo "export PATH=/usr/local/swift/usr/bin:$PATH" >> $GITHUB_ENV | |
- name: Verify Swift version | |
run: swift --version | |
- name: Build project | |
run: swift build | |
- name: Run tests | |
run: swift test |