Skip to content

Commit

Permalink
Implement integration CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Nov 1, 2023
1 parent 1e0db02 commit 36cb4b3
Showing 1 changed file with 51 additions and 44 deletions.
95 changes: 51 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# permissions:
env:
LOCK_NAME: ci.yml-integration # {workflow}-{job}, maybe a default?
S3_BUCKET: aws-s3-lock-ci

jobs:
build:
Expand All @@ -24,50 +26,55 @@ jobs:
- run: yarn build
- run: yarn test --passWithNoTests

# integration:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-region: ${{ vars.AWS_REGION }}
# role-to-assume: ${{ secrets.AWS_ROLE }}
integration:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}

# - id: lock-1
# name: Acquire for 10s
# uses: ./
# with:
# name: workflows-ci-integration
# expires: 10s
- id: lock-1
name: Acquire for 10s
uses: ./
with:
name: ${{ env.LOCK_NAME }}
s3-bucket: ${{ env.S3_BUCKET }}
expires: 5s

# - id: lock-2
# name: Wait on lock-1 then acquire
# uses: ./
# with:
# name: workflows-ci-integration
# timeout: 15s
# expires: 5s
- id: lock-2
name: Wait on lock-1 then acquire
uses: ./
with:
name: ${{ env.LOCK_NAME }}
s3-bucket: ${{ env.S3_BUCKET }}
timeout: 10s

# - name: Verify locks
# run: |
# cat <<'EOM'
# lock-1 acquired ${{ lock-1.outputs.acquired-at }}
# lock-1 released ${{ lock-1.outputs.released-at }}
# lock-2 acquired ${{ lock-2.outputs.acquired-at }}
# lock-2 released ${{ lock-2.outputs.released-at }}
# EOM
- name: Verify locks
run: |
[[ -n '${{ lock-1.outputs.acquired-at }}' ]] # lock-1
[[ -n '${{ lock-2.outputs.acquired-at }}' ]] # lock-2
# lock-2 acquired at should be +5s
# integration-post:
# needs: integration
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-region: ${{ vars.AWS_REGION }}
# role-to-assume: ${{ secrets.AWS_ROLE }}
# - name: Assert lock was released
# uses: ./
# with:
# name: workflows-ci-integration
# timeout: 0s
integration-post:
needs: integration
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}
- name: Assert lock was released
uses: ./
with:
name: ${{ env.LOCK_NAME }}
s3-bucket: ${{ env.S3_BUCKET }}
timeout: 0s

0 comments on commit 36cb4b3

Please sign in to comment.