-
Notifications
You must be signed in to change notification settings - Fork 97
147 lines (133 loc) · 4.61 KB
/
nightly.yml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Copyright 2021 Agnostiq Inc.
#
# This file is part of Covalent.
#
# Licensed under the GNU Affero General Public License 3.0 (the "License").
# A copy of the License may be obtained with this software package or at
#
# https://www.gnu.org/licenses/agpl-3.0.en.html
#
# Use of this file is prohibited except in compliance with the License. Any
# modifications or derivative works of this file must retain this copyright
# notice, and modified files must contain a notice indicating that they have
# been altered from the originals.
#
# Covalent is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
#
# Relief from the License may be granted by purchasing a commercial license.
name: nightly
on:
schedule:
- cron: "0 */4 * * *"
jobs:
license:
name: License Scanner
uses: AgnostiqHQ/covalent/.github/workflows/license.yml@develop
tests:
name: Unit and Functional Tests
uses: AgnostiqHQ/covalent/.github/workflows/tests.yml@develop
secrets: inherit # pragma: allowlist secret
changelog:
name: Assign Version
needs:
- license
- tests
uses: AgnostiqHQ/covalent/.github/workflows/changelog.yml@develop
secrets: inherit # pragma: allowlist secret
push_to_master:
name: Push to Master
runs-on: ubuntu-latest
needs: changelog
outputs:
release: ${{ steps.push.outputs.release }}
steps:
- name: Get latest release
id: query-tags
uses: octokit/[email protected]
with:
route: GET /repos/AgnostiqHQ/covalent/tags
env:
GITHUB_TOKEN: ${{ secrets.COVALENT_OPS_BOT_TOKEN }}
- name: Parse latest tag
id: get-latest-tag
run: |
# This assumes that the response from the API is sorted in decreasing order (thus the first element is the latest tag)
latest_tag=${{ fromJSON(steps.query-tags.outputs.data)[0].name }}
echo "::set-output name=tag::${latest_tag}"
- name: Checkout default branch
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Push to master
id: push
run: |
CHANGELOG_VERSION="${{ needs.changelog.outputs.version }}"
MASTER_VERSION="$(echo ${{ steps.get-latest-tag.outputs.tag }} | cut -c2- )"
VERSION="$(cat ./VERSION)"
release=false
if [ "$MASTER_VERSION" = "$VERSION" ] ; then
echo "$VERSION has been previously released."
elif dpkg --compare-versions $VERSION 'gt' '0.177.0' ; then
git config user.name "CovalentOpsBot"
git config user.email "[email protected]"
git remote set-url origin https://${{ secrets.COVALENT_OPS_BOT_TOKEN }}@github.com/AgnostiqHQ/covalent.git
git push origin HEAD:master
release=true
else
echo "We cannot release versions less than 0.177.0."
fi
echo "::set-output name=release::$release"
release:
name: Create Release
needs: push_to_master
if: needs.push_to_master.outputs.release == 'true'
uses: AgnostiqHQ/covalent/.github/workflows/release.yml@develop
with:
prerelease: true
secrets: inherit # pragma: allowlist secret
notify:
name: Notify Slack
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v3
with:
ref: "master"
- name: Format Slack message
run: |
VERSION="$(cat ./VERSION)"
SLACK_MSG=":rocket: Version $VERSION is now available."
echo "SLACK_MSG=$SLACK_MSG" >> $GITHUB_ENV
- name: Notify Slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: "covalent-ci"
SLACK_USERNAME: "CovalentOpsBot"
SLACK_MESSAGE: ${{ env.SLACK_MSG }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
executor_base_images:
name: Build Executor base images
runs-on: ubuntu-latest
needs: release
strategy:
matrix:
repo:
[
"AgnostiqHQ/covalent-aws-plugins",
"AgnostiqHQ/covalent-awslambda-plugin",
"AgnostiqHQ/covalent-braket-plugin",
]
permissions:
id-token: write
contents: read
steps:
- name: Build executor_base_images
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.COVALENT_OPS_BOT_TOKEN }}
repo: ${{ matrix.repo }}
event-type: "prerelease"