-
Notifications
You must be signed in to change notification settings - Fork 219
Al2023 CI tests #1637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Al2023 CI tests #1637
Changes from all commits
fe27ee9
fd6616f
8a9fa18
3ae79a7
95a94aa
4a0adf0
c33224f
61f9691
0a308f6
602c423
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: AL2023 RPM Build Tests | ||
|
||
on: | ||
pull_request_target: | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
env: | ||
RUST_BACKTRACE: 1 | ||
CARGO_TERM_COLOR: always | ||
CARGO_INCREMENTAL: 0 | ||
S3_BUCKET_NAME: ${{ vars.S3_BUCKET_NAME }} | ||
S3_REGION: ${{ vars.S3_REGION }} | ||
TEST_PREFIX: "github-actions-tmp/run-${{ github.run_id }}/rpm-test/" | ||
|
||
jobs: | ||
al2023-package-test: | ||
name: Amazon Linux 2023 RPM Build and Test | ||
runs-on: ubuntu-latest | ||
container: | ||
image: amazonlinux:2023 | ||
options: --privileged | ||
|
||
steps: | ||
- name: Install build tools and dependencies | ||
run: | | ||
dnf -y install git rpm-build rpmdevtools make mock ca-certificates rust cargo sudo awscli | ||
cargo install cargo-about | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v6 | ||
|
||
- name: Preventing container PAM sudo errors | ||
run: | | ||
# https://github.com/geerlingguy/docker-rockylinux9-ansible/issues/6 | ||
chmod 0400 /etc/shadow | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v5 | ||
with: | ||
role-to-assume: ${{ vars.ACTIONS_IAM_ROLE }} | ||
aws-region: ${{ vars.S3_REGION }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v5 | ||
with: | ||
submodules: true | ||
persist-credentials: false | ||
|
||
- name: Generate Amazon Linux 2023 spec file | ||
run: | | ||
cd package | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to use |
||
uv run python generate_spec.py amzn2023 && mv amzn2023.spec ../ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to move the output file rather than including an argument for where to write it in the first place? |
||
echo "## Generated Amazon Linux 2023 Spec File" >> $GITHUB_STEP_SUMMARY | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way of doing a multi-line echo? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @muddyfish There are 3 ways of doing that, im not sure which one you meant? 1. Heredoccat << 'EOF' >> $GITHUB_STEP_SUMMARY
## Generated Amazon Linux 2023 Spec File
```spec
EOF
cat ../amzn2023.spec >> $GITHUB_STEP_SUMMARY
cat << 'EOF' >> $GITHUB_STEP_SUMMARY
```
EOF 2. Multiline echoecho -e "## Generated Amazon Linux 2023 Spec File\n\n\`\`\`spec" >> $GITHUB_STEP_SUMMARY
cat ../amzn2023.spec >> $GITHUB_STEP_SUMMARY
echo -e "\n\`\`\`" >> $GITHUB_STEP_SUMMARY 3. Command grouping{
echo "## Generated Amazon Linux 2023 Spec File"
echo ""
echo '```spec'
cat ../amzn2023.spec
echo ""
echo '```'
} >> $GITHUB_STEP_SUMMARY There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we do something like |
||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo '```spec' >> $GITHUB_STEP_SUMMARY | ||
cat ../amzn2023.spec >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
|
||
- name: Build source tarball and SRPM | ||
run: | | ||
VERSION=$(awk '/^Version:/ {print $2}' amzn2023.spec) | ||
cargo vendor | ||
cargo about generate --config package/attribution.toml --output-file THIRD_PARTY_LICENSES package/attribution.hbs | ||
rpmdev-setuptree | ||
|
||
cp amzn2023.spec ~/rpmbuild/SPECS/ | ||
cp LICENSE NOTICE THIRD_PARTY_LICENSES ~/rpmbuild/SOURCES | ||
|
||
cd .. | ||
tar -czf "mountpoint-s3-${VERSION}.tar.gz" mountpoint-s3 | ||
cp "mountpoint-s3-${VERSION}.tar.gz" ~/rpmbuild/SOURCES/ | ||
rpmbuild -bs ~/rpmbuild/SPECS/amzn2023.spec | ||
echo "VERSION=${VERSION}" >> "$GITHUB_ENV" | ||
|
||
- name: Test RPM build with Mock in Amazon Linux 2023 chroot | ||
run: | | ||
sudo mock -r amazonlinux-2023-x86_64 --rebuild ~/rpmbuild/SRPMS/mount-s3-${VERSION}-amzn2023.src.rpm | ||
muddyfish marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Test RPM installation | ||
run: | | ||
dnf -y install /var/lib/mock/amazonlinux-2023-x86_64/result/mount-s3-${VERSION}-amzn2023.x86_64.rpm | ||
which mount-s3 | ||
mount-s3 --version | ||
mount-s3 --help | ||
|
||
- name: Basic Functionality Tests | ||
run: | | ||
mkdir -p /mnt/s3-test | ||
|
||
# Read Test | ||
echo "Hello from RPM test" | aws s3 cp - "s3://${S3_BUCKET_NAME}/${TEST_PREFIX}test.txt" | ||
mount-s3 "${S3_BUCKET_NAME}" /mnt/s3-test --prefix="${TEST_PREFIX}" --region="${S3_REGION}" | ||
cat /mnt/s3-test/test.txt | grep -q "Hello from RPM test" | ||
|
||
# Write Test | ||
echo "Hello from RPM write test" > /mnt/s3-test/write-test.txt | ||
aws s3 cp "s3://${S3_BUCKET_NAME}/${TEST_PREFIX}write-test.txt" - | grep -q "Hello from RPM write test" | ||
|
||
sudo umount /mnt/s3-test | ||
|
||
- name: Cleanup test resources | ||
if: always() | ||
run: | | ||
aws s3 rm "s3://${S3_BUCKET_NAME}/${TEST_PREFIX}test.txt" | ||
aws s3 rm "s3://${S3_BUCKET_NAME}/${TEST_PREFIX}write-test.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you push another rev, can you bump this to V7?
rel: #1649