Skip to content

Test

Test #273

Workflow file for this run

name: Test
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
schedule:
- cron: '0 15 * * 5'
jobs:
test:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
sudo apt-get update -qq
sudo apt-get install -y tftp-hpa asciidoctor
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build
run: |
make
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::665474295387:role/gha-s3tftpd
aws-region: us-east-2
- name: Unit test
run: |
make test
- name: Integration test
run: |
bundle exec rspec
env:
TEST_BUCKET_NAME: hanazuki-s3tftpd-test
docker:
needs:
- test
runs-on: ubuntu-latest
steps:
- id: config
shell: bash
run: |
push=false
tags=
if [[ $GITHUB_EVENT_NAME == push ]]; then
if [[ $GITHUB_REF == refs/heads/master ]]; then
push=true
tags=ghcr.io/${GITHUB_REPOSITORY}:testing
elif [[ $GITHUB_REF == refs/tags/v* ]]; then
push=true
tags="ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_REF#refs/tags/v}"$'\n'"ghcr.io/${GITHUB_REPOSITORY}:latest"
fi
fi
cat <<EOF >>$GITHUB_OUTPUT
push=$push
tags<<TAGS
$tags
TAGS
EOF
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- uses: docker/build-push-action@v3
with:
push: ${{ steps.config.outputs.push }}
tags: ${{ steps.config.outputs.tags }}
platforms: linux/amd64,linux/arm64
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max