Commit 3d6b9035 by Edward Thomson

ci: stop using deprecated set-env in GitHub Actions

(And move the ci scripts into the `ci` directory.)
parent 2a516790
...@@ -10,7 +10,7 @@ on: ...@@ -10,7 +10,7 @@ on:
env: env:
docker-registry: docker.pkg.github.com docker-registry: docker.pkg.github.com
docker-config-path: azure-pipelines/docker docker-config-path: ci/docker
jobs: jobs:
# Build the docker container images that we will use for our Linux # Build the docker container images that we will use for our Linux
...@@ -38,7 +38,7 @@ jobs: ...@@ -38,7 +38,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
if: github.event_name == 'push' if: github.event_name == 'push'
- name: Download existing container - name: Download existing container
run: azure-pipelines/getcontainer.sh ${{ env.docker-config-path }}/${{ matrix.container }} run: ci/getcontainer.sh ${{ env.docker-config-path }}/${{ matrix.container }}
env: env:
DOCKER_REGISTRY: ${{ env.docker-registry }} DOCKER_REGISTRY: ${{ env.docker-registry }}
GITHUB_TOKEN: ${{ secrets.github_token }} GITHUB_TOKEN: ${{ secrets.github_token }}
...@@ -166,11 +166,11 @@ jobs: ...@@ -166,11 +166,11 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up build environment - name: Set up build environment
run: azure-pipelines/setup-${{ matrix.platform.setup-script }}.sh run: ci/setup-${{ matrix.platform.setup-script }}.sh
shell: bash shell: bash
if: matrix.platform.setup-script != '' if: matrix.platform.setup-script != ''
- name: Download container - name: Download container
run: azure-pipelines/getcontainer.sh ${{ env.docker-config-path }}/${{ matrix.platform.image }} run: ci/getcontainer.sh ${{ env.docker-config-path }}/${{ matrix.platform.image }}
env: env:
DOCKER_REGISTRY: ${{ env.docker-registry }} DOCKER_REGISTRY: ${{ env.docker-registry }}
GITHUB_TOKEN: ${{ secrets.github_token }} GITHUB_TOKEN: ${{ secrets.github_token }}
...@@ -198,11 +198,11 @@ jobs: ...@@ -198,11 +198,11 @@ jobs:
-e SKIP_NEGOTIATE_TESTS \ -e SKIP_NEGOTIATE_TESTS \
-e SKIP_SSH_TESTS \ -e SKIP_SSH_TESTS \
${{ env.docker-registry-container-sha }} \ ${{ env.docker-registry-container-sha }} \
/bin/bash -c "mkdir build && cd build && ../azure-pipelines/build.sh && ../azure-pipelines/test.sh" /bin/bash -c "mkdir build && cd build && ../ci/build.sh && ../ci/test.sh"
else else
mkdir build && cd build mkdir build && cd build
../azure-pipelines/build.sh ../ci/build.sh
../azure-pipelines/test.sh ../ci/test.sh
fi fi
shell: bash shell: bash
......
# These are the steps used for building on machines with bash. # These are the steps used for building on machines with bash.
steps: steps:
- bash: . '$(Build.SourcesDirectory)/azure-pipelines/build.sh' - bash: . '$(Build.SourcesDirectory)/ci/build.sh'
displayName: Build displayName: Build
workingDirectory: '$(Build.BinariesDirectory)' workingDirectory: '$(Build.BinariesDirectory)'
env: ${{ parameters.environmentVariables }} env: ${{ parameters.environmentVariables }}
- bash: . '$(Build.SourcesDirectory)/azure-pipelines/test.sh' - bash: . '$(Build.SourcesDirectory)/ci/test.sh'
displayName: Test displayName: Test
workingDirectory: '$(Build.BinariesDirectory)' workingDirectory: '$(Build.BinariesDirectory)'
env: ${{ parameters.environmentVariables }} env: ${{ parameters.environmentVariables }}
......
...@@ -8,7 +8,7 @@ jobs: ...@@ -8,7 +8,7 @@ jobs:
vmImage: 'ubuntu-18.04' vmImage: 'ubuntu-18.04'
steps: steps:
- script: | - script: |
cd $(Build.SourcesDirectory)/azure-pipelines/docker cd $(Build.SourcesDirectory)/ci/docker
docker build -t libgit2/xenial --build-arg BASE=ubuntu:xenial -f xenial . docker build -t libgit2/xenial --build-arg BASE=ubuntu:xenial -f xenial .
displayName: 'Build Docker image' displayName: 'Build Docker image'
- task: Docker@0 - task: Docker@0
...@@ -22,5 +22,5 @@ jobs: ...@@ -22,5 +22,5 @@ jobs:
envVars: | envVars: |
COVERITY_TOKEN=$(COVERITY_TOKEN) COVERITY_TOKEN=$(COVERITY_TOKEN)
workDir: '/home/libgit2/build' workDir: '/home/libgit2/build'
containerCommand: '/home/libgit2/source/azure-pipelines/coverity.sh' containerCommand: '/home/libgit2/source/ci/coverity.sh'
detached: false detached: false
...@@ -13,7 +13,7 @@ steps: ...@@ -13,7 +13,7 @@ steps:
if [ -f /tmp/dockercache/${{parameters.docker.image}}.tar ]; then docker load < /tmp/dockercache/${{parameters.docker.image}}.tar; fi if [ -f /tmp/dockercache/${{parameters.docker.image}}.tar ]; then docker load < /tmp/dockercache/${{parameters.docker.image}}.tar; fi
displayName: 'Load Docker cache' displayName: 'Load Docker cache'
- script: | - script: |
cd $(Build.SourcesDirectory)/azure-pipelines/docker && cd $(Build.SourcesDirectory)/ci/docker &&
docker build -t libgit2/${{parameters.docker.image}} --build-arg BASE=${{parameters.docker.base}} -f ${{parameters.docker.image}} . && docker build -t libgit2/${{parameters.docker.image}} --build-arg BASE=${{parameters.docker.base}} -f ${{parameters.docker.image}} . &&
if [ ! -d /tmp/dockercache ]; then mkdir /tmp/dockercache; fi && if [ ! -d /tmp/dockercache ]; then mkdir /tmp/dockercache; fi &&
docker save libgit2/${{parameters.docker.image}} $(docker history -q libgit2/${{parameters.docker.image}} | grep -v '<missing>') > /tmp/dockercache/${{parameters.docker.image}}.tar docker save libgit2/${{parameters.docker.image}} $(docker history -q libgit2/${{parameters.docker.image}} | grep -v '<missing>') > /tmp/dockercache/${{parameters.docker.image}}.tar
...@@ -28,7 +28,7 @@ steps: ...@@ -28,7 +28,7 @@ steps:
$(Build.BinariesDirectory):/home/libgit2/build $(Build.BinariesDirectory):/home/libgit2/build
envVars: ${{ parameters.environmentVariables }} envVars: ${{ parameters.environmentVariables }}
workDir: '/home/libgit2/build' workDir: '/home/libgit2/build'
containerCommand: '/home/libgit2/source/azure-pipelines/build.sh' containerCommand: '/home/libgit2/source/ci/build.sh'
detached: false detached: false
- task: docker@0 - task: docker@0
displayName: Test displayName: Test
...@@ -40,7 +40,7 @@ steps: ...@@ -40,7 +40,7 @@ steps:
$(Build.BinariesDirectory):/home/libgit2/build $(Build.BinariesDirectory):/home/libgit2/build
envVars: ${{ parameters.environmentVariables }} envVars: ${{ parameters.environmentVariables }}
workDir: '/home/libgit2/build' workDir: '/home/libgit2/build'
containerCommand: '/home/libgit2/source/azure-pipelines/test.sh' containerCommand: '/home/libgit2/source/ci/test.sh'
detached: false detached: false
- task: publishtestresults@2 - task: publishtestresults@2
displayName: Publish Test Results displayName: Publish Test Results
......
...@@ -71,7 +71,7 @@ jobs: ...@@ -71,7 +71,7 @@ jobs:
pool: pool:
vmImage: 'macOS-10.15' vmImage: 'macOS-10.15'
steps: steps:
- bash: . '$(Build.SourcesDirectory)/azure-pipelines/setup-osx.sh' - bash: . '$(Build.SourcesDirectory)/ci/setup-osx.sh'
displayName: Setup displayName: Setup
- template: bash.yml - template: bash.yml
parameters: parameters:
...@@ -114,7 +114,7 @@ jobs: ...@@ -114,7 +114,7 @@ jobs:
pool: pool:
vmImage: 'vs2017-win2016' vmImage: 'vs2017-win2016'
steps: steps:
- bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh' - bash: . '$(Build.SourcesDirectory)\ci\setup-mingw.sh'
displayName: Setup displayName: Setup
env: env:
TEMP: $(Agent.TempDirectory) TEMP: $(Agent.TempDirectory)
...@@ -133,7 +133,7 @@ jobs: ...@@ -133,7 +133,7 @@ jobs:
pool: pool:
vmImage: 'vs2017-win2016' vmImage: 'vs2017-win2016'
steps: steps:
- bash: . '$(Build.SourcesDirectory)\azure-pipelines\setup-mingw.sh' - bash: . '$(Build.SourcesDirectory)\ci\setup-mingw.sh'
displayName: Setup displayName: Setup
workingDirectory: '$(Build.BinariesDirectory)' workingDirectory: '$(Build.BinariesDirectory)'
env: env:
......
...@@ -18,18 +18,18 @@ fi ...@@ -18,18 +18,18 @@ fi
DOCKER_CONTAINER="${GITHUB_REPOSITORY}/$(basename ${DOCKERFILE_PATH})" DOCKER_CONTAINER="${GITHUB_REPOSITORY}/$(basename ${DOCKERFILE_PATH})"
DOCKER_REGISTRY_CONTAINER="${DOCKER_REGISTRY}/${DOCKER_CONTAINER}" DOCKER_REGISTRY_CONTAINER="${DOCKER_REGISTRY}/${DOCKER_CONTAINER}"
echo "::set-env name=docker-container::${DOCKER_CONTAINER}" echo "docker-container=${DOCKER_CONTAINER}" >> $GITHUB_ENV
echo "::set-env name=docker-registry-container::${DOCKER_REGISTRY_CONTAINER}" echo "docker-registry-container=${DOCKER_REGISTRY_CONTAINER}" >> $GITHUB_ENV
# Identify the last git commit that touched the Dockerfiles # Identify the last git commit that touched the Dockerfiles
# Use this as a hash to identify the resulting docker containers # Use this as a hash to identify the resulting docker containers
DOCKER_SHA=$(git log -1 --pretty=format:"%h" -- "${DOCKERFILE_PATH}") DOCKER_SHA=$(git log -1 --pretty=format:"%h" -- "${DOCKERFILE_PATH}")
echo "::set-env name=docker-sha::${DOCKER_SHA}" echo "docker-sha=${DOCKER_SHA}" >> $GITHUB_ENV
DOCKER_REGISTRY_CONTAINER_SHA="${DOCKER_REGISTRY_CONTAINER}:${DOCKER_SHA}" DOCKER_REGISTRY_CONTAINER_SHA="${DOCKER_REGISTRY_CONTAINER}:${DOCKER_SHA}"
echo "::set-env name=docker-registry-container-sha::${DOCKER_REGISTRY_CONTAINER_SHA}" echo "docker-registry-container-sha=${DOCKER_REGISTRY_CONTAINER_SHA}" >> $GITHUB_ENV
echo "::set-env name=docker-registry-container-latest::${DOCKER_REGISTRY_CONTAINER}:latest" echo "docker-registry-container-latest=${DOCKER_REGISTRY_CONTAINER}:latest" >> $GITHUB_ENV
exists="true" exists="true"
docker login https://${DOCKER_REGISTRY} -u ${GITHUB_ACTOR} -p ${GITHUB_TOKEN} || exists="false" docker login https://${DOCKER_REGISTRY} -u ${GITHUB_ACTOR} -p ${GITHUB_TOKEN} || exists="false"
...@@ -39,7 +39,7 @@ if [ "${exists}" != "false" ]; then ...@@ -39,7 +39,7 @@ if [ "${exists}" != "false" ]; then
fi fi
if [ "${exists}" = "true" ]; then if [ "${exists}" = "true" ]; then
echo "::set-env name=docker-container-exists::true" echo "docker-container-exists=true" >> $GITHUB_ENV
else else
echo "::set-env name=docker-container-exists::false" echo "docker-container-exists=false" >> $GITHUB_ENV
fi fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment