Skip to content
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

Replace AzurePipelines by GitHub Actions #56

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
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
45 changes: 3 additions & 42 deletions .azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,11 @@
pool:
vmImage: 'ubuntu-20.04'
steps:
- bash: ./render.sh
displayName: Build
- bash: |
set -e

WORKING_DIR="`pwd`/work"
RESULT_DIR=$WORKING_DIR/result

TEMP=/tmp/jacoco-snapshot
mkdir $TEMP
wget -O $TEMP/download.zip "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.jacoco&a=jacoco&e=zip&v=LATEST"
unzip $TEMP/download.zip -d $TEMP

TARGET=$RESULT_DIR/jacoco/trunk
mkdir $TARGET
cp $TEMP/index.html $TARGET
cp -r $TEMP/doc $TARGET/doc
cp -r $TEMP/test $TARGET/test
cp -r $TEMP/coverage $TARGET/coverage

cd work/result

# https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/
touch .nojekyll

git init
git config user.name ${GIT_COMMITTER_NAME}
git config user.email ${GIT_COMMITTER_EMAIL}
git add .
git commit -q -m "Automatic deployment"

git push --force "https://${GH_TOKEN}@github.com/jacoco/jacoco.github.io" master > /dev/null 2>&1

echo "www.jacoco.org" > CNAME && git add CNAME && git commit -q --amend --reuse-message=HEAD
git push --force "https://${GH_TOKEN}@github.com/jacoco/jacoco.org" master:gh-pages > /dev/null 2>&1

echo "www.eclemma.org" > CNAME && git add CNAME && git commit -q --amend --reuse-message=HEAD
git push --force "https://${GH_TOKEN}@github.com/jacoco/eclemma.org" master:gh-pages > /dev/null 2>&1

echo "www.eclemma.com" > CNAME && git add CNAME && git commit -q --amend --reuse-message=HEAD
git push --force "https://${GH_TOKEN}@github.com/jacoco/eclemma.com" master:gh-pages > /dev/null 2>&1
curl --data '{"event_type": "JaCoCo build"}' \
marchof marked this conversation as resolved.
Show resolved Hide resolved
-H "Authorization: token ${GH_TOKEN}" \
https://api.github.com/repos/jacoco/www.eclemma.org/dispatches
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Deploy
env:
GIT_COMMITTER_NAME: $(GIT_COMMITTER_NAME)
GIT_COMMITTER_EMAIL: $(GIT_COMMITTER_EMAIL)
GH_TOKEN: $(GH_TOKEN)
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI
on:
- push
- pull_request
- repository_dispatch
jobs:
build:
runs-on: ubuntu-20.04
environment: ${{ (github.repository == 'jacoco/www.eclemma.org' && github.ref == 'refs/heads/master') && 'sites' || null }}
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 0
- name: 'Build'
run: ./render.sh
- name: 'Deploy'
if: ${{ (github.repository == 'jacoco/www.eclemma.org' && github.ref == 'refs/heads/master') }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
run: |
WORKING_DIR="`pwd`/work"
RESULT_DIR=$WORKING_DIR/result
TEMP=/tmp/jacoco-snapshot
mkdir $TEMP
wget -O $TEMP/download.zip "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.jacoco&a=jacoco&e=zip&v=LATEST"
unzip $TEMP/download.zip -d $TEMP

TARGET=$RESULT_DIR/jacoco/trunk
mkdir $TARGET
cp $TEMP/index.html $TARGET
cp -r $TEMP/doc $TARGET/doc
cp -r $TEMP/test $TARGET/test
cp -r $TEMP/coverage $TARGET/coverage

cd work/result

# https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/
touch .nojekyll

git init
git config user.name ${GIT_COMMITTER_NAME}
git config user.email ${GIT_COMMITTER_EMAIL}
git add .
git commit -q -m "Automatic deployment"

git push --force "https://${GH_TOKEN}@github.com/jacoco/jacoco.github.io" master > /dev/null 2>&1

echo "www.jacoco.org" > CNAME && git add CNAME && git commit -q --amend --reuse-message=HEAD
git push --force "https://${GH_TOKEN}@github.com/jacoco/jacoco.org" master:gh-pages > /dev/null 2>&1

echo "www.eclemma.org" > CNAME && git add CNAME && git commit -q --amend --reuse-message=HEAD
git push --force "https://${GH_TOKEN}@github.com/jacoco/eclemma.org" master:gh-pages > /dev/null 2>&1

echo "www.eclemma.com" > CNAME && git add CNAME && git commit -q --amend --reuse-message=HEAD
git push --force "https://${GH_TOKEN}@github.com/jacoco/eclemma.com" master:gh-pages > /dev/null 2>&1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[![Build Status](https://dev.azure.com/jacoco-org/JaCoCo/_apis/build/status/Site?branchName=master)](https://dev.azure.com/jacoco-org/JaCoCo/_build/latest?definitionId=2&branchName=master)
[![Build Status](https://github.com/jacoco/www.eclemma.org/actions/workflows/ci.yml/badge.svg)](https://github.com/jacoco/www.eclemma.org/actions/workflows/ci.yml)