Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Fix: use SAR #15

Merged
merged 21 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[net]
git-fetch-with-cli = true
72 changes: 72 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Release

on:
pull_request:
branches:
- main
types:
- closed

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
Deploy:
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/')
runs-on: ubuntu-latest
environment: Production
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2

- name: Setup Cargo Lambda
uses: zerj9/[email protected]

- name: Setup Project
run: |
git config --global url."https://${{ secrets.GH_PROJECT_PAT }}@github.com".insteadOf https://github.com

- name: SetVars
run: |
sed -i 's/${AWS::AccountId}/${{ secrets.AWS_ACCOUNT_ID }}/' infra/role/template.yml

- name: AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GitHubDeployBase
role-session-name: ${{ vars.SESSION_NAME }}
aws-region: ${{ vars.AWS_REGION }}

- name: SAM Role
run: cd infra/role && sam build && sam package && sam deploy --no-fail-on-empty-changeset

- name: AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GitHubDeployPublishDataS3
role-session-name: ${{ vars.SESSION_NAME }}
aws-region: ${{ vars.AWS_REGION }}

- name: SAM Stage
run: cd infra/stage && sam build && sam package && sam deploy --no-fail-on-empty-changeset

- name: SAM Publish
run: cd infra/sar && sam build --beta-features && sam package --output-template-file packaged.yaml && sam publish --template packaged.yaml

- name: Get Version
id: version
run: |
export CURRENT_VERSION=$(grep -m 1 'version = "' Cargo.toml | awk -F '"' '{print $2}')
echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT

- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.version.outputs.current }}
53 changes: 53 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Tests

on:
pull_request:
types: [opened, synchronize]
branches:
- main

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
Test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2

- name: Setup Cargo Lambda
uses: zerj9/[email protected]

- name: Setup Project
run: |
git config --global url."https://${{ secrets.GH_PROJECT_PAT }}@github.com".insteadOf https://github.com
rustup default nightly
cargo install cargo2junit

- name: Cargo Test
run: |
cargo test -- -Z unstable-options --format json --report-time | cargo2junit > test-results.xml

- name: Upload Results
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: test-results
path: test-results.xml

- name: Validate SAR Template
run: cd infra/sar && sam validate --lint

- name: Build SAR Template
run: cd infra/sar && sam build --beta-features

- name: Validate Stage Template
run: cd infra/stage && sam validate --lint

- name: Build Stage Template
run: cd infra/stage && sam build
7 changes: 6 additions & 1 deletion .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ jobs:
token: ${{ github.token }}
branch: ${{ steps.getpr.outputs.branch }}

- name: Set Version
- name: Set Cargo Version
run: |
sed -i '3 s/version = *.*.*/version = "${{ steps.semver.outputs.nextStrict }}"/' Cargo.toml

- name: Set SAR Version
run: |
sed -i 's/SemanticVersion: .*/SemanticVersion: ${{ steps.semver.outputs.nextStrict }}/' infra/sar/template.yml

- name: Commit Changes
continue-on-error: true
env:
Expand All @@ -46,6 +50,7 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "GH Action"
git add Cargo.toml
git add infra/sar/template.yml
git commit -m 'version bump'
git push

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ node_modules
.dev.vars

# Test Reports
reports
test-results.xml

# AWS SAM
.aws-sam
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ingest-s3"
version = "0.0.1"
name = "publish-data-s3"
version = "0.0.2"
edition = "2021"

[dependencies]
Expand All @@ -19,10 +19,10 @@ async-compression = { version = "0.4.2", features = ["tokio", "gzip"] }
bytes = "1.5.0"
csv = "1.2.2"
async-trait = "0.1.73"
tiki-private-ingest = { git = "https://github.com/tiki/private", tag = "ingest/0.4.0", features = ["dummy"] }
tiki-private-ingest = { git = "https://github.com/tiki/private", tag = "ingest/0.5.1", features = ["dummy"] }
futures = "0.3.28"
uuid = { version = "1.4.1", features = ["v4"] }
parquet = { version = "46.0.0", features = [] }
parquet = { version = "47.0.0", features = [] }

[dev-dependencies]
tokio-test = "0.4.3"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
🫵
54 changes: 0 additions & 54 deletions infra/github/policy.yml

This file was deleted.

67 changes: 0 additions & 67 deletions infra/github/role.yml

This file was deleted.

26 changes: 0 additions & 26 deletions infra/github/template.yml

This file was deleted.

Loading