Prepared for the Iowa Technology Summit 2023
- Install git, python 3.9
- Install Visual Studio Code
- Install these Extensions:
- Python
- COMMAND-SHIFT-P: Python: Create Environment > Venv
- (Creates a
.venv
virtualenvironment in the current workspace) source .venv/bin/activate
- Markdown Preview
- COMMAND-K V: preview side-by-side
- Python
- Install these Extensions:
source .venv/bin/activate
cd project
pip3 install -r requirements.txt
touch .env
echo "ACTITIME_URL=https://demo.actitime.com/api/v1/" >> .env
echo "ACTITIME_USERNAME=admin" >> .env
echo "ACTITIME_PASSWORD=manager" >> .env
Add these GitHub Actions secrets:
ACTITIME_PASSWORD
,ACTITIME_URL
,ACTITIME_USERNAME
,AWS_ROLE
- (
AWS_ROLE
is output from the CloudFormation stack you inPrerequisites
below)
python -m unittest discover -s tests
coverage run -m unittest discover -s tests
coverage report && coverage html && open htmlcov/index.html
python -m unittest discover -s tests -p "test_*"
python -m unittest discover -s tests -p "integration_test_*"
To open a separate preview window, use the keyboard shortcut Ctrl+Shift+V
.
To open side by side, use the keyboard shortcut Ctrl+K V
.
The final steps (Chat 15 and Chat 16 of this project assume you've connected GitHub with your AWS account like shown below and you have replaced SomeTypeOfAccessNeededToCreateABucket
with an appropriate policy of your choice):
AWSTemplateFormatVersion: '2010-09-09'
Description: Connect GitHub to AWS
Parameters:
GitHubOrg:
Type: String
RepositoryName:
Type: String
OIDCProviderArn:
Description: ARN for the GitHub OIDC Provider.
Default: ""
Type: String
Conditions:
CreateOIDCProvider: !Equals
- !Ref OIDCProviderArn
- ""
Resources:
Role:
Type: AWS::IAM::Role
Properties:
RoleName: GitHubActionsRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/SomeTypeOfAccessNeededToCreateABucket
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Action: sts:AssumeRoleWithWebIdentity
Principal:
Federated: !If
- CreateOIDCProvider
- !Ref GithubOidc
- !Ref OIDCProviderArn
Condition:
StringLike:
token.actions.githubusercontent.com:sub: !Sub repo:${GitHubOrg}/iowa-technology-summit-2023:*
token.actions.githubusercontent.com:aud: sts.amazonaws.com
GithubOidc:
Type: AWS::IAM::OIDCProvider
Condition: CreateOIDCProvider
Properties:
Url: https://token.actions.githubusercontent.com
ClientIdList:
- sts.amazonaws.com
ThumbprintList:
- 6938fd4d98bab03faadb97b34396831e3780aea1
Outputs:
Role:
Value: !GetAtt Role.Arn