Delete files synchronously #1397
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: Unit-Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
manual: | |
description: 'Manual Run' | |
type: boolean | |
required: true | |
default: true | |
jobs: | |
linux-unit-test: | |
name: Build and Test on Linux | |
runs-on: ubuntu-latest | |
env: | |
go: '1.23.2' | |
cgo: '' | |
containerName: 'test-cnt-ubn' | |
AWS_ENDPOINT: http://localhost:4566 | |
AWS_REGION: us-east-1 | |
AWS_ACCESS_KEY_ID: test | |
AWS_SECRET_ACCESS_KEY: test | |
AWS_BUCKET_NAME: test | |
# Using default test credentials for Azurite | |
BLOB_ENDPOINT: http://127.0.0.1:10000/devstoreaccount1 | |
BLOB_ACCOUNT: devstoreaccount1 | |
BLOB_KEY: Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw== | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.go }} | |
check-latest: true | |
- run: go version | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Set CGO | |
shell: bash | |
run: | | |
if [[ "${{ env.cgo }}" != "" ]]; then echo 'CGO_ENABLED=${{ env.cgo }}' >> $GITHUB_ENV ; fi | |
- name: Install libfuse on Linux | |
shell: bash | |
run: | | |
sudo apt-get install fuse3 libfuse-dev rpm pkg-config | |
- name: Build | |
run: | | |
./build.sh | |
- name: Create Azure Configuration File on Linux | |
run: |- | |
cnfFile=$HOME/azuretest.json | |
echo $cnfFile | |
touch $cnfFile | |
echo "{" > $cnfFile | |
echo "\"block-acct\"": "\"${{ env.BLOB_ACCOUNT }}\"", >> $cnfFile | |
echo "\"block-key\"": "\"${{ env.BLOB_KEY }}\"", >> $cnfFile | |
echo "\"endpoint\"": "\"${{ env.BLOB_ENDPOINT }}\"", >> $cnfFile | |
echo "\"skip-msi\"": "true", >> $cnfFile | |
echo "\"skip-azcli\"": "true", >> $cnfFile | |
echo "\"proxy-address\"": "\"\"" >> $cnfFile | |
echo "}" >> $cnfFile | |
- name: Create S3 Configuration File on Linux | |
run: |- | |
cnfFile=$HOME/s3test.json | |
echo $cnfFile | |
touch $cnfFile | |
echo "{" > $cnfFile | |
echo "\"bucket-name\"": "\"${{ env.AWS_BUCKET_NAME }}\"", >> $cnfFile | |
echo "\"access-key\"": "\"${{ env.AWS_ACCESS_KEY_ID }}\"", >> $cnfFile | |
echo "\"secret-key\"": "\"${{ env.AWS_SECRET_ACCESS_KEY }}\"", >> $cnfFile | |
echo "\"endpoint\"": "\"${{ env.AWS_ENDPOINT }}\"", >> $cnfFile | |
echo "\"region\"": "\"${{ env.AWS_REGION }}\"", >> $cnfFile | |
echo "\"use-path-style\"": true\ >> $cnfFile | |
echo "}" >> $cnfFile | |
- name: Start LocalStack | |
run: | | |
pip install localstack awscli-local[ver1] # install LocalStack cli and awslocal | |
docker pull localstack/localstack # Make sure to pull the latest version of the image | |
localstack start -d # Start LocalStack in the background | |
echo "Waiting for LocalStack startup..." # Wait 20 seconds for the LocalStack container | |
localstack wait -t 20 # to become ready before timing out | |
echo "Startup complete" | |
- name: Install Azurite | |
run: npm install -g azurite | |
- name: Start Azurite | |
run: azurite --silent & | |
- name: Run some Tests against LocalStack | |
run: | | |
awslocal s3 mb s3://test | |
awslocal s3 ls | |
- name: Run unit tests | |
run: go test -v -timeout=1h ./... --tags=unittest,azurite | |
test: | |
name: Build and Test on Windows | |
runs-on: windows-latest | |
env: | |
go: '1.23.2' | |
cgo: '0' | |
containerName: 'test-cnt-win' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.go }} | |
check-latest: true | |
- run: go version | |
- name: Set CGO | |
shell: bash | |
run: | | |
if [[ "${{ env.cgo }}" != "" ]]; then echo 'CGO_ENABLED=${{ env.cgo }}' >> $GITHUB_ENV ; fi | |
- name: Build | |
shell: bash | |
run: | | |
./build.sh | |
- name: Run unit tests | |
run: go test -v -timeout=1h ./... --tags=unittest,authtest | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
env: | |
go: '1.23.2' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.go }} | |
check-latest: true | |
- run: go version | |
- name: Set CGO | |
shell: bash | |
run: | | |
if [[ "${{ env.go }}" != "" ]]; then echo 'CGO_ENABLED=${{ env.go }}' >> $GITHUB_ENV ; fi | |
- name: Install libfuse on Linux | |
shell: bash | |
run: | | |
sudo apt-get install libfuse-dev | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
# Require: The version of golangci-lint to use. | |
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. | |
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. | |
version: latest | |
# Optional: golangci-lint command line arguments. | |
args: --tests=false --timeout=5m --exclude-dirs test,common/stats_collector,common/stats_monitor --exclude-files component/libfuse/libfuse2_handler_test_wrapper.go --out-format=github-actions | |
- name: Notice file check | |
run: | | |
./notices_fix.sh | |
result=$(git diff NOTICE | wc -l) | |
if [ $result -ne 0 ]; then | |
echo "Notices needs a fix. Run ./notices_fix.sh and commit NOTICE file." | |
exit 1 | |
else | |
echo "Notices are up to date." | |
fi |