Refactory #163
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: Tests | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
go: ["1.22", "1.23"] | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Start Jenkins | |
id: start-jenkins | |
shell: bash | |
run: | | |
set -e | |
sudo docker run -dt --rm --name jenkins-master joelee2012/standalone-jenkins:latest | |
echo 'Waiting for Jenkins to start...' | |
until sudo docker logs jenkins-master | grep -q 'Jenkins is fully up and running'; do | |
sleep 1 | |
done | |
ip=$(sudo docker inspect --format='{{.NetworkSettings.IPAddress}}' jenkins-master) | |
password=$(sudo docker exec jenkins-master cat /var/jenkins_home/secrets/initialAdminPassword) | |
version=$(sudo docker exec jenkins-master sh -c 'echo "$JENKINS_VERSION"') | |
port=8080 | |
echo "JENKINS_URL=http://${ip}:${port}/" >> $GITHUB_ENV | |
echo "JENKINS_USER=admin" >> $GITHUB_ENV | |
echo "JENKINS_PASSWORD=${password}" >> $GITHUB_ENV | |
echo "JENKINS_VERSION=${version}" >> $GITHUB_ENV | |
- name: Run go test | |
run: make test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
if: matrix.go == '1.23' | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # required | |
verbose: true # optional (default = false) |