-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (55 loc) · 2 KB
/
test.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
name: test
on:
# Schedule approximately fortnightly test runs.
schedule:
- cron: "0 0 1,15 * *"
# Allow workflow to be run manually.
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
# Allows JWT to be requested from GitHub's OIDC provider.
id-token: write
steps:
- uses: actions/checkout@v4
- id: cache
uses: actions/cache@v4
with:
# Use contents of Mamba environment file, NPM lock file and Poetry lock file as cache key.
key: ${{ hashFiles('environment.yml', 'package-lock.json', 'poetry.lock') }}
# Cache micromamba binary, environments, and pipx installs.
path: |
./bin/micromamba
~/micromamba/envs
~/.local/pipx
# Assume role to read/write AWS parameter.
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::961672313229:role/Account-GithubOidcRole20798CD3-LZP3AHTIPJU2
aws-region: ap-southeast-2
- if: steps.cache.outputs.cache-hit != 'true'
run: |
# Install micromamba.
wget -qO- https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
./bin/micromamba shell hook > ~/.bashrc
# Install Poetry.
pipx install poetry~=1.8
# Create Mamba environment.
export MAMBA_ROOT_PREFIX=~/micromamba
eval "$(./bin/micromamba shell hook -s posix)"
micromamba create --file environment.yml --yes
micromamba activate portfolio
# Install Python package dependencies.
poetry install
- run: |
export MAMBA_ROOT_PREFIX=~/micromamba
eval "$(./bin/micromamba shell hook -s posix)"
micromamba activate portfolio
# Unlock git-crypt.
echo $GIT_CRYPT_KEY | base64 -d | git-crypt unlock -
# Test
pytest tests
env:
GIT_CRYPT_KEY: ${{ secrets.GIT_CRYPT_KEY }}