Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
Merged
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
84 changes: 84 additions & 0 deletions .github/workflows/test-maven-setup-action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: test-maven-setup-action
on:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-16.04
name: test maven-setup action

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1.3.0
with:
java-version: '13'
- uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- run: env | sort
- uses: navikt/bidrag-maven/setup@main
with:
repositories: maven-releases=https://repo.releases,snapshots=https://repo.snapshots
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: mvn help:effective-pom
- name: Verify .m2 home
run: |
POM=$(cat ~/.m2/settings.xml)
echo $POM
echo count number of repos
COUNT_REPOS=$(echo $POM | grep -c https://repo)

echo count number of maven-releases
COUNT_NAME_MAVEN=$(echo $POM | grep -c maven-releases)

echo count number of snapshots
COUNT_NAME_SNAP=$(echo $POM | grep -c snapshots)

echo count number of github actor
COUNT_ACTOR=$(echo $POM | grep -c $GITHUB_ACTOR)

echo count number of github tokens
COUNT_TOKEN=$(echo $POM | grep -c $GITHUB_TOKEN)

# FOR SOME REASON, ONLY COUNTS ONE????
echo check number of repos
if [[ $COUNT_REPOS -ne 1 ]]; then
echo ::error:: $COUNT_REPOS is not expected 2 repositories urls from the settings.xml
exit 1
fi

# FOR SOME REASON, ONLY COUNTS ONE????
echo check number of maven-releases
if [[ $COUNT_NAME_MAVEN -ne 1 ]]; then
echo ::error:: expected maven-releases to occur for server/repo id and repo name in the settings.xml, but found: $COUNT_NAME_MAVEN
exit 1
fi

# FOR SOME REASON, ONLY COUNTS ONE????
echo check number of snapshots
if [[ $COUNT_NAME_SNAP -ne 1 ]]; then
echo ::error:: could not find name snapshots to occur for server/repo id and repo name in the settings.xml, but found: $COUNT_NAME_SNAP
exit 1
fi

# FOR SOME REASON, ONLY COUNTS ONE????
echo check number of github actor
if [[ $COUNT_ACTOR -ne 1 ]]; then
echo ::error:: could not find github actor as username for each repository, but found: $COUNT_ACTOR
exit 1
fi

# FOR SOME REASON, ONLY COUNTS ONE????
echo check number of github tokens
if [[ $COUNT_TOKEN -ne 1 ]]; then
echo ::error:: could not find github token as password for each repository, but found: $COUNT_TOKEN
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}