generated from AgnostiqHQ/covalent-executor-template
-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (119 loc) · 4.43 KB
/
tests.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
# Copyright 2021 Agnostiq Inc.
#
# This file is part of Covalent.
#
# Licensed under the Apache License 2.0 (the "License"). A copy of the
# License may be obtained with this software package or at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Use of this file is prohibited except in compliance with the License.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: tests
on:
pull_request:
workflow_run:
workflows: [changelog]
types: [completed]
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
container:
- python:3.8-buster
- python:3.8-bullseye
- python:3.9-buster
- python:3.9-bullseye
- python:3.10-buster
- python:3.10-bullseye
- image: "centos/python-38-centos7"
options: "--user root"
experimental: [false]
include:
- os: macos-latest
python-version: "3.8"
experimental: false
- os: macos-latest
python-version: "3.9"
experimental: false
- os: macos-latest
python-version: "3.10"
experimental: false
container: ${{ matrix.container }}
continue-on-error: ${{ matrix.experimental }}
outputs:
release: ${{ steps.push.outputs.release }}
steps:
- name: Update git version
if: matrix.container.image == 'centos/python-38-centos7'
run: |
yum remove -y git git-*
yum install -y https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
yum install -y git
- name: Check out head
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Set up Python
if: matrix.os == 'macos-latest'
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
pip install --no-cache-dir -r tests/requirements.txt
- name: Build distribution
run: python setup.py sdist
- name: Validate plugin
run: |
VERSION="$(cat ./VERSION)"
cd dist
tar xzf covalent-ec2-plugin-${VERSION}.tar.gz
diff -r covalent-ec2-plugin-${VERSION}/covalent_ec2_plugin/ ../covalent_ec2_plugin/
rm -rf covalent-ec2-plugin-${VERSION}/
cd ..
- name: Install EC2 plugin
run: |
VERSION="$(cat ./VERSION)"
pip install ./dist/covalent-ec2-plugin-${VERSION}.tar.gz
- name: Run tests
run: PYTHONPATH=$PWD/tests pytest -m "not functional_tests" -vv tests/ --ignore=./tests/unit_tests/infra_test.py
- name: Get latest release
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
if: github.ref == 'refs/heads/develop' && matrix.os == 'ubuntu-latest' && matrix.container == 'python:3.8-buster'
with:
semver_only: true
- name: Push to main
id: push
if: github.ref == 'refs/heads/develop' && matrix.os == 'ubuntu-latest' && matrix.container == 'python:3.8-buster'
run: |
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."
else
git config --global --add safe.directory $PWD
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-ec2-plugin.git
git push origin HEAD:main
release=true
fi
echo "RELEASE=$release" >> $GITHUB_ENV
echo "::set-output name=release::$release"
release:
needs: tests
if: github.ref == 'refs/heads/develop' && needs.tests.outputs.release == 'true'
uses: AgnostiqHQ/covalent-ec2-plugin/.github/workflows/release.yml@develop
secrets: inherit
with:
prerelease: true