turnstile, etc. #258
Workflow file for this run
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: basic-ci | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
linux-build-libs-1: | |
runs-on: ubuntu-latest | |
container: swift:5.10-focal | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: build-duet | |
run: cd duet && swift build | |
- name: build-pairql | |
run: cd pairql && swift build | |
- name: build-pairql-macapp | |
run: cd pairql-macapp && swift build | |
linux-build-libs-2: | |
runs-on: ubuntu-latest | |
container: swift:5.10-focal | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: build-gertie | |
run: cd gertie && swift build | |
- name: build-ts-interop | |
run: cd ts-interop && swift build | |
- name: build-x-expect | |
run: cd x-expect && swift build | |
- name: build-x-http | |
run: cd x-http && swift build | |
- name: build-x-kit | |
run: cd x-kit && swift build | |
- name: build-x-postmark | |
run: cd x-postmark && swift build | |
- name: build-x-sendgrid | |
run: cd x-sendgrid && swift build | |
- name: build-x-slack | |
run: cd x-slack && swift build | |
- name: build-x-stripe | |
run: cd x-stripe && swift build | |
linux-lib-test-libs-1: | |
runs-on: ubuntu-latest | |
container: swift:5.10-focal | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: test-duet | |
run: cd duet && swift test | |
- name: test-pairql | |
run: cd pairql && swift test | |
linux-lib-test-libs-2: | |
runs-on: ubuntu-latest | |
container: swift:5.10-focal | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: test-pairql-macapp | |
run: cd pairql-macapp && swift test | |
- name: test-ts-interop | |
run: cd ts-interop && swift test | |
- name: test-gertie | |
run: cd gertie && swift test | |
- name: test-x-http | |
run: cd x-http && swift test | |
- name: test-x-kit | |
run: cd x-kit && swift test | |
- name: test-x-slack | |
run: cd x-slack && swift test | |
linux-api-build: | |
runs-on: ubuntu-latest | |
container: swift:5.10-focal | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: api/.build | |
key: api-${{ hashFiles('api/Package.resolved') }} | |
restore-keys: api- | |
- name: meta | |
id: meta | |
uses: friends-library/dev/actions/ts-pack/actions/meta@master | |
with: | |
github_token: ${{ github.token }} | |
- name: set-env-vars | |
run: | | |
DATESTR=$(TZ=America/New_York date +'%Y.%m.%d_%H.%M') | |
SHORTSHA=${{ steps.meta.outputs.latest_commit_sha_short }} | |
if [ "${{ github.ref }}" = "refs/heads/master" ]; then | |
API_ENV=production | |
echo "SRCDIR=api/.build/release" >> $GITHUB_ENV | |
echo "DESTDIR=builds/production" >> $GITHUB_ENV | |
echo "CONFIGURATION=release" >> $GITHUB_ENV | |
else | |
API_ENV=staging | |
echo "SRCDIR=api/.build/debug" >> $GITHUB_ENV | |
echo "DESTDIR=builds/staging" >> $GITHUB_ENV | |
echo "CONFIGURATION=debug" >> $GITHUB_ENV | |
fi | |
echo "FILENAME=api_${API_ENV}_${DATESTR}_${SHORTSHA}" >> $GITHUB_ENV | |
- name: build-api | |
run: | | |
cd api && swift build --static-swift-stdlib -c $CONFIGURATION | |
cd ../ && cp ${SRCDIR}/Run ${FILENAME} | |
- name: scp-bin | |
uses: appleboy/[email protected] | |
with: | |
host: api.gertrude.app | |
username: ${{ secrets.API_SERVER_SSH_USER }} | |
key: ${{ secrets.API_SERVER_SSH_KEY }} | |
source: '${{ env.FILENAME }}' | |
target: '${{ env.DESTDIR }}' | |
- name: ssh-tasks | |
uses: appleboy/[email protected] | |
with: | |
host: api.gertrude.app | |
username: ${{ secrets.API_SERVER_SSH_USER }} | |
key: ${{ secrets.API_SERVER_SSH_KEY }} | |
envs: DESTDIR,FILENAME | |
script: | | |
ln -sf "./${FILENAME}" "${DESTDIR}/latest" | |
chmod +x "${DESTDIR}/${FILENAME}" "${DESTDIR}/latest" | |
cd ~/builds/production && ls -r api_* | grep -v $(basename $(readlink -f current)) | tail -n +11 | xargs rm | |
cd ~/builds/staging && ls -r api_* | tail -n +6 | xargs rm | |
pm2 restart staging > /dev/null | |
linux-api-test: | |
runs-on: ubuntu-latest | |
container: swift:5.10-focal | |
env: | |
DATABASE_HOST: postgres | |
AUTO_INCLUDED_KEYCHAIN_ID: 77777777-7777-7777-7777-777777777777 | |
SLACK_API_TOKEN: not-real | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: vapor_username | |
POSTGRES_PASSWORD: vapor_password | |
POSTGRES_DB: vapor_database | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
# only restore, job:linux-api-build will save, to save execution time | |
- uses: actions/cache/restore@v4 | |
with: | |
path: api/.build | |
key: api-${{ hashFiles('api/Package.resolved') }} | |
restore-keys: api- | |
- name: test-api | |
run: cd api && swift test | |
files-changed: | |
runs-on: ubuntu-latest | |
outputs: | |
macapplib: ${{ steps.changes.outputs.macapplib }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
macapplib: | |
- macapp/App/** | |
macapp-lib: | |
needs: files-changed | |
if: needs.files-changed.outputs.macapplib == 'true' | |
runs-on: macos-14 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: setup xcode | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: 15.3.0 | |
- uses: actions/cache@v4 | |
with: | |
path: macapp/App/.build | |
key: macapp-spm--${{ hashFiles('macapp/App/Package.resolved') }} | |
restore-keys: macapp-spm-- | |
- name: build | |
run: cd macapp/App && swift build | |
- name: test | |
run: cd macapp/App && swift test | |
# env | |
env: | |
DATABASE_NAME: vapor_database | |
DATABASE_USERNAME: vapor_username | |
DATABASE_PASSWORD: vapor_password | |
TEST_DATABASE_NAME: vapor_database | |
CLOUD_STORAGE_KEY: not-real | |
CLOUD_STORAGE_SECRET: not-real | |
CLOUD_STORAGE_ENDPOINT: not-real | |
CLOUD_STORAGE_BUCKET: not-real | |
CLOUD_STORAGE_BUCKET_URL: /not-real | |
TWILIO_ACCOUNT_SID: not-real | |
TWILIO_AUTH_TOKEN: not-real | |
TWILIO_FROM_PHONE: not-real | |
DASHBOARD_URL: /dashboard | |
ANALYTICS_SITE_URL: /analytics | |
SENDGRID_API_KEY: not-real | |
POSTMARK_API_KEY: not-real | |
PRIMARY_SUPPORT_EMAIL: not-real | |
SUPER_ADMIN_EMAIL: not-real | |
STRIPE_SUBSCRIPTION_PRICE_ID: not-real | |
STRIPE_SECRET_KEY: not-real | |
SWIFT_DETERMINISTIC_HASHING: 1 |