-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (87 loc) · 2.78 KB
/
Copy pathci.yml
File metadata and controls
90 lines (87 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: CI
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
# Dispatched by unravel-router's bump workflow, which tests the CLI against
# staging before every aperiodic.io release.
workflow_dispatch:
inputs:
base_url:
description: 'API base URL to test against (empty: production)'
required: false
default: ''
jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24'
# A missing staging secret would fall back to production or fail every
# request at Cloudflare Access; say which one instead.
- name: Require the staging secrets
if: inputs.base_url
shell: bash
env:
APERIODIC_STAGING_API_KEY: ${{ secrets.APERIODIC_STAGING_API_KEY }}
CF_ACCESS_CLIENT_ID: ${{ secrets.CF_ACCESS_CLIENT_ID }}
CF_ACCESS_CLIENT_SECRET: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}
run: |
missing=0
for name in APERIODIC_STAGING_API_KEY CF_ACCESS_CLIENT_ID CF_ACCESS_CLIENT_SECRET; do
if [ -z "${!name}" ]; then
echo "::error::The $name secret is not set"
missing=1
fi
done
exit $missing
- name: Test
env:
# Push and PR runs test production. A dispatch with a base_url tests
# that API (staging) with its key. Either key must be on Prime + Raw.
APERIODIC_API_KEY: ${{ inputs.base_url && secrets.APERIODIC_STAGING_API_KEY || secrets.APERIODIC_API_KEY }}
APERIODIC_API_URL: ${{ inputs.base_url || '' }}
CF_ACCESS_CLIENT_ID: ${{ secrets.CF_ACCESS_CLIENT_ID }}
CF_ACCESS_CLIENT_SECRET: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}
run: go test -v ./...
build:
name: Build
runs-on: ubuntu-latest
needs: test
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
strategy:
matrix:
os: [linux, darwin, windows]
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24'
- name: Build
run: |
GOOS=${{ matrix.os }}
GOARCH=${{ matrix.arch }}
BINARY_NAME=aperiodic
if [ "$GOOS" = "windows" ]; then BINARY_NAME=aperiodic.exe; fi
mkdir -p dist
GOARCH=$GOARCH GOOS=$GOOS go build -o dist/aperiodic-$GOOS-$GOARCH${BINARY_NAME#aperiodic} ./cmd/aperiodic
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: aperiodic-${{ matrix.os }}-${{ matrix.arch }}
path: dist/