Repository navigation
105 lines (95 loc) · 3.37 KB
/
Copy pathrelease.yml
File metadata and controls
105 lines (95 loc) · 3.37 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: 0.6.11
on:
push:
tags: [ '*' ]
workflow_dispatch:
inputs:
ref:
description: Required ref; must be an existing bare SemVer tag (or refs/tags/ tag)
required: true
type: string
permissions:
contents: read
jobs:
release:
name: Release / OTP ${{ matrix.otp }}
runs-on: ubuntu-latest
container: erlang:${{ matrix.otp }}
env:
DEBUG: 1
ASTRANAUT_TRACE: 1
strategy:
fail-fast: false
matrix:
otp: ['29', '28', '27', '26', '25', '24', '23', '22', '21']
steps:
- name: Checkout (act local copy)
if: env.ACT == 'true'
uses: actions/checkout@v7
- name: Checkout (remote ref)
if: env.ACT != 'true'
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref || github.ref }}
- name: Validate SemVer release ref
env:
RELEASE_REF: ${{ inputs.ref || github.ref_name }}
run: |
set -eu
tag="${RELEASE_REF#refs/tags/}"
export RELEASE_TAG="$tag"
erl -noshell -eval '
Tag = os:getenv("RELEASE_TAG"),
Pattern = "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$",
case re:run(Tag, Pattern, [{capture, none}]) of
match -> io:format("Valid SemVer release ref: ~s~n", [Tag]);
nomatch ->
io:format(standard_error, "Invalid SemVer release ref: ~s~n", [Tag]),
halt(1)
end,
halt().
'
- name: Assert release dependency configuration
run: |
set -eu
test -z "${DEPS_MODE:-}"
erl -noshell -eval '
{ok, Config} = file:consult("rebar.config"),
{deps, Deps} = lists:keyfind(deps, 1, Config),
3 = length(Deps),
true = lists:all(
fun({_Name, {git, _Url, {tag, Tag}}})
when is_list(Tag), Tag =/= [] -> true;
(_) -> false
end,
Deps),
{project_plugins, Plugins} = lists:keyfind(project_plugins, 1, Config),
{rebar3_docker_ci, {git, _PluginUrl, {tag, PluginTag}}} =
lists:keyfind(rebar3_docker_ci, 1, Plugins),
true = is_list(PluginTag),
false = lists:any(
fun({_Name, {git, _Url, {branch, _Branch}}}) -> true;
(_) -> false
end,
Deps ++ Plugins),
io:format("release config has three Git-tag runtime deps and a Git-tag docker_ci plugin~n"),
halt().
'
- name: Verify cold checkout (no cache or tracked lock)
run: |
set -eu
# actions/checkout gives each job a fresh workspace; this workflow
# has no cache and rebar.lock is not tracked, so resolution is cold.
if [ -e _checkouts ]; then
echo '_checkouts must not exist in a cold CI workspace' >&2
exit 1
fi
- name: Dependency tree
run: |
set -eu
rebar3 tree -v | tee /tmp/async-release-tree.txt
! grep -E '(^|[[:space:]])(astranaut|erlando|lenses)[^[:cntrl:]]*master' /tmp/async-release-tree.txt
- name: Compile
run: rebar3 compile -v
- name: Common Test
run: rebar3 as test clean -a && rebar3 ct