Merge pull request #20 from miguelaferreira/dependabot/github_actions… #124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Continuous Integration" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: "Build code" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout sources" | |
uses: actions/checkout@v2 | |
- name: "Cache dependencies" | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle | |
${GITHUB_WORKSPACE}/.gradle | |
~/.cache/pip/ | |
key: ${{ runner.os }}-devex-development-java16-graal-21.3.0-r17 | |
- name: "Install GraalVM" | |
uses: DeLaGuardo/[email protected] | |
with: | |
graalvm: '21.3.0' | |
java: 'java17' | |
arch: 'amd64' | |
- name: "Install native-image" | |
run: | | |
gu install native-image | |
- name: "Install Terraform" | |
uses: autero1/[email protected] | |
with: | |
terraform_version: 1.0.8 | |
- name: "Setup SSH" | |
run: | | |
mkdir -p ~/.ssh | |
cat .github/files/known_hosts > ~/.ssh/known_hosts | |
echo "${bot_devex_ssh_private_key_rsa}" > ~/.ssh/id_rsa | |
echo "${bot_devex_ssh_private_key_ed25519}" > ~/.ssh/id_ed25519 | |
cat << EOF > ~/.ssh/config | |
Host gitlab.com | |
IdentityFile ~/.ssh/id_ed25519 | |
Host github.com | |
IdentityFile ~/.ssh/id_rsa | |
EOF | |
chmod -R 500 ~/.ssh | |
env: | |
bot_devex_ssh_private_key_rsa: ${{ secrets.BOT_DEVEX_SSH_PRIVATE_KEY_RSA }} | |
bot_devex_ssh_private_key_ed25519: ${{ secrets.BOT_DEVEX_SSH_PRIVATE_KEY_ED25519 }} | |
- name: "Gradle build" | |
run: ./gradlew build | |
env: | |
GITLAB_TOKEN: ${{ secrets.BOT_GITLAB_TOKEN_READ_API }} | |
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN_READ_ORG_AND_REPO }} | |
- name: "Upload Test Reports" | |
uses: actions/[email protected] | |
if: failure() | |
with: | |
name: test-reports | |
path: build/reports/tests | |
retention-days: 5 | |
- name: "Publish Unit Test Results" | |
uses: EnricoMi/publish-unit-test-result-action/composite@v1 | |
if: always() | |
with: | |
files: build/test-results/test/*.xml | |
- name: "Create native-image build config" | |
run: | | |
.github/scripts/create-native-image-build-config.sh | |
.github/scripts/merge-native-image-build-config.sh linux | |
env: | |
GITLAB_TOKEN: ${{ secrets.BOT_GITLAB_TOKEN_READ_API }} | |
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN_READ_ORG_AND_REPO }} | |
- name: "Gradle nativeImage" | |
run: ./gradlew nativeImage | |
env: | |
GITLAB_TOKEN: ${{ secrets.BOT_GITLAB_TOKEN_READ_API }} | |
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN_READ_ORG_AND_REPO }} | |
- name: "Run and test native binary" | |
run: .github/scripts/run-native-binary.sh | |
env: | |
GITLAB_TOKEN: ${{ secrets.BOT_GITLAB_TOKEN_READ_API }} | |
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN_READ_ORG_AND_REPO }} | |
- uses: EndBug/add-and-commit@v7 # You can change this to use a specific version | |
with: | |
add: "src/main/resources/META-INF/native-image" | |
author_name: "DevEx Bot" | |
author_email: "[email protected]" | |
default_author: "user_info" | |
message: "Update native-image build config" | |
branch: ${{ github.head_ref }} | |
- name: "Clean up" | |
if: ${{ always() }} | |
run: sudo rm -rf ~/.ssh |